From 3ba5ef91bc9de8ddd302124e3415192b186f6703 Mon Sep 17 00:00:00 2001 From: piegames Date: Tue, 15 Oct 2024 23:34:20 +0200 Subject: benchmarks: Fix purity Some stuff wasn't working on my machine because it depended on the host environment in some ways, fixed those. Change-Id: Iff4931a9a26c6827978f1ee6434710f406d67a96 --- bench/bench.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bench/bench.sh') diff --git a/bench/bench.sh b/bench/bench.sh index 70acd4640..15d8af05a 100755 --- a/bench/bench.sh +++ b/bench/bench.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p bash -p hyperfine set -euo pipefail shopt -s inherit_errexit @@ -21,16 +22,21 @@ fi _exit="" trap "$_exit" EXIT +flake_args=("--extra-experimental-features" "nix-command flakes") + # XXX: yes this is very silly. flakes~!! -nix build --impure --expr '(builtins.getFlake "git+file:.").inputs.nixpkgs.outPath' -o bench/nixpkgs +nix build "${flake_args[@]}" --impure --expr '(builtins.getFlake "git+file:.").inputs.nixpkgs.outPath' -o bench/nixpkgs +# We must ignore the global config, or else NIX_PATH won't work reliably. +# See https://github.com/NixOS/nix/issues/9574 +export NIX_CONF_DIR='/var/empty' export NIX_REMOTE="$(mktemp -d)" _exit='rm -rfv "$NIX_REMOTE"; $_exit' export NIX_PATH="nixpkgs=bench/nixpkgs:nixos-config=bench/configuration.nix" builds=("$@") -flake_args="--extra-experimental-features 'nix-command flakes'" +flake_args="${flake_args[*]@Q}" hyperfineArgs=( --parameter-list BUILD "$(IFS=,; echo "${builds[*]}")" -- cgit v1.2.3