Commit cd851f54 authored by Danielle Lancashire's avatar Danielle Lancashire Committed by Maxine Aubrey
Browse files

fermyon-spin: 2.2.0 -> 2.4.2

parent 3b11cc57
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchzip
, fetchurl
, autoPatchelfHook
, gcc-unwrapped
, zlib
@@ -17,22 +17,26 @@ let
  }.${system} or (throw "Unsupported system: ${system}");

  packageHash = {
    x86_64-linux = "sha256-Y0Inew0PncpnEpdLWtl/85t93eGSRewKh5mvGnn+yck=";
    aarch64-linux = "sha256-HEm3TaLeaws8G73CU9BmxeplQdeF9nQbBSnbctaVhqI=";
    x86_64-darwin = "sha256-mlshpN/4Od4qrXiqIEYo7G84Dtb+tp2nK2VnrRG2rto=";
    aarch64-darwin = "sha256-aJH/vOidj0vbkttGDgelaAC/dMYguQPLjxl+V3pOVzI=";
    x86_64-linux = "sha256-LHiLkZ+VN+wPnq6OukXozQWKh7ewNaFor1ndCUlCBtU=";
    aarch64-linux = "sha256-1+rLGnm+LhbYigYUcmuLICLFXUk3wjOkmxuCuuI+Xqc=";
    x86_64-darwin = "sha256-mJA3VXfNr6578Q2xw0xOZccloQpeCIsjn3dVdlsnTVs=";
    aarch64-darwin = "sha256-FNl3UefJWA8yJ2B44GUEK6py7DLikJrygIwsqdIjW9c=";
  }.${system} or (throw "Unsupported system: ${system}");

in stdenv.mkDerivation rec {
  pname = "fermyon-spin";
  version = "2.2.0";
  version = "2.4.2";

  src = fetchzip {
  # Use fetchurl rather than fetchzip as these tarballs are built by the project
  # and not by GitHub (and thus are stable) - this simplifies the update script
  # by allowing it to use the output of `nix store prefetch-file`.
  src = fetchurl {
    url = "https://github.com/fermyon/spin/releases/download/v${version}/spin-v${version}-${platform}.tar.gz";
    stripRoot = false;
    hash = packageHash;
  };

  sourceRoot = ".";

  nativeBuildInputs = lib.optionals stdenv.isLinux [
    autoPatchelfHook
  ];
@@ -46,7 +50,7 @@ in stdenv.mkDerivation rec {
    runHook preInstall

    mkdir -p $out/bin
    cp $src/* $out/bin
    cp ./spin $out/bin

    runHook postInstall
  '';
+31 −0
Original line number Diff line number Diff line
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq
#shellcheck shell=bash

CURRENT_HASH=""

print_hash() {
    OS="$1"
    ARCH="$2"
    VERSION="$3"

    URL="https://github.com/fermyon/spin/releases/download/v${VERSION}/spin-v${VERSION}-${OS}-${ARCH}.tar.gz"
    echo
    CURRENT_HASH=$(nix store prefetch-file "$URL" --json | jq -r '.hash')

    echo "${ARCH}-${OS}: $CURRENT_HASH"
}

if [[ -z "$VER" && -n "$1" ]]; then
    VER="$1"
fi

if [[ -z "$VER" ]]; then
    echo "No 'VER' environment variable provided, skipping"
else
    print_hash "linux"  "amd64"   "$VER"
    print_hash "linux"  "aarch64" "$VER"
    print_hash "macos" "amd64"   "$VER"
    print_hash "macos" "aarch64" "$VER"
fi