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

6 lines
298 B
Bash
Executable file

#!/usr/bin/env bash
set -xe
INFILE="${1:?Please set arg1 to INFILE}"
OUTFILE="${2:?Please set arg2 to OUTFILE}"
hash=$(nix-build ${INFILE} --arg pkgs 'import <channels-nixos-stable> {}' --arg config 'null' 2>&1 | grep -oE '[0-9a-z]{52}' | head -n1)
sed -E "s/0{52}/${hash}/" ${INFILE} > ${OUTFILE}