infra/nix/scripts/pre-eval-fixed.sh

8 lines
354 B
Bash
Executable file

#!/usr/bin/env bash
set -xe
INFILE="${1:?Please set arg1 to INFILE}"
OUTFILE="${2:?Please set arg2 to OUTFILE}"
# sha256-1fm94N2Y9ptXVN6ni0nJyPRK+nsvoeliqBcFyjlaTH4=
hash=$(nix-build ${INFILE} --arg pkgs 'import <channels-nixos-stable> {}' --arg config 'null' 2>&1 | rg -o 'got.*(sha256-.{44})' -r '$1')
sed -E "s/0{52}/${hash}/" ${INFILE} > ${OUTFILE}