summary refs log tree commit diff
diff options
context:
space:
mode:
authorNikolay Korotkiy <sikmir@gmail.com>2021-08-02 01:43:27 +0300
committerRaphael Megzari <raphael@megzari.com>2021-08-11 13:38:12 +0900
commit6b9dc66a14e3e9aaf927d8071388043e98a5aa9e (patch)
treef95677a4825effa6d5d8c81b301f117d9a3fa418
parente33cb80739db2f13e8db2fbf20772e5da2281253 (diff)
downloadnixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar.gz
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar.bz2
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar.lz
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar.xz
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.tar.zst
nixpkgs-6b9dc66a14e3e9aaf927d8071388043e98a5aa9e.zip
radicle-upstream: 0.2.3 → 0.2.9, enable on darwin
-rw-r--r--pkgs/applications/version-management/git-and-tools/radicle-upstream/default.nix83
1 files changed, 53 insertions, 30 deletions
diff --git a/pkgs/applications/version-management/git-and-tools/radicle-upstream/default.nix b/pkgs/applications/version-management/git-and-tools/radicle-upstream/default.nix
index e91192d53de..8774e69e48c 100644
--- a/pkgs/applications/version-management/git-and-tools/radicle-upstream/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/radicle-upstream/default.nix
@@ -1,16 +1,23 @@
-{ lib, stdenv, appimageTools, gsettings-desktop-schemas, gtk3, autoPatchelfHook, zlib, fetchurl }:
+{ lib, stdenv, appimageTools, gsettings-desktop-schemas, gtk3, autoPatchelfHook, zlib, fetchurl, undmg }:
 
 let
   pname = "radicle-upstream";
-  version = "0.2.3";
+  version = "0.2.9";
   name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "https://releases.radicle.xyz/radicle-upstream-${version}.AppImage";
-    sha256 =  "sha256-SL6plXZ+o7JchY/t/1702FK57fVjxllHqB8ZOma/43c=";
+  srcs = {
+    x86_64-linux = fetchurl {
+      url = "https://releases.radicle.xyz/radicle-upstream-${version}.AppImage";
+      sha256 = "sha256-chju3ZEFFLOzE9FakUK2izm/5ejELdL/iWMtM3bRpWY=";
+    };
+    x86_64-darwin = fetchurl {
+      url = "https://releases.radicle.xyz/radicle-upstream-${version}.dmg";
+      sha256 = "sha256-OOqe4diRcJWHHOa6jBpljPoA3FQOKlghMhKGQ242GnM=";
+    };
   };
+  src = srcs.${stdenv.hostPlatform.system};
 
-  contents = appimageTools.extractType2 { inherit name src; };
+  contents = appimageTools.extract { inherit name src; };
 
   git-remote-rad = stdenv.mkDerivation rec {
     pname = "git-remote-rad";
@@ -25,40 +32,56 @@ let
       cp ${contents}/resources/git-remote-rad $out/bin/git-remote-rad
     '';
   };
-in
 
-# FIXME: a dependency of the `proxy` component of radicle-upstream (radicle-macros
-# v0.1.0) uses unstable rust features, making a from source build impossible at
-# this time. See this PR for discussion: https://github.com/NixOS/nixpkgs/pull/105674
-appimageTools.wrapType2 {
-  inherit name src;
+  # FIXME: a dependency of the `proxy` component of radicle-upstream (radicle-macros
+  # v0.1.0) uses unstable rust features, making a from source build impossible at
+  # this time. See this PR for discussion: https://github.com/NixOS/nixpkgs/pull/105674
+  linux = appimageTools.wrapType2 {
+    inherit name src meta;
+
+    profile = ''
+      export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
+    '';
+
+    extraInstallCommands = ''
+      mv $out/bin/${name} $out/bin/${pname}
+
+      # this automatically adds the git-remote-rad binary to the users `PATH` so
+      # they don't need to mess around with shell profiles...
+      ln -s ${git-remote-rad}/bin/git-remote-rad $out/bin/git-remote-rad
+
+      # desktop item
+      install -m 444 -D ${contents}/${pname}.desktop $out/share/applications/${pname}.desktop
+      substituteInPlace $out/share/applications/${pname}.desktop \
+        --replace 'Exec=AppRun' 'Exec=${pname}'
 
-  profile = ''
-    export XDG_DATA_DIRS=${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}:${gtk3}/share/gsettings-schemas/${gtk3.name}:$XDG_DATA_DIRS
-  '';
+      # icon
+      install -m 444 -D ${contents}/${pname}.png \
+        $out/share/icons/hicolor/512x512/apps/${pname}.png
+    '';
+  };
 
-  extraInstallCommands = ''
-    mv $out/bin/${name} $out/bin/${pname}
+  darwin = stdenv.mkDerivation {
+    inherit pname version src meta;
 
-    # this automatically adds the git-remote-rad binary to the users `PATH` so
-    # they don't need to mess around with shell profiles...
-    ln -s ${git-remote-rad}/bin/git-remote-rad $out/bin/git-remote-rad
+    nativeBuildInputs = [ undmg ];
 
-    # desktop item
-    install -m 444 -D ${contents}/${pname}.desktop $out/share/applications/${pname}.desktop
-    substituteInPlace $out/share/applications/${pname}.desktop \
-      --replace 'Exec=AppRun' 'Exec=${pname}'
+    sourceRoot = ".";
 
-    # icon
-    install -m 444 -D ${contents}/${pname}.png \
-      $out/share/icons/hicolor/512x512/apps/${pname}.png
-  '';
+    installPhase = ''
+      mkdir -p $out/Applications
+      cp -r *.app $out/Applications
+    '';
+  };
 
   meta = with lib; {
     description = "A decentralized app for code collaboration";
     homepage = "https://radicle.xyz/";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ d-xo ];
-    platforms = [ "x86_64-linux" ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" ];
   };
-}
+in
+if stdenv.isDarwin
+then darwin
+else linux