diff --git a/tests/examples/default.nix b/tests/examples/default.nix index 1bdd70b4..53beb5cb 100644 --- a/tests/examples/default.nix +++ b/tests/examples/default.nix @@ -6,8 +6,10 @@ coreutils, git, gnugrep, + gnused, jq, parallel, + moreutils, nix, pkgs, framework, @@ -23,7 +25,9 @@ coreutils git gnugrep + gnused jq + moreutils nix ] '' @@ -37,6 +41,11 @@ if [ -n "''${NIX:-}" ]; then PATH="$(dirname $NIX):$PATH" fi + + # Override `systems` in the flake.nix to only contain the current one. + # We don't want to expose multiple systems to reduce evaluation overhead. + sed "s/x86_64-linux/$NIX_SYSTEM/g" flake.nix | sponge flake.nix + nix flake lock --override-input dream2nix ${../../.} if nix flake show | grep -q resolveImpure; then nix run .#resolveImpure --show-trace @@ -45,7 +54,7 @@ # write to store at eval time evalBlockList=("haskell_cabal-plan" "haskell_stack-lock") if [[ ! ((''${evalBlockList[*]} =~ "$dir")) ]] \ - && [ "$(nix flake show --json | jq 'select(.packages."x86_64-linux".default.name)')" != "" ]; then + && [ "$(nix flake show --json | jq 'select(.packages."$NIX_SYSTEM".default.name)')" != "" ]; then nix eval --read-only --no-allow-import-from-derivation .#default.name fi nix flake check "$@" @@ -58,10 +67,12 @@ in framework.utils.writePureShellScript [ coreutils + nix parallel ] '' export STATS_FILE=$(mktemp) + export NIX_SYSTEM=$(nix eval --impure --expr builtins.currentSystem --raw) if [ -z ''${1+x} ]; then JOBS=''${JOBS:-$(nproc)} parallel --halt now,fail=1 -j$JOBS -a <(ls ${examples}) ${testScript} diff --git a/tests/integration-d2n-flakes/default.nix b/tests/integration-d2n-flakes/default.nix index b649f30d..32268b2f 100644 --- a/tests/integration-d2n-flakes/default.nix +++ b/tests/integration-d2n-flakes/default.nix @@ -5,7 +5,9 @@ bash, coreutils, git, + gnused, parallel, + moreutils, nix, framework, ... @@ -19,6 +21,8 @@ bash coreutils git + gnused + moreutils nix ] '' @@ -29,6 +33,11 @@ start_time=$(date +%s) cp -r ${tests}/$dir/* . chmod -R +w . + + # Override `systems` in the flake.nix to only contain the current one. + # We don't want to expose multiple systems to reduce evaluation overhead. + sed "s/x86_64-linux/$NIX_SYSTEM/g" flake.nix | sponge flake.nix + nix flake lock --override-input dream2nix ${../../.} nix run .#resolveImpure || echo "no resolveImpure probably?" nix build @@ -42,10 +51,12 @@ in framework.utils.writePureShellScript [ coreutils + nix parallel ] '' export STATS_FILE=$(mktemp) + export NIX_SYSTEM=$(nix eval --impure --expr builtins.currentSystem --raw) if [ -z ''${1+x} ]; then JOBS=''${JOBS:-$(nproc)} parallel --halt now,fail=1 -j$JOBS -a <(ls ${tests}) ${testScript}