diff --git a/nix/.#common.nix b/nix/.#common.nix deleted file mode 120000 index 8a1b31e..0000000 --- a/nix/.#common.nix +++ /dev/null @@ -1 +0,0 @@ -materus@materusPC.1079801:1747170257 \ No newline at end of file diff --git a/nix/common-os.nix b/nix/common-os.nix new file mode 100644 index 0000000..cd1067d --- /dev/null +++ b/nix/common-os.nix @@ -0,0 +1,4 @@ +{...}: +{ + +} diff --git a/nix/common.nix b/nix/common.nix index b3c4b25..63fabdd 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -180,7 +180,7 @@ } { - assertion = config.mkk.isDecrypted; + assertion = mkkArg.isDecrypted; message = "Need to decrypt MKK repo to build"; } ]; @@ -189,23 +189,11 @@ ( let - decryptedBool = - let - file = ../private/check-encryption; - resultFile = pkgs.runCommandLocal "check-encryption" { src = file; } '' - if [[ "$(< $src)" != "DECRYPTED" ]]; then - echo -n "no" >> $out; - else - echo -n "yes" >> $out; - fi - ''; - in - (builtins.readFile resultFile == "yes"); + in { - options.konfig = lib.mkOption { default = { }; }; - options.mkk.isDecrypted = lib.mkOption { default = decryptedBool; }; + options.konfig = lib.mkOption { default = { }; }; config = { konfig = { unstable = mkkArg.unstable; diff --git a/nix/default.nix b/nix/default.nix index 8e94ede..703869b 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -13,9 +13,8 @@ let fi ''; in - (builtins.readFile resultFile == "yes"); + (builtins.readFile resultFile == "yes"); - stable = inputs.config-stable; unstable = inputs.config-unstable; nixpkgs = stable.nixpkgs; @@ -28,20 +27,52 @@ let in { # * NixOS configurations - nixosConfigurations = { -# ** materusPC + nixosConfigurations = + let + mkSystem = + hostname: + { + system ? "x86_64-linux", + isStable ? true, + extraArgs ? { }, + extraModules ? [ ], + }: + (if isStable then nixpkgs else nixpkgs-unstable).lib.nixosSystem { + system = system; + specialArgs = { + mkkArg = + mkkArg + // { + current = (if isStable then stable else unstable); + } + // { + isDecrypted = (isDecrypted (if isStable then stable else unstable).nixpkgs system); + } + // extraArgs; + }; + modules = [ + ./hosts/${hostname}.nix + ( + if + ( + (isDecrypted (if isStable then stable else unstable).nixpkgs system) + && builtins.pathExists ./hosts/${hostname}-private.nix + ) + then + ./hosts/${hostname}-private.nix + else + { } + ) + ./common.nix + ./common-os.nix + ] ++ extraModules; + }; - "materusPC" = nixpkgs.lib.nixosSystem rec { - system = "x86_64-linux"; - specialArgs = { mkkArg = mkkArg // {current = stable;}; }; - modules = [ - ./hosts/materusPC.nix - (if (isDecrypted stable.nixpkgs system) then ./hosts/materusPC-private.nix else {} ) - ./common.nix - - ]; - }; + in + { +# ** materusPC + "materusPC" = mkSystem "materusPC" { }; # * default.nix END - }; + }; }