This commit is contained in:
Mateusz Słodkowicz 2025-05-18 10:27:43 +02:00
parent ca9e1f520a
commit f4a22eb9a6
Signed by: materus
GPG Key ID: 28D140BCA60B4FD1
4 changed files with 53 additions and 31 deletions

View File

@ -1 +0,0 @@
materus@materusPC.1079801:1747170257

4
nix/common-os.nix Normal file
View File

@ -0,0 +1,4 @@
{...}:
{
}

View File

@ -180,7 +180,7 @@
} }
{ {
assertion = config.mkk.isDecrypted; assertion = mkkArg.isDecrypted;
message = "Need to decrypt MKK repo to build"; message = "Need to decrypt MKK repo to build";
} }
]; ];
@ -189,23 +189,11 @@
( (
let 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 in
{ {
options.konfig = lib.mkOption { default = { }; }; options.konfig = lib.mkOption { default = { }; };
options.mkk.isDecrypted = lib.mkOption { default = decryptedBool; };
config = { config = {
konfig = { konfig = {
unstable = mkkArg.unstable; unstable = mkkArg.unstable;

View File

@ -15,7 +15,6 @@ let
in in
(builtins.readFile resultFile == "yes"); (builtins.readFile resultFile == "yes");
stable = inputs.config-stable; stable = inputs.config-stable;
unstable = inputs.config-unstable; unstable = inputs.config-unstable;
nixpkgs = stable.nixpkgs; nixpkgs = stable.nixpkgs;
@ -28,19 +27,51 @@ let
in in
{ {
# * NixOS configurations # * NixOS configurations
nixosConfigurations = { nixosConfigurations =
# ** materusPC let
mkSystem =
"materusPC" = nixpkgs.lib.nixosSystem rec { hostname:
system = "x86_64-linux"; {
specialArgs = { mkkArg = mkkArg // {current = stable;}; }; system ? "x86_64-linux",
modules = [ isStable ? true,
./hosts/materusPC.nix extraArgs ? { },
(if (isDecrypted stable.nixpkgs system) then ./hosts/materusPC-private.nix else {} ) extraModules ? [ ],
./common.nix }:
(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;
};
in
{
# ** materusPC
"materusPC" = mkSystem "materusPC" { };
# * default.nix END # * default.nix END
}; };