diff --git a/pkgs/by-name/sa/saw-tools/package.nix b/pkgs/by-name/sa/saw-tools/package.nix index 1136ccef30d7..c08c9abc222c 100644 --- a/pkgs/by-name/sa/saw-tools/package.nix +++ b/pkgs/by-name/sa/saw-tools/package.nix @@ -11,16 +11,17 @@ testers, }: +let + sources = import ./sources.nix; +in + stdenv.mkDerivation (finalAttrs: { pname = "saw-tools"; - version = "1.4"; + version = "1.5"; - src = fetchurl { - url = "https://github.com/GaloisInc/saw-script/releases/download/v${finalAttrs.version}/saw-${finalAttrs.version}-ubuntu-22.04-X64-with-solvers.tar.gz"; - hash = "sha256-AjMGOi0Nzl0cjVltjgbqhzBiPpIZbDtS3+SqergeulE="; - }; + src = fetchurl sources.${stdenv.hostPlatform.system}; - buildInputs = [ + buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ gmp ncurses readline @@ -28,10 +29,13 @@ stdenv.mkDerivation (finalAttrs: { zlib ]; - nativeBuildInputs = [ - autoPatchelfHook - makeWrapper - ]; + nativeBuildInputs = + lib.optionals stdenv.hostPlatform.isLinux [ + autoPatchelfHook + ] + ++ [ + makeWrapper + ]; installPhase = '' mkdir -p $out/lib $out/share @@ -49,10 +53,14 @@ stdenv.mkDerivation (finalAttrs: { meta = { description = "Tools for software verification and analysis"; - homepage = "https://saw.galois.com"; + homepage = "https://tools.galois.com/saw"; sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; license = lib.licenses.bsd3; - platforms = [ "x86_64-linux" ]; - maintainers = [ lib.maintainers.thoughtpolice ]; + platforms = lib.attrNames sources; + maintainers = with lib.maintainers; [ + thoughtpolice + thelissimus + ]; + mainProgram = "saw"; }; }) diff --git a/pkgs/by-name/sa/saw-tools/sources.nix b/pkgs/by-name/sa/saw-tools/sources.nix new file mode 100644 index 000000000000..5f17154d628c --- /dev/null +++ b/pkgs/by-name/sa/saw-tools/sources.nix @@ -0,0 +1,16 @@ +# Generated by ./update.sh - do not update manually! +# Last updated: 2026-03-28 +{ + aarch64-darwin = { + url = "https://github.com/GaloisInc/saw-script/releases/download/v1.5/saw-1.5-macos-15-ARM64-with-solvers.tar.gz"; + hash = "sha256-1mURJfcnIRhuLrG1Gf4SRXmTzLbztBBRQGcXFFiAWWU="; + }; + x86_64-darwin = { + url = "https://github.com/GaloisInc/saw-script/releases/download/v1.5/saw-1.5-macos-15-intel-X64-with-solvers.tar.gz"; + hash = "sha256-f3NofLPR6tarcZg/EjtCv1mSxz5O4nTKeOEoTPeGgf8="; + }; + x86_64-linux = { + url = "https://github.com/GaloisInc/saw-script/releases/download/v1.5/saw-1.5-ubuntu-22.04-X64-with-solvers.tar.gz"; + hash = "sha256-k9Qo93d0IXBRe7P+wU20LjFjM+LdHf6Z2S0Nybmh/4E="; + }; +} diff --git a/pkgs/by-name/sa/saw-tools/update.sh b/pkgs/by-name/sa/saw-tools/update.sh new file mode 100755 index 000000000000..0baf5021543f --- /dev/null +++ b/pkgs/by-name/sa/saw-tools/update.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash --pure -p nix + +set -euo pipefail + +cd "$(readlink -e "$(dirname "${BASH_SOURCE[0]}")")" + +version="1.5" + +aarch64_darwin_url="https://github.com/GaloisInc/saw-script/releases/download/v${version}/saw-${version}-macos-15-ARM64-with-solvers.tar.gz" +x86_64_darwin_url="https://github.com/GaloisInc/saw-script/releases/download/v${version}/saw-${version}-macos-15-intel-X64-with-solvers.tar.gz" +x86_64_linux_url="https://github.com/GaloisInc/saw-script/releases/download/v${version}/saw-${version}-ubuntu-22.04-X64-with-solvers.tar.gz" + +aarch64_darwin_hash=$(nix-prefetch-url "$aarch64_darwin_url") +x86_64_darwin_hash=$(nix-prefetch-url "$x86_64_darwin_url") +x86_64_linux_hash=$(nix-prefetch-url "$x86_64_linux_url") + +aarch64_darwin_hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$aarch64_darwin_hash") +x86_64_darwin_hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$x86_64_darwin_hash") +x86_64_linux_hash=$(nix --extra-experimental-features nix-command hash convert --to sri --hash-algo sha256 "$x86_64_linux_hash") + +sed -i "s/version = \".*\"/version = \"${version}\"/" package.nix + +cat >sources.nix <