radicle-bin: init at 0.2.0-unstable-2023-04-07

This commit is contained in:
Milan Hauth 2023-08-01 11:57:12 +02:00
parent 452b0e6830
commit 131a77ce26
5 changed files with 343 additions and 0 deletions

View File

@ -314,6 +314,8 @@ pkgs.lib.makeScope pkgs.newScope (self: let inherit (self) callPackage; in rec {
curl = curl-with-allow-dot-onion;
});
radicle-bin = callPackage ./pkgs/applications/version-management/radicle/radicle-bin.nix { };
}
# based on https://github.com/dtzWill/nur-packages

View File

@ -0,0 +1,135 @@
#!/bin/sh
#
# Radicle installation script.
#
set -e
url() {
echo "https://files.radicle.xyz/latest/$1/radicle-$1.tar.gz"
}
info() {
printf "\033[36m$*\033[0m\n"
}
success() {
printf "\033[32m✓\033[0m Radicle was installed successfully.\n"
printf "\n"
}
fatal() {
printf "\033[31merror\033[0m: $*\n" >&2
exit 1
}
target() {
TARGET=""
case "$(uname)/$(uname -m)" in
Darwin/arm64)
TARGET="aarch64-apple-darwin" ;;
Darwin/x86_64)
TARGET="x86_64-apple-darwin" ;;
Linux/arm64|Linux/aarch64)
TARGET="aarch64-unknown-linux-musl" ;;
Linux/x86_64)
TARGET="x86_64-unknown-linux-musl" ;;
*)
fatal "Your operating system is currently unsupported. Sorry!" ;;
esac
echo $TARGET
}
tempdir() {
if [ -n "$TMPDIR" ]; then
echo "$TMPDIR"
elif [ -d "/tmp" ]; then
echo "/tmp"
else
fatal "Could not locate temporary directory"
fi
}
in_path() {
IFS=":"
for dir in $PATH; do
if [ "$dir" = "$1" ]; then
return 0 # The path is in $PATH
fi
done
return 1 # The path is not in $PATH
}
echo
echo "👾 Welcome to Radicle"
echo
RAD_HOME=${RAD_HOME:-"$HOME/.radicle"}
RAD_PATH=${RAD_PATH:-"$RAD_HOME/bin"}
RAD_MANPATH=${RAD_MANPATH:-"$RAD_HOME/man"}
SHELL=${SHELL:-"/bin/sh"}
info "Detecting operating system..."
TARGET=$(target)
if ! command -v tar >/dev/null 2>&1; then
fatal "Please install 'tar' and try again"
fi
if ! command -v curl >/dev/null 2>&1; then
fatal "Please install 'curl' and try again"
fi
info "Installing radicle into $RAD_PATH..."
mkdir -p "$RAD_PATH"
mkdir -p "$RAD_MANPATH/man1"
curl -# -L "$(url "$TARGET")" | tar -xz --strip-components=1 -C "$RAD_PATH"
chmod +x \
$RAD_PATH/radicle-node \
$RAD_PATH/radicle-httpd \
$RAD_PATH/rad \
$RAD_PATH/git-remote-rad
info "Installing manuals into $RAD_MANPATH..."
mv "$RAD_PATH"/*.1 "$RAD_MANPATH"/man1/
# If radicle is not in $PATH, add it here.
if ! in_path $RAD_PATH; then
DEFAULT="$HOME/.profile"
if [ -e $HOME/.profile ]; then
PROFILE=$DEFAULT
else
case $SHELL in
*/zsh)
PROFILE=$HOME/.zshrc ;;
*/bash)
PROFILE=$HOME/.bashrc ;;
*/fish)
PROFILE=$HOME/.config/fish/config.fish ;;
*/csh)
PROFILE=$HOME/.cshrc ;;
*)
PROFILE=$DEFAULT ;;
esac
fi
info "Configuring path variable in ~${PROFILE#$HOME}..."
echo >> "$PROFILE"
echo "# Added by Radicle." >> "$PROFILE"
echo "export PATH=\"\$PATH:$RAD_PATH\"" >> "$PROFILE"
echo
success
printf "Before running radicle for the first time,\n"
printf "run \033[35m\`source ~${PROFILE#$HOME}\`\033[0m or open a new terminal.\n"
printf "\n"
else
echo
success
fi
printf "To get started, run \033[35m\`rad auth\`\033[0m.\n"

View File

