14 pname = "ytDownloader";
17 src = fetchFromGitHub {
19 repo = "ytDownloader";
20 rev = "refs/tags/v${version}";
21 hash = "sha256-j6FeRqAeqXLofvI5R7nOwfg6wd17Xk85vryktGfnxyI=";
24 npmDepsHash = "sha256-LUlpyzHJDpjytZmMjjn899NKwvb80a0DXdMhVT2aRTY=";
37 name = "ytDownloader";
38 exec = "ytdownloader %U";
39 icon = "ytdownloader";
40 desktopName = "ytDownloader";
41 comment = "A modern GUI video and audio downloader";
42 categories = [ "Utility" ];
43 startupWMClass = "ytDownloader";
47 ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
51 # Patch config dir to ~/.config/ytdownloader
52 # Otherwise it stores config in ~/.config/Electron
53 patches = [ ./config-dir.patch ];
55 # Replace hardcoded ffmpeg and ytdlp paths
56 # Also stop it from downloading ytdlp
58 substituteInPlace src/renderer.js \
59 --replace-fail $\{__dirname}/../ffmpeg '${lib.getExe ffmpeg}' \
60 --replace-fail 'path.join(os.homedir(), ".ytDownloader", "ytdlp")' '`${lib.getExe yt-dlp}`' \
61 --replace-fail '!!localStorage.getItem("fullYtdlpBinPresent")' 'true'
62 # Disable auto-updates
63 substituteInPlace src/preferences.js \
64 --replace-warn 'const autoUpdateDisabled = getId("autoUpdateDisabled");' 'const autoUpdateDisabled = "true";'
68 makeWrapper ${electron}/bin/electron $out/bin/ytdownloader \
69 --add-flags $out/lib/node_modules/ytdownloader/main.js
71 install -Dm444 assets/images/icon.png $out/share/pixmaps/ytdownloader.png
75 description = "Modern GUI video and audio downloader";
76 homepage = "https://github.com/aandrew-me/ytDownloader";
77 license = lib.licenses.gpl3Only;
78 maintainers = with lib.maintainers; [ chewblacka ];
79 platforms = lib.platforms.all;
80 mainProgram = "ytdownloader";