chore: reformat codebase

This commit is contained in:
Gabriel Arazas 2024-01-06 19:10:54 +08:00
parent 7f3f83c757
commit 1957df91ea
No known key found for this signature in database
GPG Key ID: ADE0C41DAB221FCC
3 changed files with 168 additions and 161 deletions

View File

@ -3,7 +3,7 @@
, meson , meson
, ninja , ninja
, makeWrapper , makeWrapper
, inputs ? [] , inputs ? [ ]
}: }:
stdenv.mkDerivation { stdenv.mkDerivation {

View File

@ -79,6 +79,21 @@
outputs = inputs@{ self, nixpkgs, ... }: outputs = inputs@{ self, nixpkgs, ... }:
let let
# A set of image-related utilities for the flake outputs.
inherit (import ./lib/extras/images.nix { inherit lib inputs; }) mkHost mkHome mkImage listImagesWithSystems;
# We're considering this as the variant since we'll export the custom
# library as `lib` in the output attribute.
lib = nixpkgs.lib.extend (import ./lib/extras/extend-lib.nix);
# Just add systems here and it should add systems to the outputs.
defaultSystem = "x86_64-linux";
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
# A set of images with their metadata that is usually built for usual # A set of images with their metadata that is usually built for usual
# purposes. The format used here is whatever formats nixos-generators # purposes. The format used here is whatever formats nixos-generators
# support. # support.
@ -88,29 +103,13 @@
# A set of users with their metadata to be deployed with home-manager. # A set of users with their metadata to be deployed with home-manager.
users = import ./setups/home-manager.nix { inherit lib inputs; }; users = import ./setups/home-manager.nix { inherit lib inputs; };
# A set of image-related utilities for the flake outputs.
inherit (import ./lib/extras/images.nix { inherit lib inputs; }) mkHost mkHome mkImage listImagesWithSystems;
# The order here is important(?). # The order here is important(?).
overlays = lib.attrValues self.overlays; overlays = lib.attrValues self.overlays;
defaultSystem = "x86_64-linux";
# Just add systems here and it should add systems to the outputs.
systems = [
"x86_64-linux"
"aarch64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
extraArgs = { extraArgs = {
inherit (inputs) nix-colors; inherit (inputs) nix-colors;
}; };
# We're considering this as the variant since we'll export the custom
# library as `lib` in the output attribute.
lib = nixpkgs.lib.extend (import ./lib/extras/extend-lib.nix);
# The shared configuration for the entire list of hosts for this cluster. # The shared configuration for the entire list of hosts for this cluster.
# Take note to only set as minimal configuration as possible since we're # Take note to only set as minimal configuration as possible since we're
# also using this with the stable version of nixpkgs. # also using this with the stable version of nixpkgs.
@ -365,7 +364,8 @@
}; };
in in
{ {
apps = forAllSystems (system: let apps = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in
{ {

View File

@ -75,7 +75,7 @@ let
`PartOf=$COMPONENTID.target`). `PartOf=$COMPONENTID.target`).
::: :::
''; '';
default = {}; default = { };
}; };
targetUnit = lib.mkOption { targetUnit = lib.mkOption {
@ -101,7 +101,7 @@ let
gnome-session targets. This is on the user to manually set them. gnome-session targets. This is on the user to manually set them.
::: :::
''; '';
default = {}; default = { };
}; };
timerUnit = lib.mkOption { timerUnit = lib.mkOption {
@ -206,7 +206,8 @@ let
}; };
}; };
config = let config =
let
scriptName = "${session.name}-${name}-script"; scriptName = "${session.name}-${name}-script";
script = "${config.scriptPackage}/bin/${scriptName}"; script = "${config.scriptPackage}/bin/${scriptName}";
in in
@ -508,7 +509,8 @@ let
inherit (utils.systemdUtils.lib) inherit (utils.systemdUtils.lib)
pathToUnit serviceToUnit targetToUnit timerToUnit socketToUnit; pathToUnit serviceToUnit targetToUnit timerToUnit socketToUnit;
componentsUnits = componentsUnits =
lib.foldlAttrs (acc: name: component: lib.foldlAttrs
(acc: name: component:
acc // { acc // {
"${component.id}.service" = serviceToUnit component.id component.serviceUnit; "${component.id}.service" = serviceToUnit component.id component.serviceUnit;
"${component.id}.target" = targetToUnit component.id component.targetUnit; "${component.id}.target" = targetToUnit component.id component.targetUnit;
@ -519,7 +521,8 @@ let
} // lib.optionalAttrs (component.pathUnit != null) { } // lib.optionalAttrs (component.pathUnit != null) {
"${component.id}.path" = pathToUnit component.id component.pathUnit; "${component.id}.path" = pathToUnit component.id component.pathUnit;
}) })
{} config.components; { }
config.components;
in in
componentsUnits // { componentsUnits // {
"gnome-session@${name}.target" = targetToUnit "gnome-session@${name}" config.targetUnit; "gnome-session@${name}.target" = targetToUnit "gnome-session@${name}" config.targetUnit;
@ -585,10 +588,13 @@ let
''; '';
}; };
installDesktopSessions = builtins.map (display: installDesktopSessions = builtins.map
displayScripts.${display}) config.display; (display:
displayScripts.${display})
config.display;
installSystemdUserUnits = lib.mapAttrsToList (n: v: installSystemdUserUnits = lib.mapAttrsToList
(n: v:
if (v ? overrideStrategy && v.overrideStrategy == "asDropin") then '' if (v ? overrideStrategy && v.overrideStrategy == "asDropin") then ''
( (
unit="${v.unit}/${n}" unit="${v.unit}/${n}"
@ -597,7 +603,8 @@ let
) )
'' else '' '' else ''
install -Dm0644 "${v.unit}/${n}" -t "$out/share/systemd/user" install -Dm0644 "${v.unit}/${n}" -t "$out/share/systemd/user"
'') config.systemdUserUnits; '')
config.systemdUserUnits;
installDesktops = lib.mapAttrsToList installDesktops = lib.mapAttrsToList
(_: p: '' (_: p: ''