From 6d643f903cc37ddd588739aabbcf3b776e3ba894 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Thu, 21 Nov 2024 14:54:22 +0100 Subject: [PATCH] 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. --- flake.nix | 5 +---- hosts/default.nix | 16 +++++++--------- lib/default.nix | 26 ++------------------------ 3 files changed, 10 insertions(+), 37 deletions(-) diff --git a/flake.nix b/flake.nix index 2dedbb2..67ac89c 100644 --- a/flake.nix +++ b/flake.nix @@ -24,10 +24,7 @@ }; }); formatter = eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); - nixosConfigurations = let - lib' = import ./lib {inherit inputs lib';}; - in - import ./hosts {inherit inputs lib';}; + nixosConfigurations = import ./hosts {inherit inputs;}; packages = eachSystem (pkgs: import ./pkgs {inherit inputs pkgs;}); deploy.nodes = import ./nodes {inherit inputs;}; checks = builtins.mapAttrs (_: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; diff --git a/hosts/default.nix b/hosts/default.nix index 06acffc..94255dc 100644 --- a/hosts/default.nix +++ b/hosts/default.nix @@ -1,12 +1,12 @@ -{ - inputs, - lib', - ... -}: let - inherit (lib') mkSystem; +{inputs, ...}: let + lib' = import ../lib; + mkSystem = args: + inputs.nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs lib';}; + modules = args.modules or []; + }; in { vamos = mkSystem { - system = "x86_64-linux"; modules = [ ./vamos ../modules @@ -15,7 +15,6 @@ in { }; solaire = mkSystem { - system = "x86_64-linux"; modules = [ ./solaire ../modules @@ -23,7 +22,6 @@ in { }; anastacia = mkSystem { - system = "x86_64-linux"; modules = [ ./anastacia ]; diff --git a/lib/default.nix b/lib/default.nix index 3b78a1c..ad5a2dd 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,9 +1,4 @@ -{ - inputs, - lib', - ... -}: let - inherit (inputs.nixpkgs) lib; +{lib, ...}: let # convert rrggbb hex to rgba(r, g, b, a) rgba = c: let r = toString (hexToDec (builtins.substring 0 2 c)); @@ -89,23 +84,6 @@ # Create a KDE konsole color scheme from base16 colors mkKonsoleColorScheme = pkgs: 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 { - inherit mkKonsoleColorScheme rgba mkSystem; + inherit mkKonsoleColorScheme rgba; }