0
0
Fork 0
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:
Bruno BELANYI 2025-02-13 22:23:25 +00:00 committed by GitHub
commit a10e1717e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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