module: always populate system.build attributes

This commit is contained in:
Michael Hoang 2024-09-18 18:04:54 +07:00
parent d32d1504c7
commit 706a1722f6

View file

@ -192,41 +192,36 @@ in
visible = "shallow"; visible = "shallow";
}; };
config = lib.mkMerge [ config = {
(lib.mkIf (cfg.devices.disk != { }) { _module.args.diskoLib = import ./lib {
system.build = (cfg.devices._scripts { inherit pkgs; checked = cfg.checkScripts; }) // { inherit lib;
rootMountPoint = config.disko.rootMountPoint;
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
};
# we keep these old outputs for compatibility system.build = (cfg.devices._scripts { inherit pkgs; checked = cfg.checkScripts; }) // {
disko = builtins.trace "the .disko output is deprecated, please use .diskoScript instead" (cfg.devices._scripts { inherit pkgs; }).diskoScript; # we keep these old outputs for compatibility
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead" (cfg.devices._scripts { inherit pkgs; }).diskoScriptNoDeps; disko = builtins.trace "the .disko output is deprecated, please use .diskoScript instead" (cfg.devices._scripts { inherit pkgs; }).diskoScript;
diskoNoDeps = builtins.trace "the .diskoNoDeps output is deprecated, please use .diskoScriptNoDeps instead" (cfg.devices._scripts { inherit pkgs; }).diskoScriptNoDeps;
installTest = diskoLib.testLib.makeDiskoTest { installTest = diskoLib.testLib.makeDiskoTest {
inherit extendModules pkgs; inherit extendModules pkgs;
name = "${config.networking.hostName}-disko"; name = "${config.networking.hostName}-disko";
disko-config = builtins.removeAttrs config [ "_module" ]; disko-config = builtins.removeAttrs config [ "_module" ];
testMode = "direct"; testMode = "direct";
efi = cfg.tests.efi; efi = cfg.tests.efi;
extraSystemConfig = cfg.tests.extraConfig; extraSystemConfig = cfg.tests.extraConfig;
extraTestScript = cfg.tests.extraChecks; extraTestScript = cfg.tests.extraChecks;
};
vmWithDisko = lib.mkDefault config.virtualisation.vmVariantWithDisko.system.build.vmWithDisko;
}; };
vmWithDisko = lib.mkDefault config.virtualisation.vmVariantWithDisko.system.build.vmWithDisko;
};
# we need to specify the keys here, so we don't get an infinite recursion error # we need to specify the keys here, so we don't get an infinite recursion error
# Remember to add config keys here if they are added to types # Remember to add config keys here if they are added to types
fileSystems = lib.mkIf cfg.enableConfig cfg.devices._config.fileSystems or { }; fileSystems = lib.mkIf cfg.enableConfig cfg.devices._config.fileSystems or { };
boot = lib.mkIf cfg.enableConfig cfg.devices._config.boot or { }; boot = lib.mkIf cfg.enableConfig cfg.devices._config.boot or { };
swapDevices = lib.mkIf cfg.enableConfig cfg.devices._config.swapDevices or [ ]; swapDevices = lib.mkIf cfg.enableConfig cfg.devices._config.swapDevices or [ ];
}) };
{
_module.args.diskoLib = import ./lib {
inherit lib;
rootMountPoint = config.disko.rootMountPoint;
makeTest = import (pkgs.path + "/nixos/tests/make-test-python.nix");
eval-config = import (pkgs.path + "/nixos/lib/eval-config.nix");
};
}
];
} }