Merge pull request #97371 from WilliButz/bitwarden_rs/environment-file

nixos/bitwarden_rs: add environmentFile option
This commit is contained in:
Maximilian Bosch 2020-09-08 20:25:28 +02:00 committed by GitHub
commit 40f7a4ecec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 1 deletions

View File

@ -81,6 +81,23 @@ in {
<link xlink:href="https://github.com/dani-garcia/bitwarden_rs/blob/${bitwarden_rs.version}/.env.template">the environment template file</link>.
'';
};
environmentFile = mkOption {
type = with types; nullOr path;
default = null;
example = "/root/bitwarden_rs.env";
description = ''
Additional environment file as defined in <citerefentry>
<refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>.
Secrets like <envar>ADMIN_TOKEN</envar> and <envar>SMTP_PASSWORD</envar>
may be passed to the service without adding them to the world-readable Nix store.
Note that this file needs to be available on the host on which
<literal>bitwarden_rs</literal> is running.
'';
};
};
config = mkIf cfg.enable {
@ -101,7 +118,7 @@ in {
serviceConfig = {
User = user;
Group = group;
EnvironmentFile = configFile;
EnvironmentFile = [ configFile ] ++ optional (cfg.environmentFile != null) cfg.environmentFile;
ExecStart = "${bitwarden_rs}/bin/bitwarden_rs";
LimitNOFILE = "1048576";
LimitNPROC = "64";