about summary refs log tree commit diff
path: root/pkgs/applications/version-management/radicle-upstream
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2022-12-19 08:46:57 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2022-12-19 15:05:22 -0300
commitd994dabacef6a7e13a41d144cd6d800f8e21a11f (patch)
tree04bf3d99d27800b95686feef4000e7794e2df375 /pkgs/applications/version-management/radicle-upstream
parentb10a520017ac319c1e57b07742efd2bcc918d160 (diff)
treewide: remove git-and-tools directory
We do not use a "plugin system" for Git addons anymore, and therefore this
directory is no longer useful. Indeed that directory is way more confusing,
given that it includes more than mere Git addons, going from Bitbucket server
command-line tools to complete rewrites of Git in exotic programming languages.

Also, without this directory, the mental load of decision-making reduces a lot.
When anyone is interested in including a new git-related tool, just put it into
pkgs/applications/version-management, without apologies.
Diffstat (limited to 'pkgs/applications/version-management/radicle-upstream')
-rw-r--r--pkgs/applications/version-management/radicle-upstream/default.nix83
1 files changed, 83 insertions, 0 deletions
diff --git a/pkgs/applications/version-management/radicle-upstream/default.nix b/pkgs/applications/version-management/radicle-upstream/default.nix
new file mode 100644
index 0000000000000..c88d0b9d38666
--- /dev/null
+++ b/pkgs/applications/version-management/radicle-upstream/default.nix
@@ -0,0 +1,83 @@
+{ lib, stdenv, appimageTools, autoPatchelfHook, zlib, fetchurl, undmg }:
+
+let
+  pname = "radicle-upstream";
+  version = "0.3.0";
+  name = "${pname}-${version}";
+
+  srcs = {
+    x86_64-linux = fetchurl {
+      url = "https://releases.radicle.xyz/radicle-upstream-${version}.AppImage";
+      sha256 = "sha256-Y7V89G+nXRtknOukvBN8Q+sNx91YNPDT0p5hrFYe/Sk=";
+    };
+    x86_64-darwin = fetchurl {
+      url = "https://releases.radicle.xyz/radicle-upstream-${version}.dmg";
+      sha256 = "sha256-EuWGbn6qggi8/9Rci8iaXfuVKE+QXb1BHEYDvotR/q4=";
+    };
+  };
+  src = srcs.${stdenv.hostPlatform.system};
+
+  contents = appimageTools.extract { inherit name src; };
+
+  git-remote-rad = stdenv.mkDerivation rec {
+    pname = "git-remote-rad";
+    inherit version;
+    src = contents;
+
+    nativeBuildInputs = [ autoPatchelfHook ];
+    buildInputs = [ zlib ];
+
+    installPhase = ''
+      mkdir -p $out/bin/
+      cp ${contents}/resources/git-remote-rad $out/bin/git-remote-rad
+    '';
+  };
+
+  # 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;
+
+    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}'
+
+      # icon
+      install -m 444 -D ${contents}/${pname}.png \
+        $out/share/icons/hicolor/512x512/apps/${pname}.png
+    '';
+  };
+
+  darwin = stdenv.mkDerivation {
+    inherit pname version src meta;
+
+    nativeBuildInputs = [ undmg ];
+
+    sourceRoot = ".";
+
+    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" "x86_64-darwin" ];
+  };
+in
+if stdenv.isDarwin
+then darwin
+else linux