Files
NixOS/modules/scripts/download/common.nix
Danilo Reyes 1877ad159e
All checks were successful
MCP Tests / mcp-tests (push) Successful in 16s
gallery-dl fix
2026-03-31 22:19:55 -06:00

26 lines
614 B
Nix

{
config,
inputs,
lib,
pkgs,
}:
let
download = pkgs.download;
gallerySecretsPath = lib.attrByPath [ "sops" "secrets" "gallery-dl/secrets" "path" ] null config;
in
{
inherit gallerySecretsPath;
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;
}