wrapped download with secrets
This commit is contained in:
@@ -13,11 +13,24 @@
|
|||||||
config =
|
config =
|
||||||
let
|
let
|
||||||
inherit (inputs.jawz-scripts.packages.x86_64-linux) download;
|
inherit (inputs.jawz-scripts.packages.x86_64-linux) download;
|
||||||
|
gallerySecretsPath = lib.attrByPath [ "sops" "secrets" "gallery-dl/secrets" "path" ] null config;
|
||||||
|
wrappedDownload =
|
||||||
|
if gallerySecretsPath != null then
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "download-with-secrets";
|
||||||
|
paths = [ download ];
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/download --run 'if [ -r "${gallerySecretsPath}" ]; then set -a; source "${gallerySecretsPath}"; set +a; fi'
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
download;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
home-manager.users.jawz.programs.${config.my.shell.type} = {
|
home-manager.users.jawz.programs.${config.my.shell.type} = {
|
||||||
shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
|
shellAliases = inputs.self.lib.mergeAliases inputs.self.lib.commonAliases {
|
||||||
dl = "${download}/bin/download -u jawz -i";
|
dl = "${wrappedDownload}/bin/download -u jawz -i";
|
||||||
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
|
comic = ''dl "$(cat "$LC" | fzf --multi --exact -i)"'';
|
||||||
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
|
gallery = ''dl "$(cat "$LW" | fzf --multi --exact -i)"'';
|
||||||
};
|
};
|
||||||
@@ -43,15 +56,16 @@
|
|||||||
restartIfChanged = true;
|
restartIfChanged = true;
|
||||||
description = "Downloads ${desc}";
|
description = "Downloads ${desc}";
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
path = [
|
path = [ pkgs.bash ];
|
||||||
pkgs.bash
|
|
||||||
];
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
TimeoutStartSec = 2000;
|
TimeoutStartSec = 2000;
|
||||||
TimeoutStopSec = 2000;
|
TimeoutStopSec = 2000;
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = 30;
|
RestartSec = 30;
|
||||||
ExecStart = "${download}/bin/download ${execStartCmd}";
|
ExecStart = "${wrappedDownload}/bin/download ${execStartCmd}";
|
||||||
|
}
|
||||||
|
// lib.optionalAttrs (gallerySecretsPath != null) {
|
||||||
|
EnvironmentFile = gallerySecretsPath;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
@@ -108,7 +122,7 @@
|
|||||||
install = true;
|
install = true;
|
||||||
service = false;
|
service = false;
|
||||||
name = "download";
|
name = "download";
|
||||||
package = download;
|
package = wrappedDownload;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user