mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-12 02:40:31 +08:00
nixos/autobrr: use systemd credentials (#381759)
This commit is contained in:
@@ -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";
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user