nixos/systemd: conditionally leave out some upstream units

Some upstream systemd units are conditionally installed into the systemd
output, so we must make sure the feature that enables their installation
is enabled on our side prior to trying to use them.
This commit is contained in:
Jared Baur
2025-03-19 08:14:48 -07:00
parent 561f1f7a6e
commit dad880d6bf
2 changed files with 8 additions and 6 deletions

View File

@@ -104,7 +104,7 @@ let
"sleep.target" "sleep.target"
"hybrid-sleep.target" "hybrid-sleep.target"
"systemd-hibernate.service" "systemd-hibernate.service"
"systemd-hibernate-clear.service" ] ++ (lib.optional cfg.package.withEfi "systemd-hibernate-clear.service") ++ [
"systemd-hybrid-sleep.service" "systemd-hybrid-sleep.service"
"systemd-suspend.service" "systemd-suspend.service"
"systemd-suspend-then-hibernate.service" "systemd-suspend-then-hibernate.service"
@@ -130,11 +130,13 @@ let
"systemd-ask-password-wall.service" "systemd-ask-password-wall.service"
# Varlink APIs # Varlink APIs
] ++ lib.optionals cfg.package.withBootloader [
"systemd-bootctl@.service" "systemd-bootctl@.service"
"systemd-bootctl.socket" "systemd-bootctl.socket"
] ++ [
"systemd-creds@.service" "systemd-creds@.service"
"systemd-creds.socket" "systemd-creds.socket"
] ++ lib.optional cfg.package.withTpm2Tss [ ] ++ lib.optional cfg.package.withTpm2Units [
"systemd-pcrlock@.service" "systemd-pcrlock@.service"
"systemd-pcrlock.socket" "systemd-pcrlock.socket"
] ++ [ ] ++ [

View File

@@ -27,13 +27,13 @@
options = { options = {
systemd.tpm2.enable = lib.mkEnableOption "systemd TPM2 support" // { systemd.tpm2.enable = lib.mkEnableOption "systemd TPM2 support" // {
default = config.systemd.package.withTpm2Tss; default = config.systemd.package.withTpm2Units;
defaultText = "systemd.package.withTpm2Tss"; defaultText = "systemd.package.withTpm2Units";
}; };
boot.initrd.systemd.tpm2.enable = lib.mkEnableOption "systemd initrd TPM2 support" // { boot.initrd.systemd.tpm2.enable = lib.mkEnableOption "systemd initrd TPM2 support" // {
default = config.boot.initrd.systemd.package.withTpm2Tss; default = config.boot.initrd.systemd.package.withTpm2Units;
defaultText = "boot.initrd.systemd.package.withTpm2Tss"; defaultText = "boot.initrd.systemd.package.withTpm2Units";
}; };
}; };