diff options
Diffstat (limited to 'nixpkgs/pkgs/by-name/yt')
-rw-r--r-- | nixpkgs/pkgs/by-name/yt/yt-dlg/package.nix | 50 | ||||
-rw-r--r-- | nixpkgs/pkgs/by-name/yt/ytdownloader/config-dir.patch | 18 | ||||
-rw-r--r-- | nixpkgs/pkgs/by-name/yt/ytdownloader/package.nix | 70 |
3 files changed, 138 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/yt/yt-dlg/package.nix b/nixpkgs/pkgs/by-name/yt/yt-dlg/package.nix new file mode 100644 index 000000000000..c24df3604ddc --- /dev/null +++ b/nixpkgs/pkgs/by-name/yt/yt-dlg/package.nix @@ -0,0 +1,50 @@ +{ + lib, + python3, + fetchFromGitHub, + fetchPypi +}: +let + python3Packages = + (python3.override { + packageOverrides = final: prev: { + wxpython = prev.wxpython.overrideAttrs rec { + version = "4.2.0"; + src = fetchPypi { + pname = "wxPython"; + inherit version; + hash = "sha256-ZjzrxFCdfl0RNRiGX+J093+VQ0xdV7w4btWNZc7thsc="; + }; + }; + }; + }).pkgs; +in +python3Packages.buildPythonApplication rec { + pname = "yt-dlg"; + version = "1.8.5"; + + src = fetchFromGitHub { + owner = "oleksis"; + repo = "youtube-dl-gui"; + rev = "v${version}"; + hash = "sha256-W1ZlArmM+Ro5MF/rB88me/PD79dJA4v188mPbMd8Kow="; + }; + + pyproject = true; + build-system = with python3Packages; [ + setuptools + wheel + ]; + dependencies = with python3Packages; [ + pypubsub + wxpython + ]; + + meta = { + description = "A cross platform front-end GUI of the popular youtube-dl written in wxPython."; + homepage = "https://oleksis.github.io/youtube-dl-gui"; + license = lib.licenses.unlicense; + mainProgram = "yt-dlg"; + maintainers = with lib.maintainers; [ quantenzitrone ]; + }; +} diff --git a/nixpkgs/pkgs/by-name/yt/ytdownloader/config-dir.patch b/nixpkgs/pkgs/by-name/yt/ytdownloader/config-dir.patch new file mode 100644 index 000000000000..eb3684a24887 --- /dev/null +++ b/nixpkgs/pkgs/by-name/yt/ytdownloader/config-dir.patch @@ -0,0 +1,18 @@ +--- a/main.js ++++ b/main.js +@@ -13,6 +13,15 @@ + const fs = require("fs"); + const path = require("path"); + autoUpdater.autoDownload = false; ++ ++// Set the config directory to XDG_CONFIG_HOME/ytdownloader ++const xdgConfigHome = process.env.XDG_CONFIG_HOME; ++let configDir = app.getPath('home') + "/.config/ytdownloader"; ++if (xdgConfigHome) { ++ configDir = xdgConfigHome + "/ytdownloader"; ++} ++app.setPath ('userData', configDir); ++ + /**@type {BrowserWindow} */ + let win = null; + let secondaryWindow = null; diff --git a/nixpkgs/pkgs/by-name/yt/ytdownloader/package.nix b/nixpkgs/pkgs/by-name/yt/ytdownloader/package.nix new file mode 100644 index 000000000000..9a607c16e4aa --- /dev/null +++ b/nixpkgs/pkgs/by-name/yt/ytdownloader/package.nix @@ -0,0 +1,70 @@ +{ lib +, buildNpmPackage +, fetchFromGitHub +, makeWrapper +, ffmpeg +, yt-dlp +, makeDesktopItem +, electron +}: + +buildNpmPackage rec { + pname = "ytDownloader"; + version = "3.17.3"; + + src = fetchFromGitHub { + owner = "aandrew-me"; + repo = "ytDownloader"; + rev = "refs/tags/v${version}"; + hash = "sha256-aqQGOqPLKKTBjWjL3KyRD4paBGCQLhCBjXwVVhoHDSk="; + }; + + npmDepsHash = "sha256-lhFyiWy9dgnxxaElavzqA4YpRm7cVC23pvL5Kwve58E="; + + nativeBuildInputs = [ makeWrapper ]; + buildInputs = [ ffmpeg yt-dlp ]; + + desktopItem = makeDesktopItem { + name = "ytDownloader"; + exec = "ytdownloader %U"; + icon = "ytdownloader"; + desktopName = "ytDownloader"; + comment = "A modern GUI video and audio downloader"; + categories = [ "Utility" ]; + startupWMClass = "ytDownloader"; + }; + + ELECTRON_SKIP_BINARY_DOWNLOAD = "1"; + + dontNpmBuild = true; + + # Patch config dir to ~/.config/ytdownloader + # Otherwise it stores config in ~/.config/Electron + patches = [ ./config-dir.patch ]; + + # Replace hardcoded ffmpeg and ytdlp paths + # Also stop it from downloading ytdlp + postPatch = '' + substituteInPlace src/renderer.js \ + --replace-fail $\{__dirname}/../ffmpeg '${lib.getExe ffmpeg}' \ + --replace-fail 'path.join(os.homedir(), ".ytDownloader", "ytdlp")' '`${lib.getExe yt-dlp}`' \ + --replace-fail '!!localStorage.getItem("fullYtdlpBinPresent")' 'true' + ''; + + postInstall = '' + makeWrapper ${electron}/bin/electron $out/bin/ytdownloader \ + --add-flags $out/lib/node_modules/ytdownloader/main.js + + install -Dm444 assets/images/icon.png $out/share/pixmaps/ytdownloader.png + install -Dm444 "${desktopItem}/share/applications/"* -t $out/share/applications + ''; + + meta = { + description = "A modern GUI video and audio downloader"; + homepage = "https://github.com/aandrew-me/ytDownloader"; + license = lib.licenses.gpl3Only; + maintainers = with lib.maintainers; [ chewblacka ]; + platforms = lib.platforms.all; + mainProgram = "ytdownloader"; + }; +} |