Nix packages for third-party projects that don't ship their own flakes
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: add gleam-preview package (v1.18.0-rc1)

Package official multi-platform Gleam prerelease binaries as gleam-preview,
install the CLI as gleam-preview so it can coexist with nixpkgs gleam, and
teach the package updater to track prerelease tags via tag_prerelease.

author
nandi
date (Jul 24, 2026, 6:49 PM -0700) commit ad6e024b parent f7712968 change-id mlkyprun
+155 -16
+33 -4
README.md
··· 32 32 | `boxd` | [boxd.sh](https://boxd.sh) / [docs](https://docs.boxd.sh/quickstart) | `curl -fsSL https://boxd.sh/downloads/install.sh \| sh` | 33 33 | `whetuu` | [yamafaktory/whetuu](https://github.com/yamafaktory/whetuu) | [install script](https://yamafaktory.github.io/whetuu/install.sh) / release tarballs | 34 34 | `pullrun` | [pullrun/pullrun](https://github.com/pullrun/pullrun) | `curl -fsSL https://github.com/pullrun/pullrun/raw/main/install.sh \| bash` | 35 + | `gleam-preview` | [gleam-lang/gleam](https://github.com/gleam-lang/gleam) (prereleases) | [install docs](https://gleam.run/getting-started/installing/) / release tarballs | 35 36 | `zed-preview` | [zed-industries/zed](https://github.com/zed-industries/zed) (preview channel) | [official Linux installer](https://zed.dev/docs/linux) / `zed-linux-x86_64.tar.gz` | 36 37 37 38 ## Usage ··· 44 45 nix build .#boxd # x86_64-linux / aarch64-linux / aarch64-darwin 45 46 nix build .#whetuu # linux + darwin (all four systems) 46 47 nix build .#pullrun # linux + darwin (all four systems) 48 + nix build .#gleam-preview # linux + darwin (all four systems) 47 49 nix build .#zed-preview # x86_64-linux only 48 50 49 51 # run without installing ··· 54 56 nix run .#boxd -- --help 55 57 nix run .#whetuu -- --version 56 58 nix run .#pullrun -- --version 59 + nix run .#gleam-preview -- --version 57 60 nix run .#zed-preview -- --version 58 61 59 62 # install into your profile ··· 63 66 nix profile install .#boxd 64 67 nix profile install .#whetuu 65 68 nix profile install .#pullrun 69 + nix profile install .#gleam-preview 66 70 nix profile install .#zed-preview 67 71 ``` 68 72 ··· 149 153 ``` 150 154 151 155 Tracks the newest non-draft GitHub release whose tag matches 152 - `{tag_prefix}{semver}{tag_suffix}`. Single-asset mode refreshes one `fetchurl` 153 - hash; multi-platform mode rewrites every `sources.<system>.{url,hash}`. 154 - `{version}` in asset names is the bare version (no tag prefix). Used by 155 - `zed-preview` (single) and `whetuu` (multi). 156 + `{tag_prefix}{semver}{tag_suffix}`. Set `"tag_prerelease": true` to match any 157 + prerelease tag (`vX.Y.Z-rc1`, `vX.Y.Z-beta`, …) instead of a fixed suffix. 158 + Single-asset mode refreshes one `fetchurl` hash; multi-platform mode rewrites 159 + every `sources.<system>.{url,hash}`. `{version}` in asset names is the bare 160 + version (no tag prefix). Used by `zed-preview` (single), `whetuu` / 161 + `gleam-preview` / `pullrun` (multi). 156 162 157 163 **url-manifest-binary** — prebuilt multi-platform binaries via a version 158 164 manifest URL (not GitHub releases): ··· 310 316 ``` 311 317 3. `nix build .#pullrun` and smoke-test `./result/bin/pullrun --version` and 312 318 `./result/bin/pullrun-runtime --version`. 319 + 320 + ### Manual steps (gleam-preview) 321 + 322 + `gleam-preview` ships official multi-platform prerelease binaries (tags 323 + `vX.Y.Z-rcN`, etc.). The binary is installed as `gleam-preview` so it can 324 + coexist with nixpkgs `gleam`. Prefer the updater: 325 + 326 + ```bash 327 + ./scripts/update-packages.sh gleam-preview 328 + ``` 329 + 330 + By hand: 331 + 332 + 1. Bump `version` in `packages/gleam-preview/default.nix` (e.g. `1.18.0-rc1`). 333 + 2. Update each `sources.<system>.url` to the matching release asset and prefetch: 334 + ```bash 335 + nix-prefetch-url "https://github.com/gleam-lang/gleam/releases/download/vX.Y.Z-rcN/gleam-vX.Y.Z-rcN-x86_64-unknown-linux-musl.tar.gz" 336 + nix-prefetch-url "https://github.com/gleam-lang/gleam/releases/download/vX.Y.Z-rcN/gleam-vX.Y.Z-rcN-aarch64-unknown-linux-musl.tar.gz" 337 + nix-prefetch-url "https://github.com/gleam-lang/gleam/releases/download/vX.Y.Z-rcN/gleam-vX.Y.Z-rcN-x86_64-apple-darwin.tar.gz" 338 + nix-prefetch-url "https://github.com/gleam-lang/gleam/releases/download/vX.Y.Z-rcN/gleam-vX.Y.Z-rcN-aarch64-apple-darwin.tar.gz" 339 + nix hash convert --hash-algo sha256 --to sri <base32> 340 + ``` 341 + 3. `nix build .#gleam-preview` and smoke-test `./result/bin/gleam-preview --version`.
+5
flake.nix
··· 36 36 rook = pkgs.callPackage ./packages/rook { }; 37 37 whetuu = pkgs.callPackage ./packages/whetuu { }; 38 38 pullrun = pkgs.callPackage ./packages/pullrun { }; 39 + gleam-preview = pkgs.callPackage ./packages/gleam-preview { }; 39 40 default = self.packages.${system}.vit; 40 41 } 41 42 // pkgs.lib.optionalAttrs ( ··· 81 82 pullrun = { 82 83 type = "app"; 83 84 program = "${self.packages.${system}.pullrun}/bin/pullrun"; 85 + }; 86 + gleam-preview = { 87 + type = "app"; 88 + program = "${self.packages.${system}.gleam-preview}/bin/gleam-preview"; 84 89 }; 85 90 default = self.apps.${system}.vit; 86 91 }
+67
packages/gleam-preview/default.nix
··· 1 + { 2 + lib, 3 + stdenv, 4 + fetchurl, 5 + versionCheckHook, 6 + }: 7 + 8 + let 9 + # Prebuilt static (Linux musl) / native (macOS) binaries from GitHub releases. 10 + # Asset names: gleam-v{version}-{target}.tar.gz — each archive is a single `gleam`. 11 + sources = { 12 + x86_64-linux = { 13 + url = "https://github.com/gleam-lang/gleam/releases/download/v1.18.0-rc1/gleam-v1.18.0-rc1-x86_64-unknown-linux-musl.tar.gz"; 14 + hash = "sha256-4nCA6pli6Z7O2Uy8A+ffHgnEd2ATBQo/zA+nWFyKqlo="; 15 + }; 16 + aarch64-linux = { 17 + url = "https://github.com/gleam-lang/gleam/releases/download/v1.18.0-rc1/gleam-v1.18.0-rc1-aarch64-unknown-linux-musl.tar.gz"; 18 + hash = "sha256-d3z6GuSUIDEYWweSNZba0Pgxd/88LJ1riwkDbxsrAms="; 19 + }; 20 + x86_64-darwin = { 21 + url = "https://github.com/gleam-lang/gleam/releases/download/v1.18.0-rc1/gleam-v1.18.0-rc1-x86_64-apple-darwin.tar.gz"; 22 + hash = "sha256-f1iBXb6djyTGDQ4I2o73j87zqBxFnFuECe9JhjiwAkU="; 23 + }; 24 + aarch64-darwin = { 25 + url = "https://github.com/gleam-lang/gleam/releases/download/v1.18.0-rc1/gleam-v1.18.0-rc1-aarch64-apple-darwin.tar.gz"; 26 + hash = "sha256-UYDqJiHrcLnoqPFOavJBa9/RF1dBrxmOPBt6K8g5QCA="; 27 + }; 28 + }; 29 + 30 + srcAttrs = 31 + sources.${stdenv.hostPlatform.system} 32 + or (throw "gleam-preview: unsupported system ${stdenv.hostPlatform.system}"); 33 + in 34 + stdenv.mkDerivation (finalAttrs: { 35 + pname = "gleam-preview"; 36 + # Official prerelease tags are vX.Y.Z-rcN (and similar) on GitHub. 37 + version = "1.18.0-rc1"; 38 + 39 + src = fetchurl { 40 + inherit (srcAttrs) url hash; 41 + }; 42 + 43 + # Archive root is just the `gleam` binary (no directory wrapper). 44 + sourceRoot = "."; 45 + 46 + installPhase = '' 47 + runHook preInstall 48 + # Install as gleam-preview so this can coexist with nixpkgs gleam on PATH. 49 + install -Dm755 gleam $out/bin/gleam-preview 50 + runHook postInstall 51 + ''; 52 + 53 + nativeInstallCheckInputs = [ versionCheckHook ]; 54 + versionCheckProgram = "${placeholder "out"}/bin/gleam-preview"; 55 + versionCheckProgramArg = "--version"; 56 + doInstallCheck = true; 57 + 58 + meta = { 59 + description = "Statically typed language for the Erlang VM (official prerelease binaries)"; 60 + homepage = "https://gleam.run"; 61 + changelog = "https://github.com/gleam-lang/gleam/releases/tag/v${finalAttrs.version}"; 62 + license = lib.licenses.asl20; 63 + mainProgram = "gleam-preview"; 64 + platforms = builtins.attrNames sources; 65 + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 66 + }; 67 + })
+13
packages/gleam-preview/upstream.json
··· 1 + { 2 + "type": "github-release-binary", 3 + "github": "gleam-lang/gleam", 4 + "tag_prefix": "v", 5 + "tag_prerelease": true, 6 + "platforms": { 7 + "x86_64-linux": "gleam-v{version}-x86_64-unknown-linux-musl.tar.gz", 8 + "aarch64-linux": "gleam-v{version}-aarch64-unknown-linux-musl.tar.gz", 9 + "x86_64-darwin": "gleam-v{version}-x86_64-apple-darwin.tar.gz", 10 + "aarch64-darwin": "gleam-v{version}-aarch64-apple-darwin.tar.gz" 11 + }, 12 + "description": "Official multi-platform prerelease tarballs (static musl on Linux). Tracks latest vX.Y.Z-rcN (etc.) GitHub prerelease." 13 + }
+37 -12
scripts/update-packages.sh
··· 412 412 } 413 413 414 414 latest_github_tag_with_suffix() { 415 - # latest_github_tag_with_suffix <owner/repo> <prefix> <suffix> 415 + # latest_github_tag_with_suffix <owner/repo> <prefix> <suffix> [prerelease] 416 416 # e.g. prefix=v suffix=-pre => matches v1.12.0-pre, prints 1.12.0-pre 417 - local repo="$1" prefix="$2" suffix="$3" 417 + # When prerelease=1, match any vX.Y.Z-<pre> tag (rc1, beta, …) and ignore suffix. 418 + local repo="$1" prefix="$2" suffix="$3" prerelease="${4:-0}" 418 419 local url="https://api.github.com/repos/${repo}/releases?per_page=30" 419 420 local args=(-fsSL) 420 421 if [[ -n "${GITHUB_TOKEN:-}" ]]; then ··· 422 423 fi 423 424 curl "${args[@]}" "$url" | python3 -c ' 424 425 import json, re, sys 425 - prefix, suffix = sys.argv[1], sys.argv[2] 426 + prefix, suffix, prerelease = sys.argv[1], sys.argv[2], sys.argv[3] == "1" 426 427 releases = json.load(sys.stdin) 427 - pat = re.compile( 428 - r"^" + re.escape(prefix) + r"(\d+\.\d+\.\d+)" + re.escape(suffix) + r"$" 429 - ) 428 + if prerelease: 429 + # Any prerelease/build tag: v1.18.0-rc1, v1.18.0-beta.2, … 430 + pat = re.compile( 431 + r"^" + re.escape(prefix) + r"(\d+\.\d+\.\d+[-+][0-9A-Za-z.-]+)$" 432 + ) 433 + else: 434 + pat = re.compile( 435 + r"^" + re.escape(prefix) + r"(\d+\.\d+\.\d+)" + re.escape(suffix) + r"$" 436 + ) 430 437 versions = [] 431 438 for r in releases: 432 439 if r.get("draft"): ··· 434 441 name = r.get("tag_name") or "" 435 442 m = pat.match(name) 436 443 if m: 437 - versions.append(m.group(1) + suffix) 444 + if prerelease: 445 + versions.append(m.group(1)) 446 + else: 447 + versions.append(m.group(1) + suffix) 438 448 if not versions: 439 - sys.exit("no matching release tags for prefix=%r suffix=%r" % (prefix, suffix)) 449 + kind = "prerelease" if prerelease else "prefix=%r suffix=%r" % (prefix, suffix) 450 + sys.exit("no matching release tags for " + kind) 440 451 def key(v): 441 - core = re.split(r"[+-]", v, maxsplit=1)[0] 442 - return [int(x) for x in core.split(".")] 452 + m = re.match(r"^(\d+\.\d+\.\d+)(?:-([0-9A-Za-z.-]+))?(?:\+.*)?$", v) 453 + core = [int(x) for x in m.group(1).split(".")] 454 + pre = m.group(2) or "" 455 + # Prefer higher core; among same core, sort pre parts (rc2 > rc1). 456 + pre_parts = re.findall(r"\d+|[A-Za-z]+", pre) 457 + pre_key = [int(p) if p.isdigit() else p.lower() for p in pre_parts] 458 + return (core, pre_key) 443 459 versions.sort(key=key) 444 460 print(versions[-1]) 445 - ' "$prefix" "$suffix" 461 + ' "$prefix" "$suffix" "$prerelease" 446 462 } 447 463 448 464 set_fetchurl_hash() { ··· 495 511 has_platforms=1 496 512 fi 497 513 514 + local tag_prerelease=0 515 + if python3 -c ' 516 + import json, sys 517 + u = json.load(open(sys.argv[1])) 518 + sys.exit(0 if u.get("tag_prerelease") else 1) 519 + ' "$upstream" 2>/dev/null; then 520 + tag_prerelease=1 521 + fi 522 + 498 523 if [[ "$has_platforms" -eq 0 && -z "$asset" ]]; then 499 524 die "${name}: upstream.json needs either asset or platforms" 500 525 fi ··· 502 527 local cur latest 503 528 cur="$(current_version "$default_nix")" 504 529 log "${name}: current=${cur}" 505 - latest="$(latest_github_tag_with_suffix "$repo" "$tag_prefix" "$tag_suffix")" 530 + latest="$(latest_github_tag_with_suffix "$repo" "$tag_prefix" "$tag_suffix" "$tag_prerelease")" 506 531 log "${name}: latest upstream=${latest}" 507 532 508 533 if [[ "$latest" == "$cur" ]]; then