|
29 | 29 | # Currently, all templates are "regular" (there's no support for `neededForUsers` for templates.) |
30 | 30 | regularTemplates = cfg.templates; |
31 | 31 |
|
| 32 | + useSystemdActivation = |
| 33 | + (options.systemd ? sysusers && config.systemd.sysusers.enable) |
| 34 | + || (options.services ? userborn && config.services.userborn.enable); |
| 35 | + |
32 | 36 | withEnvironment = import ./with-environment.nix { |
33 | 37 | # sops >=3.10.0 now unconditionally searches |
34 | 38 | # for an SSH key in $HOME/.ssh/, introduced in #1692 [0]. Since in the |
|
315 | 319 | ''; |
316 | 320 | }; |
317 | 321 |
|
318 | | - useSystemdActivation = lib.mkOption { |
319 | | - type = lib.types.bool; |
320 | | - default = |
321 | | - (options.systemd ? sysusers && config.systemd.sysusers.enable) |
322 | | - || (options.services ? userborn && config.services.userborn.enable); |
323 | | - description = '' |
324 | | - Use a systemd unit to install secrets, instead of deploying them using an activation script. |
325 | | -
|
326 | | - This option is automatically enabled when systemd-sysusers or userborn are used to manage users and groups. |
327 | | - It can also be useful to specify additional dependencies to be satisfied before secrets are installed, such as required mountpoints for SOPS key files. |
328 | | - ''; |
329 | | - }; |
330 | | - |
331 | 322 | age = { |
332 | 323 | keyFile = lib.mkOption { |
333 | 324 | type = lib.types.nullOr pathNotInStore; |
|
442 | 433 | ); |
443 | 434 |
|
444 | 435 | # When using sysusers we no longer are started as an activation script because those are started in initrd while sysusers is started later. |
445 | | - systemd.services.sops-install-secrets = lib.mkIf (regularSecrets != { } && cfg.useSystemdActivation) { |
| 436 | + systemd.services.sops-install-secrets = lib.mkIf (regularSecrets != { } && useSystemdActivation) { |
446 | 437 | wantedBy = [ "sysinit.target" ]; |
447 | 438 | after = [ "systemd-sysusers.service" ]; |
448 | 439 | environment = cfg.environment; |
|
456 | 447 | }; |
457 | 448 |
|
458 | 449 | system.activationScripts = { |
459 | | - setupSecrets = lib.mkIf (regularSecrets != { } && !cfg.useSystemdActivation) ( |
| 450 | + setupSecrets = lib.mkIf (regularSecrets != { } && !useSystemdActivation) ( |
460 | 451 | lib.stringAfter |
461 | 452 | ( |
462 | 453 | [ |
|
0 commit comments