|
| 1 | +{ |
| 2 | + stdenvNoCC, |
| 3 | + lib, |
| 4 | + fetchurl, |
| 5 | + autoPatchelfHook, |
| 6 | + buildPackages, |
| 7 | + gnome-keyring, |
| 8 | + libsecret, |
| 9 | + git, |
| 10 | + curlWithGnuTls, |
| 11 | + nss, |
| 12 | + nspr, |
| 13 | + xorg, |
| 14 | + libdrm, |
| 15 | + alsa-lib, |
| 16 | + cups, |
| 17 | + libgbm, |
| 18 | + systemdLibs, |
| 19 | + openssl, |
| 20 | + libglvnd, |
| 21 | + zstd, |
| 22 | +}: let |
| 23 | + pkgver = "3.5.4"; |
| 24 | +in |
| 25 | + stdenvNoCC.mkDerivation (finalAttrs: { |
| 26 | + pname = "github-desktop-plus"; |
| 27 | + version = pkgver; |
| 28 | + |
| 29 | + src = let |
| 30 | + urls = { |
| 31 | + "x86_64-linux" = { |
| 32 | + url = "https://github.com/pol-rivero/github-desktop-plus/releases/download/v${pkgver}/GitHubDesktopPlus-v${pkgver}-linux-x86_64.deb"; |
| 33 | + sha256 = "eef5a02a1fc82e9eeea1069aadab1898e36bcf3cc00320541fdb900a33f56e67"; |
| 34 | + }; |
| 35 | + "aarch64-linux" = { |
| 36 | + url = "https://github.com/pol-rivero/github-desktop-plus/releases/download/v${pkgver}/GitHubDesktopPlus-v${pkgver}-linux-arm64.deb"; |
| 37 | + sha256 = "d77809dfa8abb41497a7eb1fbed9c1e5850b08cf0bcbe5e63d6b736154892a08"; |
| 38 | + }; |
| 39 | + "armv7l-linux" = { |
| 40 | + url = "https://github.com/pol-rivero/github-desktop-plus/releases/download/v${pkgver}/GitHubDesktopPlus-v${pkgver}-linux-armhf.deb"; |
| 41 | + sha256 = "6370ebeb31b4285f3eb095b12f3076c726f6b81ec6d08224d94176086c333233"; |
| 42 | + }; |
| 43 | + }; |
| 44 | + in |
| 45 | + fetchurl |
| 46 | + urls."${stdenvNoCC.hostPlatform.system}" |
| 47 | + or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}"); |
| 48 | + |
| 49 | + nativeBuildInputs = [ |
| 50 | + autoPatchelfHook |
| 51 | + zstd |
| 52 | + (buildPackages.wrapGAppsHook3.override {makeWrapper = buildPackages.makeShellWrapper;}) |
| 53 | + ]; |
| 54 | + |
| 55 | + buildInputs = [ |
| 56 | + gnome-keyring |
| 57 | + xorg.libXdamage |
| 58 | + xorg.libX11 |
| 59 | + xorg.libXScrnSaver |
| 60 | + libsecret |
| 61 | + git |
| 62 | + curlWithGnuTls |
| 63 | + nss |
| 64 | + nspr |
| 65 | + libdrm |
| 66 | + alsa-lib |
| 67 | + cups |
| 68 | + libgbm |
| 69 | + openssl |
| 70 | + ]; |
| 71 | + |
| 72 | + unpackPhase = '' |
| 73 | + runHook preUnpack |
| 74 | + mkdir -p $TMP/github-desktop-plus |
| 75 | + cp $src $TMP/github-desktop-plus.deb |
| 76 | + cd $TMP/github-desktop-plus |
| 77 | + ar x ../github-desktop-plus.deb |
| 78 | + tar --no-same-owner --no-same-permissions -xf data.tar.* || true |
| 79 | + runHook postUnpack |
| 80 | + ''; |
| 81 | + |
| 82 | + installPhase = '' |
| 83 | + runHook preInstall |
| 84 | + mkdir -p $out/{opt,bin,share} |
| 85 | + cp -R usr/share $out/ |
| 86 | + mkdir -p $out/opt/github-desktop-plus |
| 87 | + cp -R usr/lib/github-desktop-plus/* $out/opt/github-desktop-plus/ |
| 88 | + ln -s $out/opt/github-desktop-plus/github-desktop-plus $out/bin/github-desktop-plus |
| 89 | + ln -s $out/opt/github-desktop-plus/resources/app/static/github $out/bin/github-desktop-plus-cli |
| 90 | + runHook postInstall |
| 91 | + ''; |
| 92 | + |
| 93 | + preFixup = '' |
| 94 | + gappsWrapperArgs+=( |
| 95 | + --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland --enable-wayland-ime=true}}" |
| 96 | + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libglvnd]} |
| 97 | + ) |
| 98 | + ''; |
| 99 | + |
| 100 | + runtimeDependencies = [ |
| 101 | + systemdLibs |
| 102 | + ]; |
| 103 | + |
| 104 | + meta = with lib; { |
| 105 | + description = "Fork of GitHub Desktop with extra features and improvements"; |
| 106 | + homepage = "https://github.com/pol-rivero/github-desktop-plus"; |
| 107 | + license = licenses.mit; |
| 108 | + mainProgram = "github-desktop-plus"; |
| 109 | + platforms = platforms.linux; |
| 110 | + sourceProvenance = with sourceTypes; [binaryNativeCode]; |
| 111 | + }; |
| 112 | + }) |
0 commit comments