Skip to content

Commit

Permalink
nixos/top-level.nix: Make extensible
Browse files Browse the repository at this point in the history
(cherry picked from commit 4ec415c)
  • Loading branch information
roberth authored and rtimush committed Sep 21, 2023
1 parent f947dca commit a5d6315
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions nixos/modules/system/activation/top-level.nix
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ let
fi
''}
${config.system.systemBuilderCommands}
echo -n "${toString config.system.extraDependencies}" > $out/extra-dependencies
${config.system.extraSystemBuilderCmds}
Expand All @@ -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;
Expand All @@ -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

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a5d6315

Please sign in to comment.