nixos/systemd: conditionally leave out some upstream units (#374214)

This commit is contained in:
Will Fancher
2025-03-19 16:58:14 -04:00
committed by GitHub
3 changed files with 12 additions and 6 deletions
+4 -2
View File
@@ -104,7 +104,7 @@ let
"sleep.target"
"hybrid-sleep.target"
"systemd-hibernate.service"
"systemd-hibernate-clear.service"
] ++ (lib.optional cfg.package.withEfi "systemd-hibernate-clear.service") ++ [
"systemd-hybrid-sleep.service"
"systemd-suspend.service"
"systemd-suspend-then-hibernate.service"
@@ -130,11 +130,13 @@ let
"systemd-ask-password-wall.service"
# Varlink APIs
] ++ lib.optionals cfg.package.withBootloader [
"systemd-bootctl@.service"
"systemd-bootctl.socket"
] ++ [
"systemd-creds@.service"
"systemd-creds.socket"
] ++ lib.optional cfg.package.withTpm2Tss [
] ++ lib.optional cfg.package.withTpm2Units [
"systemd-pcrlock@.service"
"systemd-pcrlock.socket"
] ++ [
+4 -4
View File
@@ -27,13 +27,13 @@
options = {
systemd.tpm2.enable = lib.mkEnableOption "systemd TPM2 support" // {
default = config.systemd.package.withTpm2Tss;
defaultText = "systemd.package.withTpm2Tss";
default = config.systemd.package.withTpm2Units;
defaultText = "systemd.package.withTpm2Units";
};
boot.initrd.systemd.tpm2.enable = lib.mkEnableOption "systemd initrd TPM2 support" // {
default = config.boot.initrd.systemd.package.withTpm2Tss;
defaultText = "boot.initrd.systemd.package.withTpm2Tss";
default = config.boot.initrd.systemd.package.withTpm2Units;
defaultText = "boot.initrd.systemd.package.withTpm2Units";
};
};
@@ -892,6 +892,10 @@ stdenv.mkDerivation (finalAttrs: {
kbd
;
# Many TPM2-related units are only installed if this trio of features are
# enabled. See https://github.com/systemd/systemd/blob/876ee10e0eb4bbb0920bdab7817a9f06cc34910f/units/meson.build#L521
withTpm2Units = withTpm2Tss && withBootloader && withOpenSSL;
tests =
let
# Some entries in the `nixosTests.systemd-*` set of attributes are collections of tests,