nixos/top-level.nix: Make extensible

(cherry picked from commit 4ec415cff9bcbaef08e0d900406a5c7181e71881)
This commit is contained in:
Robert Hensing 2021-12-05 11:33:43 +00:00
parent 36e7b7f085
commit d3ac0938a7

View file

@ -93,6 +93,8 @@ let
fi
''}
${config.system.systemBuilderCommands}
echo -n "${toString config.system.extraDependencies}" > $out/extra-dependencies
${config.system.extraSystemBuilderCmds}
@ -103,7 +105,7 @@ let
# kernel, systemd units, init scripts, etc.) as well as a script
# `switch-to-configuration' that activates the configuration and
# makes it bootable.
baseSystem = pkgs.stdenvNoCC.mkDerivation {
baseSystem = pkgs.stdenvNoCC.mkDerivation ({
name = "nixos-system-${config.system.name}-${config.system.nixos.label}";
preferLocalBuild = true;
allowSubstitutes = false;
@ -125,7 +127,7 @@ let
# Needed by switch-to-configuration.
perl = pkgs.perl.withPackages (p: with p; [ ConfigIniFiles FileSlurp ]);
};
} // config.system.systemBuilderArgs);
# Handle assertions and warnings
@ -276,6 +278,24 @@ in
'';
};
system.systemBuilderCommands = mkOption {
type = types.lines;
internal = true;
default = "";
description = ''
This code will be added to the builder creating the system store path.
'';
};
system.systemBuilderArgs = mkOption {
type = types.attrsOf types.unspecified;
internal = true;
default = {};
description = lib.mdDoc ''
`lib.mkDerivation` attributes that will be passed to the top level system builder.
'';
};
system.extraSystemBuilderCmds = mkOption {
type = types.lines;
internal = true;