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";
}
];
@ -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;

View File

@ -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
};
};
}