Skip to content

Commit 5cd15f0

Browse files
committed
Fix #1600: add end-2-end test of hix project initialization and flakes development shell
1 parent a94fc19 commit 5cd15f0

File tree

1 file changed

+36
-13
lines changed

1 file changed

+36
-13
lines changed

test/tests.sh

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ printf "*** Cleaning package build directories..." >& 2
2020
rm -rvf */cabal.project.local */.ghc.environment* */dist */dist-newstyle */.stack-work
2121
echo >& 2
2222

23-
alias nix="nix --accept-flake-config"
24-
2523
printf "*** Running the nix-build tests...\n" >& 2
2624
nix build $NIX_BUILD_ARGS \
27-
-I . -I .. \
28-
--option restrict-eval true \
29-
--option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
30-
--no-link --keep-going -f default.nix \
31-
--argstr compiler-nix-name $GHC \
32-
--arg CADerivationsEnabled $NIX_CA_DERIVATIONS
25+
--accept-flake-config \
26+
-I . -I .. \
27+
--option restrict-eval true \
28+
--option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \
29+
--no-link --keep-going -f default.nix \
30+
--argstr compiler-nix-name $GHC \
31+
--arg CADerivationsEnabled $NIX_CA_DERIVATIONS
3332
echo >& 2
3433

3534
printf "*** Running the unit tests... " >& 2
@@ -125,19 +124,43 @@ else
125124
fi
126125

127126
printf "*** Checking the maintainer scripts...\n" >& 2
128-
nix build $NIX_BUILD_ARGS --no-link --keep-going -f ../build.nix --argstr compiler-nix-name $GHC maintainer-scripts
127+
nix build $NIX_BUILD_ARGS \
128+
--accept-flake-config \
129+
--no-link \
130+
--keep-going \
131+
-f ../build.nix \
132+
--argstr compiler-nix-name $GHC \
133+
maintainer-scripts
129134
echo >& 2
130135

131136
printf "*** Checking that plan construction works with extra Hackages...\n" >& 2
132-
nix build $NIX_BUILD_ARGS --no-link \
133-
-f ./default.nix --argstr compiler-nix-name $GHC \
137+
nix build $NIX_BUILD_ARGS \
138+
--accept-flake-config \
139+
--no-link \
140+
-f ./default.nix \
141+
--argstr compiler-nix-name $GHC \
134142
extra-hackage.run.project.plan-nix
135143
echo >& 2
136144

137145
printf "*** Checking that package with extra Hackages can be build...\n" >& 2
138-
nix build $NIX_BUILD_ARGS --no-link \
139-
-f ./default.nix --argstr compiler-nix-name $GHC \
146+
nix build $NIX_BUILD_ARGS \
147+
--accept-flake-config \
148+
--no-link \
149+
-f ./default.nix \
150+
--argstr compiler-nix-name $GHC \
140151
extra-hackage.run.project.hsPkgs.external-package-user.components.exes.external-package-user
141152
echo >& 2
142153

154+
printf "*** End-2-end test of hix project initialization and flakes development shell ...\n" >& 2
155+
HASKELL_NIX=$(pwd)/..
156+
cd $(mktemp -d)
157+
nix-shell -p cabal-install --run "cabal update; cabal unpack hello"
158+
cd hello-*
159+
nix run $HASKELL_NIX#hix -- init
160+
nix develop \
161+
--override-input haskellNix $HASKELL_NIX \
162+
--accept-flake-config \
163+
-c "cabal build"
164+
echo >& 2
165+
143166
printf "\n*** Finished successfully\n" >& 2

0 commit comments

Comments
 (0)