summary refs log tree commit diff
diff options
context:
space:
mode:
authorRyan Mulligan <ryan@ryantm.com>2023-02-21 09:05:04 -0800
committerGitHub <noreply@github.com>2023-02-21 09:05:04 -0800
commit27a45b0e108271bcbc499776c9962c862589c17a (patch)
tree740efde4a0cd85f8c7fa77e817ba59ed69eca552
parent38593bc3c0ee89bbee1ee58519e7585a356850c6 (diff)
parent0e973e43c040e79f3e95bb2488fea6afd0fb5186 (diff)
downloadnixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar.gz
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar.bz2
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar.lz
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar.xz
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.tar.zst
nixpkgs-27a45b0e108271bcbc499776c9962c862589c17a.zip
Merge pull request #216731 from matthew-levan/vere
urbit: remove old urbit; init at 1.20
-rw-r--r--maintainers/maintainer-list.nix6
-rw-r--r--pkgs/misc/urbit/default.nix41
-rwxr-xr-xpkgs/misc/urbit/update-bin.sh40
3 files changed, 70 insertions, 17 deletions
diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix
index 161a6065df8..af0ec94e8a4 100644
--- a/maintainers/maintainer-list.nix
+++ b/maintainers/maintainer-list.nix
@@ -9198,6 +9198,12 @@
     githubId = 952712;
     name = "Matt Christ";
   };
+  matthew-levan = {
+    email = "matthew@coeli.network";
+    github = "matthew-levan";
+    githubId = 91502660;
+    name = "Matthew LeVan";
+  };
   matthewcroughan = {
     email = "matt@croughan.sh";
     github = "MatthewCroughan";
diff --git a/pkgs/misc/urbit/default.nix b/pkgs/misc/urbit/default.nix
index 9ea1fc64c3f..0cd7dd7e309 100644
--- a/pkgs/misc/urbit/default.nix
+++ b/pkgs/misc/urbit/default.nix
@@ -1,31 +1,38 @@
-{ lib, stdenv, fetchFromGitHub, curl, git, gmp, libsigsegv, meson, ncurses, ninja
-, openssl, pkg-config, re2c, zlib
+{ stdenv
+, 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 {
   pname = "urbit";
-  version = "0.7.3";
+  version = "1.20";
 
-  src = fetchFromGitHub {
-    owner = "urbit";
-    repo = "urbit";
-    rev = "v${version}";
-    sha256 = "192843pjzh8z55fd0x70m3l1vncmixljia3nphgn7j7x4976xkp2";
-    fetchSubmodules = true;
+  src = fetchzip {
+    url = "https://github.com/urbit/vere/releases/download/vere-v${version}/${platform}.tgz";
+    sha256 = {
+      x86_64-linux = "sha256-nBIpf9akK4cXnR5y5Fcl1g7/FxL8BU/CH/WHGhYuP74=";
+      aarch64-linux = "sha256-ERSYXNh/vmAKr4PNonOxTm5/FRLNDWwHSHM6fIeY4Nc=";
+      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 ];
-  buildInputs = [ curl git gmp libsigsegv ncurses openssl re2c zlib ];
-
-  postPatch = ''
-    patchShebangs .
+  postInstall = ''
+    install -m755 -D vere-v${version}-${platform} $out/bin/urbit
   '';
 
+  passthru.updateScript = ./update-bin.sh;
+
   meta = with lib; {
-    description = "An operating function";
     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;
-    maintainers = with maintainers; [ mudri ];
-    platforms = with platforms; linux;
   };
 }
diff --git a/pkgs/misc/urbit/update-bin.sh b/pkgs/misc/urbit/update-bin.sh
new file mode 100755
index 00000000000..b7ee514e10a
--- /dev/null
+++ b/pkgs/misc/urbit/update-bin.sh
@@ -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"