@ -0,0 +1,24 @@
#! /usr/bin/env bash
echo TODO implement update
exit 1
filesHtml="$(curl -s "https://files.radicle.xyz/?sort=time&order=asc")"
# https://github.com/radicle-dev/heartwood/commit/594381d051b06a87dc9f517e99cc0d524274c6a9
#versionCommit = "594381d051b06a87dc9f517e99cc0d524274c6a9";
versionCommit=$(echo "$filesHtml" | grep -F '<a href="./' | head -n1 | cut -d'"' -f2 | cut -c3-42)
#versionDate = "2023-04-07";
versionDate=$(echo "$filesHtml" | grep -F '...TODO...')
nix-prefetch-url https://files.radicle.xyz/594381d051b06a87dc9f517e99cc0d524274c6a9/aarch64-unknown-linux-musl/radicle-aarch64-unknown-linux-musl.tar.gz
sha256sum /nix/store/snnk1j4xrnlyhn76pq8am467wsv6qg1l-radicle-aarch64-unknown-linux-musl.tar.gz
echo -n sha256-; echo -n 8cb0a0abaa26382349d6ee69936daaa510b955b3cf7ca47f64b0c84ce9a05374 | xxd -p -r | base64 -w0
# version is printed by: radicle-node --help # TODO better?
#version = "0.2.0-unstable-${versionDate}";
# https://discourse.nixos.org/t/what-are-the-possible-values-of-stdenv-hostplatform-system/5594/4
# nix-repl> lib.platforms.all
# [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "mipsel-linux" "i686-cygwin" "i686-freebsd" "i686-linux" "i686-netbsd" "i686-openbsd" "x86_64-cygwin" "x86_64-freebsd" "x86_64-linux" "x86_64-netbsd" "x86_64-openbsd" "x86_64-solaris" "x86_64-darwin" "i686-darwin" "aarch64-darwin" "armv7a-darwin" "x86_64-windows" "i686-windows" "wasm64-wasi" "wasm32-wasi" "powerpc64le-linux" "riscv32-linux" "riscv64-linux" "aarch64-none" "avr-none" "arm-none" "i686-none" "x86_64-none" "powerpc-none" "msp430-none" "riscv64-none" "riscv32-none" "vc4-none" "js-ghcjs" ]

View File

@ -0,0 +1,53 @@
{ lib
, stdenv
, fetchurl
}:
stdenv.mkDerivation rec {
pname = "radicle-bin";
# version is printed by: radicle-node --help # TODO better?
version = "0.2.0-unstable-${versionDate}";
# https://github.com/radicle-dev/heartwood/commit/594381d051b06a87dc9f517e99cc0d524274c6a9
versionCommit = "594381d051b06a87dc9f517e99cc0d524274c6a9";
versionDate = "2023-04-07";
src = ({
x86_64-linux = fetchurl {
url = "https://files.radicle.xyz/${versionCommit}/x86_64-unknown-linux-musl/radicle-x86_64-unknown-linux-musl.tar.gz";
sha256 = "sha256-PR3CbYHi0VtXStr40dYSwWvvlni0TaN7V7TqfU0YzUE=";
};
x86_64-darwin = fetchurl {
url = "https://files.radicle.xyz/${versionCommit}/x86_64-apple-darwin/radicle-x86_64-apple-darwin.tar.gz";
sha256 = "sha256-L6od5tjYQCEJD8A8dgq2OWzkDszWCCctbfYuiHRkqOc=";
};
aarch64-linux = fetchurl {
url = "https://files.radicle.xyz/${versionCommit}/aarch64-unknown-linux-musl/radicle-aarch64-unknown-linux-musl.tar.gz";
sha256 = "sha256-jLCgq6omOCNJ1u5pk22qpRC5VbPPfKR/ZLDITOmgU3Q=";
};
aarch64-darwin = fetchurl {
url = "https://files.radicle.xyz/${versionCommit}/aarch64-apple-darwin/radicle-aarch64-apple-darwin.tar.gz";
sha256 = "sha256-Zi8ycefDYeY871SqH+KflPv613vTl+RgfXtheOeOWsY=";
};
}).${stdenv.hostPlatform.system};
installPhase = ''
mkdir -p $out/bin
mv -v * $out/bin
'';
meta = with lib; {
description = "A decentralized app for code collaboration (binary release)";
homepage = "https://radicle.xyz/";
license = licenses.gpl3Plus;
maintainers = with maintainers; [ ];
platforms = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
};
}

View File

