Skip to content

Commit c26dc57

Browse files
committed
Factor out --override-input in one place
1 parent 70359f1 commit c26dc57

File tree

9 files changed

+25
-33
lines changed

9 files changed

+25
-33
lines changed

example/test.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@ set -euo pipefail
33

44
function templateTest () {
55
# Build haskell executable
6-
nix build \
7-
${OVERRIDE_HASKELL_FLAKE} \
8-
${OVERRIDE_NIXPKGS}
6+
nix build ${OVERRIDE_ALL}
97
# Test haskell devshell (via HLS check)
108
nix develop \
11-
${OVERRIDE_HASKELL_FLAKE} \
12-
${OVERRIDE_NIXPKGS} \
9+
${OVERRIDE_ALL} \
1310
-c haskell-language-server
1411
}
1512

nix/find-haskell-paths/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
source ../../test/common.sh
22

3-
nix eval -I nixpkgs=flake:github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7 \
3+
nix eval -I nixpkgs=flake:${NIXPKGS_URL} \
44
--impure --expr 'import ./parser_tests.nix {}'

test/common.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ fi
1414
DIR_OF_COMMON_SH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1515
HASKELL_FLAKE=${DIR_OF_COMMON_SH}/..
1616
OVERRIDE_HASKELL_FLAKE="--override-input haskell-flake path:${HASKELL_FLAKE}"
17-
OVERRIDE_NIXPKGS="--override-input nixpkgs github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7"
17+
18+
# Let's pin both nixpkgs and flake-parts across all tests, to save up on CI time.
19+
NIXPKGS_URL="github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7"
20+
OVERRIDE_NIXPKGS="--override-input nixpkgs ${NIXPKGS_URL}"
21+
OVERRIDE_FLAKE_PARTS="--override-input flake-parts github:hercules-ci/flake-parts/7c7a8bce3dffe71203dcd4276504d1cb49dfe05f"
22+
23+
OVERRIDE_ALL="${OVERRIDE_HASKELL_FLAKE} ${OVERRIDE_FLAKE_PARTS} ${OVERRIDE_NIXPKGS}"
1824

1925
currentver="$(nix eval --raw --expr builtins.nixVersion)"
2026
requiredver="2.14.1"

test/hpack/flake.nix

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
# pinning), we must specify revisions for *all* inputs to ensure
44
# reproducibility.
55
inputs = {
6-
nixpkgs.url = "github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7";
7-
flake-parts.url = "github:hercules-ci/flake-parts/7c7a8bce3dffe71203dcd4276504d1cb49dfe05f";
8-
9-
# We do not specify a value for this input, because it is explicitly
10-
# specified using --override-input to point to ../. For example,
11-
# `nix build --override-input haskell-flake ..`
6+
nixpkgs = { };
7+
flake-parts = { };
128
haskell-flake = { };
139
};
1410
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:

test/hpack/test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ set -euxo pipefail
33

44
# First, build the flake
55
logHeader "Testing nix build"
6-
nix build ${OVERRIDE_HASKELL_FLAKE}
6+
nix build ${OVERRIDE_ALL}
77
# Run the devshell test script in a nix develop shell.
88
logHeader "Testing nix devshell"
9-
nix develop ${OVERRIDE_HASKELL_FLAKE} -c echo
9+
nix develop ${OVERRIDE_ALL} -c echo

test/simple/flake.nix

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@
33
# pinning), we must specify revisions for *all* inputs to ensure
44
# reproducibility.
55
inputs = {
6-
nixpkgs.url = "github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7";
7-
flake-parts.url = "github:hercules-ci/flake-parts/7c7a8bce3dffe71203dcd4276504d1cb49dfe05f";
6+
nixpkgs = { };
7+
flake-parts = { };
8+
haskell-flake = { };
9+
810
check-flake.url = "github:srid/check-flake/48a17393ed4fcd523399d6602c283775b5127295";
911

1012
haskell-multi-nix.url = "github:srid/haskell-multi-nix/7aed736571714ec12105ec110358998d70d59e34";
1113
haskell-multi-nix.flake = false;
12-
13-
# We do not specify a value for this input, because it is explicitly
14-
# specified using --override-input to point to ../. For example,
15-
# `nix build --override-input haskell-flake ..`
16-
haskell-flake = { };
1714
};
1815
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
1916
flake-parts.lib.mkFlake { inherit inputs; } {

test/simple/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ set -euxo pipefail
33

44
# First, build the flake
55
logHeader "Testing nix build"
6-
nix build ${OVERRIDE_HASKELL_FLAKE}
6+
nix build ${OVERRIDE_ALL}
77
# Run the devshell test script in a nix develop shell.
88
logHeader "Testing nix devshell"
9-
nix develop ${OVERRIDE_HASKELL_FLAKE} -c ./test-in-devshell.sh
9+
nix develop ${OVERRIDE_ALL} -c ./test-in-devshell.sh
1010
# Test non-devshell features:
1111
# Checks
1212
logHeader "Testing nix flake checks"
1313
nix --option sandbox false \
14-
build ${OVERRIDE_HASKELL_FLAKE} -L .#check
14+
build ${OVERRIDE_ALL} -L .#check

test/with-subdir/flake.nix

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
# pinning), we must specify revisions for *all* inputs to ensure
44
# reproducibility.
55
inputs = {
6-
nixpkgs.url = "github:nixos/nixpkgs/bb31220cca6d044baa6dc2715b07497a2a7c4bc7";
7-
flake-parts.url = "github:hercules-ci/flake-parts/7c7a8bce3dffe71203dcd4276504d1cb49dfe05f";
8-
9-
# We do not specify a value for this input, because it is explicitly
10-
# specified using --override-input to point to ../. For example,
11-
# `nix build --override-input haskell-flake ..`
6+
nixpkgs = { };
7+
flake-parts = { };
128
haskell-flake = { };
139
};
1410
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
@@ -18,7 +14,7 @@
1814
inputs.haskell-flake.flakeModule
1915
];
2016
perSystem = { self', pkgs, ... }: {
21-
haskellProjects.default = {};
17+
haskellProjects.default = { };
2218
packages.default = self'.packages.haskell-flake-test;
2319
};
2420
};

test/with-subdir/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ trap cleanup EXIT
2020
logHeader "Testing source filtering"
2121

2222
function get_drv_path() {
23-
nix eval ${OVERRIDE_HASKELL_FLAKE} .#packages.$SYSTEM.default.drvPath
23+
nix eval ${OVERRIDE_ALL} .#packages.$SYSTEM.default.drvPath
2424
}
2525
baseline=$(get_drv_path)
2626

0 commit comments

Comments
 (0)