diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 6e9e3faf60e6..76d944532001 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -9183,6 +9183,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 9ea1fc64c3f3..0cd7dd7e309d 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 000000000000..b7ee514e10a7 --- /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"