diff options
author | sefidel <contact@sefidel.net> | 2024-01-23 00:21:50 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2024-01-23 01:05:04 +0900 |
commit | 686390149fb250054fea5de87a068adc44b0e394 (patch) | |
tree | 3da5a0455dca3ee9f75845a3c9a36b7f9bff4de0 | |
parent | b311d7f8459fe1e90f7b0cbf5862b22a2cbedff5 (diff) | |
download | nixrc-686390149fb250054fea5de87a068adc44b0e394.tar.gz nixrc-686390149fb250054fea5de87a068adc44b0e394.zip |
feat(flake): generate colmena from nixosConfigurations
-rw-r--r-- | flake.nix | 3 | ||||
-rw-r--r-- | lib/mk_system.nix | 22 |
2 files changed, 13 insertions, 12 deletions
diff --git a/flake.nix b/flake.nix index 9cb3aa9..bcfc778 100644 --- a/flake.nix +++ b/flake.nix @@ -41,8 +41,7 @@ homeConfigurations = import ./home inputs; - packages.x86_64-linux = self.lib.nixosConfigurationsAsPackages.x86_64-linux - // self.lib.homeConfigurationsAsPackages.x86_64-linux; + colmena = self.lib.mkColmenaFromNixOSConfigurations self.nixosConfigurations; lib = lib.my; }; diff --git a/lib/mk_system.nix b/lib/mk_system.nix index 2aca550..ff51fef 100644 --- a/lib/mk_system.nix +++ b/lib/mk_system.nix @@ -28,13 +28,15 @@ ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; } ++ nixpkgs.lib.optionals (extraModules != null) extraModules; } - entryPoint - hardware - # TODO: import all modules (use mapModules?) - ../modules/flakes.nix - ../modules/nix.nix - ../modules/nixpkgs.nix - ] ++ nixpkgs.lib.optional (overlays != null) { nixpkgs.overlays = overlays; } - ++ nixpkgs.lib.optionals (extraModules != null) extraModules; - } -) + ); + + mkColmenaFromNixOSConfigurations = conf: + { + meta = { + # Colmena requirement. Will be overridden in nodeNixpkgs. + nixpkgs = import unstable { system = "x86_64-linux"; }; + nodeNixpkgs = builtins.mapAttrs (_: value: value.pkgs) conf; + nodeSpecialArgs = builtins.mapAttrs (_: value: value._module.specialArgs) conf; + }; + } // builtins.mapAttrs (_: value: { imports = value._module.args.modules; }) conf; +} |