diff --git a/modules/scripts/download.nix b/modules/scripts/download.nix index 57a8d7d..1eb1a20 100644 --- a/modules/scripts/download.nix +++ b/modules/scripts/download.nix @@ -1,7 +1,21 @@ { pkgs, lib, config, ... }: { imports = [ ./base.nix ]; options.my.units.download.enable = lib.mkEnableOption "enable"; - config = { + config = let + download = pkgs.python3Packages.buildPythonApplication { + pname = "download"; + version = "2.5"; + src = ../../scripts/download/.; + buildInputs = [ pkgs.python3Packages.setuptools ]; + propagatedBuildInputs = with pkgs; [ + python3Packages.pyyaml + python3Packages.types-pyyaml + yt-dlp + gallery-dl + ffmpeg + ]; + }; + in { home-manager.users.jawz = { xdg.configFile."gallery-dl/config.json".source = ../../dotfiles/gallery-dl/config.json; @@ -27,23 +41,20 @@ restartIfChanged = true; description = "Downloads ${desc}"; wantedBy = [ "default.target" ]; - path = [ pkgs.bash ]; + path = [ pkgs.bash download ]; serviceConfig = { Restart = "on-failure"; RestartSec = 30; - ExecStart = execStartCmd; + ExecStart = "${download}/bin/download ${execStartCmd}"; }; }; in { tuhmayto = mkDownloadService "tuhmayto stuff" '' - /etc/profiles/per-user/jawz/bin/download \ - -u jawz -i https://twitter.com/tuhmayto/media \ - https://www.furaffinity.net/user/tuhmayto/''; - "download@" = mkDownloadService "post from multiple sources" - "/etc/profiles/per-user/jawz/bin/download %I"; - "instagram@" = mkDownloadService "post types from instagram" '' - /etc/profiles/per-user/jawz/bin/download \ - instagram -u jawz -t %I''; + -u jawz -i https://x.com/tuhmayto/media \ + https://www.furaffinity.net/user/tuhmayto/''; + "download@" = mkDownloadService "post from multiple sources" "%I"; + "instagram@" = mkDownloadService "post types from instagram" + "instagram -u jawz -t %I"; }; timers = let downloadTimer = time: delay: { @@ -76,18 +87,7 @@ install = true; service = false; name = "download"; - package = pkgs.python3Packages.buildPythonApplication { - pname = "download"; - version = "2.5"; - src = ../../scripts/download/.; - buildInputs = - [ pkgs.python3Packages.setuptools pkgs.gallery-dl pkgs.ffmpeg ]; - propagatedBuildInputs = with pkgs.python3Packages; [ - pyyaml - types-pyyaml - yt-dlp - ]; - }; + package = download; }; }; }