8 meta.maintainers = [ lib.maintainers.elvishjerricco ];
11 (lib.mkRenamedOptionModule
29 systemd.tpm2.enable = lib.mkEnableOption "systemd TPM2 support" // {
30 default = config.systemd.package.withTpm2Tss;
31 defaultText = "systemd.package.withTpm2Tss";
34 boot.initrd.systemd.tpm2.enable = lib.mkEnableOption "systemd initrd TPM2 support" // {
35 default = config.boot.initrd.systemd.package.withTpm2Tss;
36 defaultText = "boot.initrd.systemd.package.withTpm2Tss";
40 # TODO: pcrphase, pcrextend, pcrfs, pcrmachine
41 config = lib.mkMerge [
47 lib.mkIf cfg.tpm2.enable {
48 systemd.additionalUpstreamSystemUnits = [
50 "systemd-tpm2-setup-early.service"
51 "systemd-tpm2-setup.service"
59 cfg = config.boot.initrd.systemd;
61 lib.mkIf (cfg.enable && cfg.tpm2.enable) {
62 boot.initrd.systemd.additionalUpstreamUnits = [
64 "systemd-tpm2-setup-early.service"
67 boot.initrd.availableKernelModules =
70 !(pkgs.stdenv.hostPlatform.isRiscV64 || pkgs.stdenv.hostPlatform.isArmv7)
72 boot.initrd.systemd.storePaths = [
74 "${cfg.package}/lib/systemd/systemd-tpm2-setup"
75 "${cfg.package}/lib/systemd/system-generators/systemd-tpm2-generator"