Skip to content

Commit e894bc2

Browse files
committed
Merge remote-tracking branch 'origin/master' into hkm/combined-derivations
2 parents 42d08a6 + d457723 commit e894bc2

File tree

10 files changed

+293
-171
lines changed

10 files changed

+293
-171
lines changed

.buildkite/pipeline.yml

Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,76 @@
11
steps:
2-
- label: 'Run tests with ghc8107'
3-
command: "./test/tests.sh ghc8107"
2+
- label: 'Run tests with ghc8107: Running the nix-build tests...'
3+
command: "./test/tests.sh ghc8107 nix-build"
4+
agents:
5+
system: x86_64-linux
6+
7+
- label: 'Run tests with ghc8107: Running the unit tests...'
8+
command: "./test/tests.sh ghc8107 unit-tests"
9+
agents:
10+
system: x86_64-linux
11+
12+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for runghc...'
13+
command: "./test/tests.sh ghc8107 runghc"
14+
agents:
15+
system: x86_64-linux
16+
17+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for cabal...'
18+
command: "./test/tests.sh ghc8107 cabal"
19+
agents:
20+
system: x86_64-linux
21+
22+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for cabal (doExactConfig component)...'
23+
command: "./test/tests.sh ghc8107 cabal-doExactConfig"
24+
agents:
25+
system: x86_64-linux
26+
27+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for a project with test-suite build-tools and benchmarks...'
28+
command: "./test/tests.sh ghc8107 tests-benchmarks"
29+
agents:
30+
system: x86_64-linux
31+
32+
- label: 'Run tests with ghc8107: Checking that a nix-shell works for a multi-target project...'
33+
command: "./test/tests.sh ghc8107 multi-target"
34+
agents:
35+
system: x86_64-linux
36+
37+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, multiple packages...'
38+
command: "./test/tests.sh ghc8107 shellFor-single-package"
39+
agents:
40+
system: x86_64-linux
41+
42+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, single package...y'
43+
command: "./test/tests.sh ghc8107 shellFor-multiple-package"
44+
agents:
45+
system: x86_64-linux
46+
47+
- label: 'Run tests with ghc8107: Checking shellFor works for a cabal project, single package...'
48+
command: "./test/tests.sh ghc8107 shellFor-hoogle"
49+
agents:
50+
system: x86_64-linux
51+
52+
- label: 'Run tests with ghc8107: Checking shellFor does not depend on given packages...y'
53+
command: "./test/tests.sh ghc8107 shellFor-not-depends"
54+
agents:
55+
system: x86_64-linux
56+
57+
- label: 'Run tests with ghc8107: Checking the maintainer scripts...y'
58+
command: "./test/tests.sh ghc8107 maintainer-scripts"
59+
agents:
60+
system: x86_64-linux
61+
62+
- label: 'Run tests with ghc8107: Checking that plan construction works with extra Hackages...'
63+
command: "./test/tests.sh ghc8107 plan-extra-hackages"
64+
agents:
65+
system: x86_64-linux
66+
67+
- label: 'Run tests with ghc8107: Checking that package with extra Hackages can be build...'
68+
command: "./test/tests.sh ghc8107 build-extra-hackages"
69+
agents:
70+
system: x86_64-linux
71+
72+
- label: 'Run tests with ghc8107: End-2-end test of hix project initialization and flakes development shell ...'
73+
command: "./test/tests.sh ghc8107 hix"
474
agents:
575
system: x86_64-linux
676

@@ -41,7 +111,7 @@ steps:
41111

42112
- label: 'Check that the haskell.nix roots do not require IFDs'
43113
command:
44-
- yes | nix build .#roots.x86_64-linux --option allow-import-from-derivation false
114+
- nix build .#roots.x86_64-linux --accept-flake-config --option allow-import-from-derivation false
45115
agents:
46116
system: x86_64-linux
47117

@@ -50,3 +120,10 @@ steps:
50120
- nix-instantiate release.nix -A required-unstable-ghc8107-x86_64-darwin-native --show-trace --builders ''
51121
agents:
52122
system: x86_64-linux
123+
124+
- label: 'Check hix -- run github:haskell/cabal/3.8#cabal-install:exe:cabal -- --version'
125+
command:
126+
- "HIX_DIR=$(mktemp -d) nix run .#hix --accept-flake-config -- run github:haskell/cabal/3.8#cabal-install:exe:cabal --accept-flake-config --override-input haskellNix . -- --version"
127+
agents:
128+
system: x86_64-linux
129+

docs/dev/nix-tools-pin.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
## How to update [`nix-tools`](https://github.com/input-output-hk/nix-tools)
22

33
1. Use niv to update the sources.json:
4-
54
```
6-
niv update nix-tools
5+
nix flake lock --update-input nix-tools
76
```
87

