From ca9e1f520afb967551f7c1ba5e79e00cfb501bd5 Mon Sep 17 00:00:00 2001 From: materus Date: Sun, 18 May 2025 10:05:47 +0200 Subject: [PATCH] Update --- nix/.#common.nix | 1 + nix/common.nix | 4 ++-- nix/default.nix | 21 +++++++++++++++++++-- nix/hosts/materusPC.nix | 1 - 4 files changed, 22 insertions(+), 5 deletions(-) create mode 120000 nix/.#common.nix diff --git a/nix/.#common.nix b/nix/.#common.nix new file mode 120000 index 0000000..8a1b31e --- /dev/null +++ b/nix/.#common.nix @@ -0,0 +1 @@ +materus@materusPC.1079801:1747170257 \ No newline at end of file diff --git a/nix/common.nix b/nix/common.nix index 5275e6d..b3c4b25 100644 --- a/nix/common.nix +++ b/nix/common.nix @@ -180,7 +180,7 @@ } { - assertion = config.konfig.decrypted; + assertion = config.mkk.isDecrypted; message = "Need to decrypt MKK repo to build"; } ]; @@ -205,9 +205,9 @@ in { options.konfig = lib.mkOption { default = { }; }; + options.mkk.isDecrypted = lib.mkOption { default = decryptedBool; }; config = { konfig = { - decrypted = decryptedBool; unstable = mkkArg.unstable; stable = mkkArg.stable; current = mkkArg.current; diff --git a/nix/default.nix b/nix/default.nix index 266e4b0..8e94ede 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,6 +1,21 @@ # * Outputs - default.nix { inputs, configRootPath }: let + isDecrypted = + npkgs: system: + let + file = ../private/check-encryption; + resultFile = npkgs.legacyPackages."${system}".runCommandLocal "check-encryption" { src = file; } '' + if [[ "$(< $src)" != "DECRYPTED" ]]; then + echo -n "no" >> $out; + else + echo -n "yes" >> $out; + fi + ''; + in + (builtins.readFile resultFile == "yes"); + + stable = inputs.config-stable; unstable = inputs.config-unstable; nixpkgs = stable.nixpkgs; @@ -16,12 +31,14 @@ in nixosConfigurations = { # ** materusPC - "materusPC" = nixpkgs.lib.nixosSystem { + "materusPC" = nixpkgs.lib.nixosSystem rec { system = "x86_64-linux"; specialArgs = { mkkArg = mkkArg // {current = stable;}; }; modules = [ - ./common.nix ./hosts/materusPC.nix + (if (isDecrypted stable.nixpkgs system) then ./hosts/materusPC-private.nix else {} ) + ./common.nix + ]; }; # * default.nix END diff --git a/nix/hosts/materusPC.nix b/nix/hosts/materusPC.nix index c779c24..2c3437e 100644 --- a/nix/hosts/materusPC.nix +++ b/nix/hosts/materusPC.nix @@ -8,7 +8,6 @@ }: { imports = [ - ./materusPC-private.nix # * CONFIG # ** Nix System Settings {