treewide: import custom lib as lib', simplify mkSystem

I decided to import my custom lib as lib' as it makes it easier to read
and differentiate from lib. I also removed unnecessary imports from my
mkSystem function (that I actually put directly inside
hosts/default.nix, as that made more sense), since system is not needed
anymore (already set in hardware-configuration.nix), and the only
required argument is inputs, that will be then parsed automatically by
nixosSystem.
This commit is contained in:
Anthony Rodriguez 2024-11-21 14:54:22 +01:00
parent 00bb0ea051
commit 6d643f903c
Signed by: nezia
GPG key ID: EE3BE97C040A86CE
3 changed files with 10 additions and 37 deletions

View file

@ -24,10 +24,7 @@
}; };
}); });
formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);
nixosConfigurations = let nixosConfigurations = import ./hosts {inherit inputs;};
lib' = import ./lib {inherit inputs lib';};
in
import ./hosts {inherit inputs lib';};
packages = eachSystem (pkgs: import ./pkgs {inherit inputs pkgs;}); packages = eachSystem (pkgs: import ./pkgs {inherit inputs pkgs;});
deploy.nodes = import ./nodes {inherit inputs;}; deploy.nodes = import ./nodes {inherit inputs;};
checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib;

View file

@ -1,12 +1,12 @@
{ {inputs, ...}: let
inputs, lib' = import ../lib;
lib', mkSystem = args:
... inputs.nixpkgs.lib.nixosSystem {
}: let specialArgs = {inherit inputs lib';};
inherit (lib') mkSystem; modules = args.modules or [];
};
in { in {
vamos = mkSystem { vamos = mkSystem {
system = "x86_64-linux";
modules = [ modules = [
./vamos ./vamos
../modules ../modules
@ -15,7 +15,6 @@ in {
}; };
solaire = mkSystem { solaire = mkSystem {
system = "x86_64-linux";
modules = [ modules = [
./solaire ./solaire
../modules ../modules
@ -23,7 +22,6 @@ in {
}; };
anastacia = mkSystem { anastacia = mkSystem {
system = "x86_64-linux";
modules = [ modules = [
./anastacia ./anastacia
]; ];

View file

@ -1,9 +1,4 @@
{ {lib, ...}: let
inputs,
lib',
...
}: let
inherit (inputs.nixpkgs) lib;
# convert rrggbb hex to rgba(r, g, b, a) # convert rrggbb hex to rgba(r, g, b, a)
rgba = c: let rgba = c: let
r = toString (hexToDec (builtins.substring 0 2 c)); r = toString (hexToDec (builtins.substring 0 2 c));
@ -89,23 +84,6 @@
# Create a KDE konsole color scheme from base16 colors # Create a KDE konsole color scheme from base16 colors
mkKonsoleColorScheme = pkgs: scheme: mkKonsoleColorScheme = pkgs: scheme:
pkgs.writeText "${scheme.name}.colorscheme" (schemeToKonsole scheme); pkgs.writeText "${scheme.name}.colorscheme" (schemeToKonsole scheme);
# https://github.com/diniamo/niqs/blob/caf396bb470619fa06936a379eec6e283c3c3d95/lib/default.nix#L13-L35C7
mkSystem = {system, ...} @ args:
lib.nixosSystem {
system = null;
specialArgs = {inherit inputs;};
modules =
[
{
_module.args = {
inherit system lib';
};
nixpkgs = {inherit system;};
}
]
++ args.modules or [];
};
in { in {
inherit mkKonsoleColorScheme rgba mkSystem; inherit mkKonsoleColorScheme rgba;
} }