9-
108
2. If `nix-tools.cabal` or `plan-to-nix` have changed, check the
119
materialized files for each of the compiler nix name in
1210
`ls -d materialized/ghc*/nix-tools` with:
13-
1411
```
1512
nix-build scripts/check-compiler-materialization --argstr compiler-nix-name ghc884
1613
```

flake.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@
137137

138138
packages = ((self.internal.compat { inherit system; }).hix).apps;
139139

140-
devShells.${system}.default = with self.legacyPackages.${system};
140+
devShells.default = with self.legacyPackages.${system};
141141
mkShell {
142142
buildInputs = [
143143
nixUnstable

hix/default.nix

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ let
2727
dump-path|eval|log|path-info|search|show-derivation|sign-paths|verify|why-depends)
2828
nix $cmd -f ${hixProject} ${args} "$@"
2929
;;
30-
flake|build|develop|run)
30+
flake|build|develop|run|profile)
31+
# Put the flake files for remote URLs in $HOME/.hix by default
32+
HIX_DIR="''${HIX_DIR:-$HOME/.hix}"
3133
while(($#)); do
3234
arg=$1
3335
case $arg in
@@ -45,22 +47,26 @@ let
4547
;;
4648
github:*#*)
4749
SRC="''${arg%%#*}"
48-
args+=("path:${hixProject}#''${arg#*#}" --override-input src "$SRC")
49-
is_github=true
50+
FLAKE=$HIX_DIR/$SRC
51+
args+=("path:$FLAKE#''${arg#*#}" --override-input src "$SRC")
52+
has_input_src=true
5053
;;
5154
github:*)
5255
SRC="$arg"
53-
args+=("path:${hixProject}" --override-input src "$SRC")
54-
is_github=true
56+
FLAKE=$HIX_DIR/$SRC
57+
args+=("path:$FLAKE" --override-input src "$SRC")
58+
has_input_src=true
5559
;;
5660
*#*)
5761
SRC="''${arg%%#*}"
58-
args+=("path:$SRC/.hix-flake#''${arg#*#}" --override-input src "$SRC")
62+
FLAKE=$SRC/.hix-flake
63+
args+=("path:$FLAKE#''${arg#*#}" --override-input src "$SRC")
5964
has_input_src=true
6065
;;
6166
.*)
6267
SRC="$arg"
63-
args+=("path:$SRC/.hix-flake" --override-input src "$SRC")
68+
FLAKE=$SRC/.hix-flake
69+
args+=("path:$FLAKE" --override-input src "$SRC")
6470
has_input_src=true
6571
;;
6672
*)
@@ -69,27 +75,24 @@ let
6975
esac
7076
shift
7177
done
72-
if [ "$is_github" != true ]; then
73-
if [ "$has_input_src" != true ]; then
74-
SRC=.
75-
args+=("path:$SRC/.hix-flake" --override-input src "$SRC")
76-
fi
77-
# Make a temporary flake if we have not already
78-
if [ ! -d $SRC/.hix-flake ]; then
79-
mkdir $SRC/.hix-flake
80-
fi
81-
HIX_FLAKE="$(mktemp -d)/flake.nix"
82-
sed 's|EVAL_SYSTEM|${pkgs.stdenv.hostPlatform.system}|' < ${hixProject}/flake.nix > $HIX_FLAKE
83-
if ! cmp $HIX_FLAKE $SRC/.hix-flake/flake.nix &>/dev/null; then
84-
if [ -e $SRC/.hix-flake/flake.lock ]; then
85-
echo "Updating $SRC/.hix-flake/flake.nix and deleting old $SRC/.hix-flake/flake.lock"
86-
rm $SRC/.hix-flake/flake.lock
87-
else
88-
echo "Updating $SRC/.hix-flake/flake.nix"
89-
fi
90-
cp $HIX_FLAKE $SRC/.hix-flake/flake.nix
91-
chmod +w $SRC/.hix-flake/flake.nix
78+
if [ "$has_input_src" != true ]; then
79+
SRC=.
80+
FLAKE=$SRC/.hix-flake
81+
args+=("path:$FLAKE" --override-input src "$SRC")
82+
fi
83+
# Make a temporary flake if we have not already
84+
mkdir -p $FLAKE
85+
HIX_FLAKE="$(mktemp -d)/flake.nix"
86+
sed 's|EVAL_SYSTEM|${pkgs.stdenv.hostPlatform.system}|' < ${hixProject}/flake.nix > $HIX_FLAKE
87+
if ! cmp $HIX_FLAKE $FLAKE/flake.nix &>/dev/null; then
88+
if [ -e $FLAKE/flake.lock ]; then
89+
echo "Updating $FLAKE/flake.nix and deleting old $FLAKE/flake.lock"
90+
rm $FLAKE/flake.lock
91+
else
92+
echo "Updating $FLAKE/flake.nix"
9293
fi
94+
cp $HIX_FLAKE $FLAKE/flake.nix
95+
chmod +w $FLAKE/flake.nix
9396
fi
9497
nix $cmd "''${args[@]}"
9598
;;

