urbit: remove old urbit; init at 1.20

This commit is contained in:
Matthew LeVan 2023-02-16 20:46:04 -05:00
parent 1f9748835c
commit 0e973e43c0
3 changed files with 70 additions and 17 deletions

View File

@ -9183,6 +9183,12 @@
githubId = 952712; githubId = 952712;
name = "Matt Christ"; name = "Matt Christ";
}; };
matthew-levan = {
email = "matthew@coeli.network";
github = "matthew-levan";
githubId = 91502660;
name = "Matthew LeVan";
};
matthewcroughan = { matthewcroughan = {
email = "matt@croughan.sh"; email = "matt@croughan.sh";
github = "MatthewCroughan"; github = "MatthewCroughan";

View File

@ -1,31 +1,38 @@
{ lib, stdenv, fetchFromGitHub, curl, git, gmp, libsigsegv, meson, ncurses, ninja { stdenv
, openssl, pkg-config, re2c, zlib , lib
, fetchzip
}: }:
let
os = if stdenv.isDarwin then "macos" else "linux";
arch = if stdenv.isAarch64 then "aarch64" else "x86_64";
platform = "${os}-${arch}";
in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "urbit"; pname = "urbit";
version = "0.7.3"; version = "1.20";
src = fetchFromGitHub { src = fetchzip {
owner = "urbit"; url = "https://github.com/urbit/vere/releases/download/vere-v${version}/${platform}.tgz";
repo = "urbit"; sha256 = {
rev = "v${version}"; x86_64-linux = "sha256-nBIpf9akK4cXnR5y5Fcl1g7/FxL8BU/CH/WHGhYuP74=";
sha256 = "192843pjzh8z55fd0x70m3l1vncmixljia3nphgn7j7x4976xkp2"; aarch64-linux = "sha256-ERSYXNh/vmAKr4PNonOxTm5/FRLNDWwHSHM6fIeY4Nc=";
fetchSubmodules = true; x86_64-darwin = "sha256-Kk9hNzyWngnyqlyQ9hILFM81WVw1ZYimMj4K3ENtifE=";
aarch64-darwin = "sha256-i3ixj04J/fcb396ncINLF8eYw1mpFCYeIM3f74K6tqY=";
}.${stdenv.hostPlatform.system} or (throw "unsupported system ${stdenv.hostPlatform.system}");
}; };
nativeBuildInputs = [ pkg-config ninja meson ]; postInstall = ''
buildInputs = [ curl git gmp libsigsegv ncurses openssl re2c zlib ]; install -m755 -D vere-v${version}-${platform} $out/bin/urbit
postPatch = ''
patchShebangs .
''; '';
passthru.updateScript = ./update-bin.sh;
meta = with lib; { meta = with lib; {
description = "An operating function";
homepage = "https://urbit.org"; homepage = "https://urbit.org";
description = "An operating function";
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
maintainers = [ maintainers.matthew-levan ];
license = licenses.mit; license = licenses.mit;
maintainers = with maintainers; [ mudri ];
platforms = with platforms; linux;
}; };
} }

40
pkgs/misc/urbit/update-bin.sh Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl common-updater-scripts nix-prefetch
set -euo pipefail
ROOT="$(dirname "$(readlink -f "$0")")"
NIX_DRV="$ROOT/default.nix"
if [ ! -f "$NIX_DRV" ]; then
echo "ERROR: cannot find urbit in $ROOT"
exit 1
fi
fetch_arch() {
VER="$1"; ARCH="$2"
URL="https://github.com/urbit/vere/releases/download/vere-v${VER}/${ARCH}.tgz";
nix-prefetch "{ stdenv, fetchzip }:
stdenv.mkDerivation rec {
pname = \"vere\"; version = \"${VER}\";
src = fetchzip { url = \"$URL\"; };
}
"
}
replace_sha() {
sed -i "s#$1 = \"sha256-.\{44\}\"#$1 = \"$2\"#" "$NIX_DRV"
}
VERE_VER=$(curl https://bootstrap.urbit.org/vere/live/last)
VERE_LINUX_AARCH64_SHA256=$(fetch_arch "$VERE_VER" "linux-aarch64")
VERE_LINUX_X64_SHA256=$(fetch_arch "$VERE_VER" "linux-x86_64")
VERE_DARWIN_AARCH64_SHA256=$(fetch_arch "$VERE_VER" "macos-aarch64")
VERE_DARWIN_X64_SHA256=$(fetch_arch "$VERE_VER" "macos-x86_64")
sed -i "s/version = \".*\"/version = \"$VERE_VER\"/" "$NIX_DRV"
replace_sha "aarch64-linux" "$VERE_LINUX_AARCH64_SHA256"
replace_sha "x86_64-linux" "$VERE_LINUX_X64_SHA256"
replace_sha "aarch64-darwin" "$VERE_DARWIN_AARCH64_SHA256"
replace_sha "x86_64-darwin" "$VERE_DARWIN_X64_SHA256"