2021-08-01 23:43:27 +01:00
|
|
|
{ lib, stdenv, appimageTools, gsettings-desktop-schemas, gtk3, autoPatchelfHook, zlib, fetchurl, undmg }:
|
2020-12-02 09:15:03 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
pname = "radicle-upstream";
|
2021-12-16 21:48:49 +00:00
|
|
|
version = "0.2.12";
|
2020-12-02 09:15:03 +00:00
|
|
|
name = "${pname}-${version}";
|
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
srcs = {
|
|
|
|
x86_64-linux = fetchurl {
|
|
|
|
url = "https://releases.radicle.xyz/radicle-upstream-${version}.AppImage";
|
2021-12-16 21:48:49 +00:00
|
|
|
sha256 = "7520c7feb94234df6f8523689d098e0d19510e2ac0122e482d1e01086c9b02fe";
|
2021-08-01 23:43:27 +01:00
|
|
|
};
|
|
|
|
x86_64-darwin = fetchurl {
|
|
|
|
url = "https://releases.radicle.xyz/radicle-upstream-${version}.dmg";
|
2021-12-16 21:48:49 +00:00
|
|
|
sha256 = "8bbff051f169f029044e4c4965cad88f48e939b945fd5c253f0c39665a19ce44";
|
2021-08-01 23:43:27 +01:00
|
|
|
};
|
2020-12-02 09:15:03 +00:00
|
|
|
};
|
2021-08-01 23:43:27 +01:00
|
|
|
src = srcs.${stdenv.hostPlatform.system};
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
contents = appimageTools.extract { inherit name src; };
|
2020-12-02 09:15:03 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
# 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}'
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
# icon
|
|
|
|
install -m 444 -D ${contents}/${pname}.png \
|
|
|
|
$out/share/icons/hicolor/512x512/apps/${pname}.png
|
|
|
|
'';
|
|
|
|
};
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
darwin = stdenv.mkDerivation {
|
|
|
|
inherit pname version src meta;
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
nativeBuildInputs = [ undmg ];
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
sourceRoot = ".";
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-08-01 23:43:27 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/Applications
|
|
|
|
cp -r *.app $out/Applications
|
|
|
|
'';
|
|
|
|
};
|
2020-12-02 09:15:03 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-12-02 09:15:03 +00:00
|
|
|
description = "A decentralized app for code collaboration";
|
|
|
|
homepage = "https://radicle.xyz/";
|
|
|
|
license = licenses.gpl3Plus;
|
2021-08-08 18:11:45 +01:00
|
|
|
maintainers = with maintainers; [ d-xo ];
|
2021-08-01 23:43:27 +01:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2020-12-02 09:15:03 +00:00
|
|
|
};
|
2021-08-01 23:43:27 +01:00
|
|
|
in
|
|
|
|
if stdenv.isDarwin
|
|
|
|
then darwin
|
|
|
|
else linux
|