hix/init/nix/hix.nix

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# name = "project-name";
33
compiler-nix-name = "ghc8107"; # Version of GHC to use
44

5-
crossPlatforms = p: pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 ([
6-
p.mingwW64
7-
p.ghcjs
8-
] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
9-
p.musl64
10-
]);
5+
# Cross compilation support:
6+
# crossPlatforms = p: pkgs.lib.optionals pkgs.stdenv.hostPlatform.isx86_64 ([
7+
# p.mingwW64
8+
# p.ghcjs
9+
# ] ++ pkgs.lib.optionals pkgs.stdenv.hostPlatform.isLinux [
10+
# p.musl64
11+
# ]);
1112

1213
# Tools to include in the development shell
1314
shell.tools.cabal = "latest";

mkdocs.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ pages:
2828
- 'Motivation': motivation.md
2929
- 'Architecture': architecture.md
3030
- 'Tutorials':
31-
- 'Getting Started': tutorials/getting-started.md
31+
- 'Getting started': tutorials/getting-started.md
3232
- 'Getting started with Flakes': tutorials/getting-started-flakes.md
33+
- 'Getting started with Hix': tutorials/getting-started-hix.md
3334
- 'Creating a development environment': tutorials/development.md
3435
- 'Sourcing files only part of git repository using cleanGit': tutorials/clean-git.md
3536
- 'Handling git repositories in projects': tutorials/source-repository-hashes.md
@@ -38,6 +39,8 @@ pages:
3839
- 'Materialization: Speeding up Nix evaluation': tutorials/materialization.md
3940
- 'Cross-compiling your project': tutorials/cross-compilation.md
4041
- 'Generating coverage information': tutorials/coverage.md
42+
- 'Build a specific package from Hackage or Stackage': tutorials/building-package-from-stackage-hackage.md
43+
- 'Content addressed derivations': tutorials/ca-derivations.md
4144
- 'Reference':
4245
- 'Supported GHC versions': reference/supported-ghc-versions.md
4346
- 'Command-line tools': reference/commands.md
@@ -49,11 +52,13 @@ pages:
4952
- 'Dev Notes':
5053
- 'Architecture': dev/dev-architecture.md
5154
- 'Installing nix-tools': dev/installing-nix-tools.md
55+
- 'How to update nix-tools': dev/nix-tools-pin.md
5256
- 'Manually generating Nix expressions': dev/manually-generating-nix-expressions.md
5357
- 'Maintainer Scripts': dev/maintainer-scripts.md
5458
- 'Nixpkgs Pin': dev/nixpkgs-pin.md
5559
- 'Removing withPackage wrapper': dev/removing-with-package-wrapper.md
5660
- 'Test Suite': dev/tests.md
5761
- 'Adding a new GHC version': dev/adding-new-ghc.md
5862
- 'Coverage': dev/coverage.md
63+
- 'Making changes to Hix': dev/hix.md
5964
- 'ChangeLog': changelog.md

overlays/haskell.nix

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -801,11 +801,10 @@ final: prev: {
801801

802802
# `project'` and `project` automatically select between `cabalProject`
803803
# and `stackProject` (when possible) by looking for `stack.yaml` or
804-
# `cabal.project` files. If both exist we can pass in one of:
804+
# `cabal.project` files. If both exist it uses the `cabal.project` file.
805+
# To override this pass in:
805806
# `projectFileName = "stack.yaml;"`
806-
# `projectFileName = "cabal.project";`
807-
# to let it know which to choose (or pick another name). If the
808-
# selected file ends in a `.yaml` it is assumed to be for `stackProject`.
807+
# If the selected file ends in a `.yaml` it is assumed to be for `stackProject`.
809808
# If neither `stack.yaml` nor `cabal.project` exist `cabalProject` is
810809
# used (as it will use a default `cabal.project`).
811810
project' = projectModule:
@@ -829,8 +828,8 @@ final: prev: {
829828
then projectFileName # Prefer the user selected project file name
830829
else
831830
if stackYamlExists && cabalProjectExists
832-
then throw ("haskell-nix.project : both `stack.yaml` and `cabal.project` files exist "
833-
+ "set `projectFileName = \"stack.yaml\";` or `projectFileName = \"cabal.project\";`")
831+
then __trace ("haskell-nix.project : both `stack.yaml` and `cabal.project` files exist. Using `cabal.project`. "
832+
+ "set `projectFileName = \"stack.yaml\";` to override this.`") "cabal.project"
834833
else
835834
if stackYamlExists
836835
then "stack.yaml" # stack needs a stack.yaml

scripts/update-external.nix

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,7 @@ in
3535
3636
cd ..
3737
38-
yes | nix --experimental-features 'nix-command flakes' flake lock --update-input ${name}
38+
nix flack lock --accept-flake-config \
39+
--experimental-features 'nix-command flakes' \
40+
--update-input ${name}
3941
''

test/nix.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)