mirror of
https://github.com/nix-community/disko.git
synced 2026-12-01 13:33:28 +01:00
luks: don't define boot.initrd.systemd.enable where the option was removed
NixOS 26.11 dropped scripted stage 1 (NixOS/nixpkgs#573038) and replaced boot.initrd.systemd.enable with mkRemovedOptionModule, whose assertion fails as soon as the option is defined. The luks type set it for enrollFido2, so FIDO2 configs stopped evaluating (#1303). The old mkIf would also break once the removal shim is dropped, because mkIf cannot define an option that is not declared at all. Emit the definition via lib.optional only when diskoLib.systemdInitrdToggleable says the option still has its bool type. The removed-option stub is untyped; renamed or hidden declarations keep bool, so unlike checking `visible` this does not misfire on aliases. Where the option is gone, stage 1 is always systemd, so nothing needs to be set. The flag reaches the types through globals.canToggleSystemdInitrd: - module.nix derives it from the system's options; - default.nix accepts canToggleSystemdInitrd (default true, the pre-26.11 behaviour) for direct callers of the legacy outputs; - the test harness probes the nixpkgs under test for direct mode. The test harness itself read config.boot.initrd.systemd.enable, which throws on 26.11; guard it as done in lib/tests.nix of https://github.com/nix-community/disko/pull/1304/changes#diff-605c7b66854ad3072529f715252655bb5b4e5e5b53a99edec9dc929fd85162cd
This commit is contained in:
1 parent
1f2be5db26
commit
f15bcc27b4
5 files changed
+46
-11
No files matched your search
+18
-4
@@ -3,6 +3,7 @@
|
||||
makeTest,
|
||||
eval-config,
|
||||
qemu-common-lib,
|
||||
diskoLib,
|
||||
...
|
||||
}:
|
||||
|
||||
@@ -120,7 +121,16 @@ let
|
||||
# so /dev/vdb becomes /dev/vda etc.
|
||||
testConfigBooted = testLib.prepareDiskoConfig diskoConfigWithArgs testLib.devices;
|
||||
|
||||
tsp-generator = pkgs.callPackage ../. { checked = true; };
|
||||
# direct mode feeds tsp-config straight into NixOS, so probe the options of the nixpkgs under test
|
||||
tsp-generator = pkgs.callPackage ../. {
|
||||
checked = true;
|
||||
canToggleSystemdInitrd =
|
||||
diskoLib.systemdInitrdToggleable
|
||||
(eval-config {
|
||||
modules = [ ];
|
||||
system = pkgs.stdenv.hostPlatform.system;
|
||||
}).options;
|
||||
};
|
||||
tsp-format = (tsp-generator._cliFormat testConfigInstall) pkgs;
|
||||
tsp-mount = (tsp-generator._cliMount testConfigInstall) pkgs;
|
||||
tsp-unmount = (tsp-generator._cliUnmount testConfigInstall) pkgs;
|
||||
@@ -129,7 +139,11 @@ let
|
||||
num-disks = builtins.length (lib.attrNames testConfigBooted.disko.devices.disk);
|
||||
|
||||
installed-system =
|
||||
{ config, ... }:
|
||||
{ config, options, ... }:
|
||||
let
|
||||
# boot.initrd.systemd.enable throws once removed (NixOS 26.11+), where stage 1 is always systemd
|
||||
systemdInitrd = !diskoLib.systemdInitrdToggleable options || config.boot.initrd.systemd.enable;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(lib.optionalAttrs (testMode == "direct") tsp-config)
|
||||
@@ -146,10 +160,10 @@ let
|
||||
documentation.enable = false;
|
||||
hardware.enableAllFirmware = lib.mkForce false;
|
||||
# FIXME: we don't have an systemd in stage-1 equialvent for this
|
||||
boot.initrd.preDeviceCommands = lib.mkIf (!config.boot.initrd.systemd.enable) ''
|
||||
boot.initrd.preDeviceCommands = lib.mkIf (!systemdInitrd) ''
|
||||
echo -n 'secretsecret' > /tmp/secret.key
|
||||
'';
|
||||
boot.initrd.secrets = lib.mkIf config.boot.initrd.systemd.enable {
|
||||
boot.initrd.secrets = lib.mkIf systemdInitrd {
|
||||
"/tmp/secret.key" = pkgs.writeText "secret.key" "secretsecret";
|
||||
};
|
||||
boot.consoleLogLevel = lib.mkForce 100;
|
||||
|
||||
Reference in new issue
Block a user