@ -0,0 +1,129 @@
# radicle
based on https://github.com/NixOS/nixpkgs/tree/master/pkgs/applications/version-management/radicle-upstream
last PR https://github.com/NixOS/nixpkgs/pull/169755
## source
https://app.radicle.xyz/seeds/seed.radicle.xyz
```
git clone https://seed.radicle.xyz/z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git radicle-interface
git clone https://seed.radicle.xyz/z3gqcJUoA1n9HaHKufZs5FCSGazv5.git heartwood
```
```
git clone https://seed.radicle.xyz/z2ATVRDqFu2Yq2MG5ZZCWecwSDYqj.git radicle-homepage
git clone https://seed.radicle.xyz/z3trNYnLWS11cJWC6BbxDs5niGo82.git rips # Radicle Improvement Proposals (RIPs)
git clone https://seed.radicle.xyz/z2u2CP3ZJzB7ZqE8jHrau19yjcfCQ.git sandbox
# This is the repository of the Radicle Team. It contains team resources and information on Radicle from an organizational standpoint.
git clone https://seed.radicle.xyz/z2Jk1mNqyX7AjT4K83jJW9vQoHn4f.git radicle-team
```
### github
- https://github.com/radicle-dev/radicle-interface
- https://github.com/radicle-dev/heartwood
- https://github.com/radicle-dev/radicle-git
- https://github.com/radicle-dev/radicle-cli - archive: warning Notice: Development of the Radicle CLI has moved to the [Heartwood repository](https://github.com/radicle-dev/heartwood). This repository is being deprecated.
### docker files
- https://github.com/radicle-dev/heartwood/blob/master/docker-compose.yml - `version: "3.7"`
### rust files
- https://github.com/radicle-dev/heartwood/blob/master/Cargo.toml - workspace
- https://github.com/radicle-dev/heartwood/blob/master/radicle/Cargo.toml - `version = "0.2.0"`
- https://github.com/radicle-dev/heartwood/blob/master/radicle-cli/Cargo.toml - `version = "0.8.0"`
- https://github.com/radicle-dev/heartwood/blob/master/radicle-node/Cargo.toml - `version = "0.2.0"`
- https://github.com/radicle-dev/heartwood/blob/master/radicle-httpd/Cargo.toml - `version = "0.1.0"`
### nix files
create build-environment for radicle = install rust toolchain
- https://github.com/radicle-dev/heartwood/tree/master/.nix
- https://github.com/radicle-dev/heartwood/blob/master/.nix/default.nix
- https://github.com/radicle-dev/heartwood/blob/master/.nix/shell.nix
- https://github.com/radicle-dev/heartwood/blob/master/.nix/sources.json
- https://github.com/radicle-dev/heartwood/blob/master/.nix/sources.nix
## binary release
https://radicle.xyz/install &rarr; radicle-bin-install.sh
https://files.radicle.xyz/
https://files.radicle.xyz/?sort=time&order=asc
```
594381d051b06a87dc9f517e99cc0d524274c6a9/ — 04/07/2023, 10:56:55 AM
```
&rarr; 2023-04-07
https://files.radicle.xyz/594381d051b06a87dc9f517e99cc0d524274c6a9/x86_64-unknown-linux-musl/
```
git-remote-rad 6.2 MiB 04/07/2023, 10:56:59 AM
rad 14 MiB 04/07/2023, 10:57:00 AM
radicle-httpd 13 MiB 04/07/2023, 10:57:02 AM
radicle-node 9.6 MiB 04/07/2023, 10:57:03 AM
radicle-x86_64-unknown-linux-musl.tar.gz 14 MiB 04/07/2023, 10:57:04 AM
```
&rarr; binary release
### archive contents
```
$ tar tf radicle-x86_64-unknown-linux-musl.tar.gz
radicle-x86_64-unknown-linux-musl/
radicle-x86_64-unknown-linux-musl/rad
radicle-x86_64-unknown-linux-musl/radicle-node
radicle-x86_64-unknown-linux-musl/git-remote-rad
radicle-x86_64-unknown-linux-musl/radicle-httpd
```
```
$ tar tf radicle-x86_64-apple-darwin.tar.gz
radicle-x86_64-apple-darwin/
radicle-x86_64-apple-darwin/radicle-node
radicle-x86_64-apple-darwin/git-remote-rad
radicle-x86_64-apple-darwin/radicle-httpd
radicle-x86_64-apple-darwin/rad
```
```
$ tar tf radicle-aarch64-unknown-linux-musl.tar.gz
radicle-aarch64-unknown-linux-musl/
radicle-aarch64-unknown-linux-musl/rad
radicle-aarch64-unknown-linux-musl/radicle-node
radicle-aarch64-unknown-linux-musl/git-remote-rad
radicle-aarch64-unknown-linux-musl/radicle-httpd
```
```
$ tar tf radicle-aarch64-apple-darwin.tar.gz
radicle-aarch64-apple-darwin/
radicle-aarch64-apple-darwin/radicle-node
radicle-aarch64-apple-darwin/git-remote-rad
radicle-aarch64-apple-darwin/radicle-httpd
radicle-aarch64-apple-darwin/rad
```
### statically linked
```
$ ldd result/bin/*
result/bin/git-remote-rad:
statically linked
result/bin/rad:
statically linked
result/bin/radicle-httpd:
statically linked
result/bin/radicle-node:
statically linked
```