#!/usr/bin/env bash NIX_FILE="nix/package-local.nix" # Get current hash commit as version VERSION="$(git rev-parse --short HEAD)" echo "Bumping version to hash: $VERSION" sed -i "s/version = \".*\";/version = \"$VERSION\";/" "$NIX_FILE" sed -i 's/sha256-.*=//g' "$NIX_FILE" nix build .#local 2> build.log SHA256=$(grep "got:" build.log | grep -o "sha256-.*=" | cut -d'-' -f2) echo "cargo hash SHA256: $SHA256" sed -i "s#cargoHash = \".*\";#cargoHash = \"sha256-$SHA256\";#" "$NIX_FILE" echo "Building nix derivation" nix build .#local rm -f build.log