diff options
author | linj <linj.dev@outlook.com> | 2022-03-14 18:13:57 +0800 |
---|---|---|
committer | Cole Helbling <cole.e.helbling@outlook.com> | 2022-03-26 12:54:45 -0700 |
commit | 1e32d28824ccdaf171f8044478bbb5ad8f042aaa (patch) | |
tree | 0be30fc135e7df16f9061a6b2df2a596a4cd1a48 /nixos/modules | |
parent | 31747079c1af384b099f4fd7149252b9d201da80 (diff) | |
download | nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar.gz nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar.bz2 nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar.lz nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar.xz nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.tar.zst nixlib-1e32d28824ccdaf171f8044478bbb5ad8f042aaa.zip |
nixos/dendrite: always substitute environment variables in config
Before this patch, services.dendrite.environmentFile is used for secrets and environment variable substitution only happens when this option is used. systemd-247 provides a mechanism called LoadCredential for secrets and it is better than environment file. See the section of Environment= in the manual of systemd.exec for more information. This patch always substitute environment variables, which enables the usage of systemd LoadCredential.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/misc/dendrite.nix | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/nixos/modules/services/misc/dendrite.nix b/nixos/modules/services/misc/dendrite.nix index b2885b094153..89bb989a09ec 100644 --- a/nixos/modules/services/misc/dendrite.nix +++ b/nixos/modules/services/misc/dendrite.nix @@ -248,14 +248,11 @@ in RuntimeDirectory = "dendrite"; RuntimeDirectoryMode = "0700"; EnvironmentFile = lib.mkIf (cfg.environmentFile != null) cfg.environmentFile; - ExecStartPre = - if (cfg.environmentFile != null) then '' - ${pkgs.envsubst}/bin/envsubst \ - -i ${configurationYaml} \ - -o /run/dendrite/dendrite.yaml - '' else '' - ${pkgs.coreutils}/bin/cp ${configurationYaml} /run/dendrite/dendrite.yaml - ''; + ExecStartPre = '' + ${pkgs.envsubst}/bin/envsubst \ + -i ${configurationYaml} \ + -o /run/dendrite/dendrite.yaml + ''; ExecStart = lib.strings.concatStringsSep " " ([ "${pkgs.dendrite}/bin/dendrite-monolith-server" "--config /run/dendrite/dendrite.yaml" |