File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
rules_haskell_tests/tests Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,32 @@ mkdir $workdir
15
15
cd $workdir
16
16
cp " $rules_haskell_dir /.bazelversion" .
17
17
18
+ function getattr_value() {
19
+ local nix_file=" $rules_haskell_dir /nixpkgs/default.nix"
20
+ while IFS=$' \t ;' read -r key eq value rest ; do
21
+ if [ " $key " == " $1 " ] && [ " $eq " == ' =' ]; then
22
+ value=" ${value% \" } "
23
+ value=" ${value# \" } "
24
+
25
+ echo " $value "
26
+ return
27
+ fi
28
+ done < " $nix_file "
29
+ echo " could not lookup ${1} in $nix_file " >&2
30
+ exit 1
31
+ }
32
+
33
+ function have() {
34
+ command -v " $1 " & > /dev/null
35
+ }
36
+
37
+ if have nix; then
38
+ NIXPKGS_REVISION=$( getattr_value " rev" )
39
+ NIXPKGS_HASH=$( nix hash to-sri " $( getattr_value " sha256" ) " )
40
+ fi
41
+
42
+ export NIXPKGS_REVISION NIXPKGS_HASH
43
+
18
44
# specify version for bazelisk via `USE_BAZEL_VERSION`, since it does not read the .bazelversion when there is no WORKSPACE file
19
45
USE_BAZEL_VERSION=$( cat .bazelversion )
20
46
export USE_BAZEL_VERSION
Original file line number Diff line number Diff line change 9
9
# we use the default version (currently "9.4.6").
10
10
GHC_VERSION=${GHC_VERSION:= " 9.4.6" }
11
11
12
+ NIXPKGS_REVISION=${NIXPKGS_REVISION:- nixos-24.05}
13
+
12
14
readonly MIN_BAZEL_MAJOR=6
13
15
readonly MIN_BAZEL_MINOR=0
14
16
328
330
# https://github.com/tweag/rules_nixpkgs/blob/master/README.md
329
331
nixpkgs_git_repository(
330
332
name = "nixpkgs",
331
- revision = "nixos-24.05",
333
+ revision = "${NIXPKGS_REVISION} ",${NIXPKGS_HASH: +
334
+ integrity = \" $NIXPKGS_HASH \" ,}
332
335
)
333
336
334
337
nixpkgs_cc_configure(
You can’t perform that action at this time.
0 commit comments