@@ -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";