mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/autobrr: use systemd credentials (#381759)
This commit is contained in:
commit
a10e1717e2
1 changed files with 3 additions and 2 deletions
|
@ -9,7 +9,7 @@ let
|
|||
cfg = config.services.autobrr;
|
||||
configFormat = pkgs.formats.toml { };
|
||||
configTemplate = configFormat.generate "autobrr.toml" cfg.settings;
|
||||
templaterCmd = "${lib.getExe pkgs.dasel} put -f '${configTemplate}' -v $(cat ${cfg.secretFile}) -o %S/autobrr/config.toml 'sessionSecret'";
|
||||
templaterCmd = ''${lib.getExe pkgs.dasel} put -f '${configTemplate}' -v "$(${config.systemd.package}/bin/systemd-creds cat sessionSecret)" -o %S/autobrr/config.toml "sessionSecret"'';
|
||||
in
|
||||
{
|
||||
options = {
|
||||
|
@ -73,9 +73,10 @@ in
|
|||
serviceConfig = {
|
||||
Type = "simple";
|
||||
DynamicUser = true;
|
||||
LoadCredential = "sessionSecret:${cfg.secretFile}";
|
||||
StateDirectory = "autobrr";
|
||||
ExecStartPre = "${lib.getExe pkgs.bash} -c '${templaterCmd}'";
|
||||
ExecStart = "${lib.getExe pkgs.autobrr} --config %S/autobrr";
|
||||
ExecStart = "${lib.getExe cfg.package} --config %S/autobrr";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue