git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #97371 from WilliButz/bitwarden_rs/environment-file

nixos/bitwarden_rs: add environmentFile option

commit40f7a4ecec14f76f5c0b99be806f9efbc88a312a authorMaximilian Bosch <maximilian@mbosch.me> dateTue 8 Sep 2020, 20:25 (6 years ago) parent619998476362dd
1 file changed+18−1
nixos/modules/services/security/bitwarden_rs/default.nix+18−1
nixos/modules/services/security/bitwarden_rs/default.nix+18−1
@@ -81,6 +81,23 @@ in {
8181 <link xlink:href="https://github.com/dani-garcia/bitwarden_rs/blob/${bitwarden_rs.version}/.env.template">the environment template file</link>.
8282 '';
8383 };
84+
85+ environmentFile = mkOption {
86+ type = with types; nullOr path;
87+ default = null;
88+ example = "/root/bitwarden_rs.env";
89+ description = ''
90+ Additional environment file as defined in <citerefentry>
91+ <refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum>
92+ </citerefentry>.
93+
94+ Secrets like <envar>ADMIN_TOKEN</envar> and <envar>SMTP_PASSWORD</envar>
95+ may be passed to the service without adding them to the world-readable Nix store.
96+
97+ Note that this file needs to be available on the host on which
98+ <literal>bitwarden_rs</literal> is running.
99+ '';
100+ };
84101 };
85102
86103 config = mkIf cfg.enable {
@@ -101,7 +118,7 @@ in {
101118 serviceConfig = {
102119 User = user;
103120 Group = group;
104− EnvironmentFile = configFile;
121+ EnvironmentFile = [ configFile ] ++ optional (cfg.environmentFile != null) cfg.environmentFile;
105122 ExecStart = "${bitwarden_rs}/bin/bitwarden_rs";
106123 LimitNOFILE = "1048576";
107124 LimitNPROC = "64";