biome: 1.9.2 -> 1.9.3
[NixPkgs.git] / pkgs / by-name / gi / github-desktop / package.nix
blob88f8b5620b45d3a1bb0ce8e747b663c4b156d485
1 { stdenvNoCC
2 , lib
3 , fetchurl
4 , autoPatchelfHook
5 , buildPackages
6 , gnome-keyring
7 , libsecret
8 , git
9 , curl
10 , nss
11 , nspr
12 , xorg
13 , libdrm
14 , alsa-lib
15 , cups
16 , mesa
17 , systemd
18 , openssl
19 , libglvnd
22 let
23   rcversion = "1";
25 stdenvNoCC.mkDerivation (finalAttrs: {
26   pname = "github-desktop";
27   version = "3.4.2";
29   src =
30     let
31       urls = {
32         "x86_64-linux" = {
33           url = "https://github.com/shiftkey/desktop/releases/download/release-${finalAttrs.version}-linux${rcversion}/GitHubDesktop-linux-amd64-${finalAttrs.version}-linux${rcversion}.deb";
34           hash = "sha256-qY5rCvOgf1/Z00XZ6yAn6zKdUZ+6l4PCthPU44XLKhc=";
35         };
36         "aarch64-linux" = {
37           url = "https://github.com/shiftkey/desktop/releases/download/release-${finalAttrs.version}-linux${rcversion}/GitHubDesktop-linux-arm64-${finalAttrs.version}-linux${rcversion}.deb";
38           hash = "sha256-VbPjTz4xYGaVO3uOG6lQNQrVEmx3+H/+y8+r0O55aUg=";
39         };
40       };
41     in
42     fetchurl urls."${stdenvNoCC.hostPlatform.system}" or (throw "Unsupported system: ${stdenvNoCC.hostPlatform.system}");
44   nativeBuildInputs = [
45     autoPatchelfHook
46     # override doesn't preserve splicing https://github.com/NixOS/nixpkgs/issues/132651
47     # Has to use `makeShellWrapper` from `buildPackages` even though `makeShellWrapper` from the inputs is spliced because `propagatedBuildInputs` would pick the wrong one because of a different offset.
48     (buildPackages.wrapGAppsHook3.override { makeWrapper = buildPackages.makeShellWrapper; })
49   ];
51   buildInputs = [
52     gnome-keyring
53     xorg.libXdamage
54     xorg.libX11
55     libsecret
56     git
57     curl
58     nss
59     nspr
60     libdrm
61     alsa-lib
62     cups
63     mesa
64     openssl
65   ];
67   unpackPhase = ''
68     runHook preUnpack
69     mkdir -p $TMP/github-desktop $out/{opt,bin}
70     cp $src $TMP/github-desktop.deb
71     ar vx github-desktop.deb
72     tar --no-overwrite-dir -xvf data.tar.xz -C $TMP/github-desktop/
73     runHook postUnpack
74   '';
76   installPhase = ''
77     runHook preInstall
78     cp -R $TMP/github-desktop/usr/share $out/
79     cp -R $TMP/github-desktop/usr/lib/github-desktop/* $out/opt/
80     ln -sf $out/opt/github-desktop $out/bin/github-desktop
81     runHook postInstall
82   '';
84   preFixup = ''
85     gappsWrapperArgs+=(
86       --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform=wayland}}"
87       --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libglvnd ]}
88     )
89   '';
91   runtimeDependencies = [
92     (lib.getLib systemd)
93   ];
95   meta = {
96     description = "GUI for managing Git and GitHub";
97     homepage = "https://desktop.github.com/";
98     license = lib.licenses.mit;
99     mainProgram = "github-desktop";
100     maintainers = with lib.maintainers; [ dan4ik605743 ];
101     platforms = lib.platforms.linux;
102     sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
103   };