2020-08-31 02:08:25 +03:00
|
|
|
# 'supportedSystems' restricts the set of systems that we will evaluate for. Useful when you're evaluating
|
|
|
|
# on a machine with e.g. no way to build the Darwin IFDs you need!
|
2020-03-25 14:20:58 +03:00
|
|
|
{ supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
|
|
|
|
, ifdLevel ? 3
|
|
|
|
# Whether or not we are evaluating in restricted mode. This is true in Hydra, but not in Hercules.
|
2020-06-02 02:44:03 +03:00
|
|
|
, restrictEval ? false
|
2021-08-06 06:54:39 +03:00
|
|
|
, checkMaterialization ? false
|
|
|
|
, pkgs ? (import ./. {}).pkgs }:
|
2020-06-02 02:44:03 +03:00
|
|
|
let
|
2021-08-06 06:54:39 +03:00
|
|
|
inherit (import ./ci-lib.nix { inherit pkgs; }) dimension platformFilterGeneric filterAttrsOnlyRecursive;
|
|
|
|
inherit (pkgs.haskell-nix) sources;
|
Overlays (#261)
The Overlays branch
This is a major reorganization in how haskell.nix is used, and marks our 1.0 release.
The branch doesn't build due to numerous issues that we believe to be with the CI
and not this branch. We expect only very minor adjustments prior to calling this the
official 1.0 release.
* Move iohk-nix patches into haskell.nix
This moves the customizations we did in iohk-nix
into haskell.nix via overlays and config.
Add bootPkgs logic
this moves the nuking of bootPkgs where it belongs. This should eventually still be
removed and replaced by a proper solution, that doesn't require the nuking of
bootPkgs.
Allow us to bootstrap binary ghcs and a cabal-install
With this we can do the following:
```
$ nix repl compiler/old-ghc-nix
nix-repl> :b (let pkgs = import <nixpkgs> {}; in with import ./. {}; import ./compiler/bootstrap/cabal-install.nix { inherit (pkgs) fetchurl stdenv zlib; inherit hackage
; ghc = ghc844; src = pkgs.fetchurl { url = "https://github.com/haskell/cabal/archive/Cabal-v3.0.0.0-rc3.tar.gz"; sha256 = "1zl2mgg8307ykq3v8nmafc6zdhhj1cw7w8ffpap16dsm6
5lbnx33"; }; })
```
which wile it may look daunting, will allow us to bootstrap a
cabal-install with a ghc. From that point onwards, we should be able to
build any hackage package via haskell.nix.
Pass through cabal-install version
Better threading of arguments.
Add bootstrap overlay
Allow alex + happy to be built
This still has a wart: we need nix-tools, and for that we use the ghc865 from
nixpkgs. Ideally we'd build nix-tools against a specific ghc, but then
we'd need a build expression for that.
Make ghcjs work
Building something like this:
```
nix build '(with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; }; (haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; })).components.exes.hello'
```
will now work. Assuming `nixpkgs` has been appropriately patched to support the `js-unknown-ghcjs` triple.
Also: this will need an additional `Cabal` patch, to make `Cabal` understand what it needs to do with: `dist/build/hello/hello: copyFile: does not exist (No such file or directory)`
It needs to learn that `dist/build/hello/hello.jsexe` is what it wants to copy and that that is a directory. Luckily we do have some code in Cabal already that does this for `.exe` on windows.
Build `js-unknown-ghcjs` packages with haskell.nix
Using the following expression:
```
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
let Cabal = buildPackages.haskell-nix.hackage-package {
name = "Cabal"; version = "2.4.1.0";
modules = [
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
];
}; in
(haskell-nix.hackage-package {
name = "hello"; version = "1.0.0.2";
modules = [
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
];}).components.exes.hello
```
in a `test.nix` file. And running
```
nix build -f ./test.nix
```
on it, will produce
```
./result
├── bin
│ └── hello.jsexe
│ ├── all.js
│ ├── all.js.externs
│ ├── index.html
│ ├── lib.js
│ ├── manifest.webapp
│ ├── out.frefs.js
│ ├── out.frefs.json
│ ├── out.js
│ ├── out.stats
│ ├── rts.js
│ └── runmain.js
└── share
└── doc
└── x86_64-linux-ghc-8.6.5
└── hello-1.0.0.2
└── LICENSE
6 directories, 12 files
```
2019-10-21 15:07:58 +03:00
|
|
|
nixpkgsVersions = {
|
2021-12-07 02:55:20 +03:00
|
|
|
"R2111" = "nixpkgs-2111";
|
2022-07-17 09:18:19 +03:00
|
|
|
"R2205" = "nixpkgs-2205";
|
2021-02-03 12:38:33 +03:00
|
|
|
"unstable" = "nixpkgs-unstable";
|
Overlays (#261)
The Overlays branch
This is a major reorganization in how haskell.nix is used, and marks our 1.0 release.
The branch doesn't build due to numerous issues that we believe to be with the CI
and not this branch. We expect only very minor adjustments prior to calling this the
official 1.0 release.
* Move iohk-nix patches into haskell.nix
This moves the customizations we did in iohk-nix
into haskell.nix via overlays and config.
Add bootPkgs logic
this moves the nuking of bootPkgs where it belongs. This should eventually still be
removed and replaced by a proper solution, that doesn't require the nuking of
bootPkgs.
Allow us to bootstrap binary ghcs and a cabal-install
With this we can do the following:
```
$ nix repl compiler/old-ghc-nix
nix-repl> :b (let pkgs = import <nixpkgs> {}; in with import ./. {}; import ./compiler/bootstrap/cabal-install.nix { inherit (pkgs) fetchurl stdenv zlib; inherit hackage
; ghc = ghc844; src = pkgs.fetchurl { url = "https://github.com/haskell/cabal/archive/Cabal-v3.0.0.0-rc3.tar.gz"; sha256 = "1zl2mgg8307ykq3v8nmafc6zdhhj1cw7w8ffpap16dsm6
5lbnx33"; }; })
```
which wile it may look daunting, will allow us to bootstrap a
cabal-install with a ghc. From that point onwards, we should be able to
build any hackage package via haskell.nix.
Pass through cabal-install version
Better threading of arguments.
Add bootstrap overlay
Allow alex + happy to be built
This still has a wart: we need nix-tools, and for that we use the ghc865 from
nixpkgs. Ideally we'd build nix-tools against a specific ghc, but then
we'd need a build expression for that.
Make ghcjs work
Building something like this:
```
nix build '(with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; }; (haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; })).components.exes.hello'
```
will now work. Assuming `nixpkgs` has been appropriately patched to support the `js-unknown-ghcjs` triple.
Also: this will need an additional `Cabal` patch, to make `Cabal` understand what it needs to do with: `dist/build/hello/hello: copyFile: does not exist (No such file or directory)`
It needs to learn that `dist/build/hello/hello.jsexe` is what it wants to copy and that that is a directory. Luckily we do have some code in Cabal already that does this for `.exe` on windows.
Build `js-unknown-ghcjs` packages with haskell.nix
Using the following expression:
```
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
let Cabal = buildPackages.haskell-nix.hackage-package {
name = "Cabal"; version = "2.4.1.0";
modules = [
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
];
}; in
(haskell-nix.hackage-package {
name = "hello"; version = "1.0.0.2";
modules = [
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
];}).components.exes.hello
```
in a `test.nix` file. And running
```
nix build -f ./test.nix
```
on it, will produce
```
./result
├── bin
│ └── hello.jsexe
│ ├── all.js
│ ├── all.js.externs
│ ├── index.html
│ ├── lib.js
│ ├── manifest.webapp
│ ├── out.frefs.js
│ ├── out.frefs.json
│ ├── out.js
│ ├── out.stats
│ ├── rts.js
│ └── runmain.js
└── share
└── doc
└── x86_64-linux-ghc-8.6.5
└── hello-1.0.0.2
└── LICENSE
6 directories, 12 files
```
2019-10-21 15:07:58 +03:00
|
|
|
};
|
2022-07-17 09:18:19 +03:00
|
|
|
haskellNix = import ./default.nix { inherit checkMaterialization; };
|
|
|
|
nixpkgsArgs = haskellNix.nixpkgsArgs // {
|
|
|
|
# Needed for dwarf tests
|
|
|
|
config = haskellNix.nixpkgsArgs.config // {
|
|
|
|
permittedInsecurePackages = ["libdwarf-20210528" "libdwarf-20181024" "dwarfdump-20181024"];
|
|
|
|
};
|
|
|
|
};
|
2020-08-14 15:34:32 +03:00
|
|
|
compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: runTests: {
|
|
|
|
inherit runTests;
|
|
|
|
}) (
|
|
|
|
# GHC version to cache and whether to run the tests against them.
|
|
|
|
# This list of GHC versions should include everything for which we
|
|
|
|
# have a ./materialized/ghcXXX directory containing the materialized
|
|
|
|
# cabal-install and nix-tools plans. When removing a ghc version
|
|
|
|
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
|
|
|
|
# Update supported-ghc-versions.md to reflect any changes made here.
|
2022-06-01 10:33:58 +03:00
|
|
|
nixpkgs.lib.optionalAttrs (nixpkgsName == "R2111") {
|
2021-06-02 05:40:24 +03:00
|
|
|
ghc865 = false;
|
2021-09-01 13:43:31 +03:00
|
|
|
ghc8107 = true;
|
2022-07-17 09:18:19 +03:00
|
|
|
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2205") {
|
|
|
|
ghc865 = false;
|
|
|
|
ghc8107 = true;
|
2021-02-03 12:38:33 +03:00
|
|
|
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "unstable") {
|
2021-06-02 05:40:24 +03:00
|
|
|
ghc865 = false;
|
2021-06-15 10:50:45 +03:00
|
|
|
ghc884 = false; # Native version is used to boot 9.0.1
|
2021-09-01 13:43:31 +03:00
|
|
|
ghc8107 = true;
|
2022-01-08 17:10:05 +03:00
|
|
|
ghc902 = true;
|
2022-07-31 12:41:50 +03:00
|
|
|
ghc924 = true;
|
2020-08-14 15:34:32 +03:00
|
|
|
});
|
2021-11-13 02:43:04 +03:00
|
|
|
systems = nixpkgsName: nixpkgs: compiler-nix-name: nixpkgs.lib.genAttrs (
|
2022-04-20 06:25:21 +03:00
|
|
|
nixpkgs.lib.filter (v:
|
2022-06-01 10:33:58 +03:00
|
|
|
# We have less x86_64-darwin build capacity so build fewer GhC versions
|
2022-04-20 06:25:21 +03:00
|
|
|
(v != "x86_64-darwin" || (
|
2022-06-01 10:33:58 +03:00
|
|
|
!__elem compiler-nix-name ["ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
|
2022-04-20 06:25:21 +03:00
|
|
|
&&
|
2022-06-01 10:33:58 +03:00
|
|
|
# aarch64-darwin requires ghc 8.10.7
|
2022-04-20 06:25:21 +03:00
|
|
|
(v != "aarch64-darwin" || (
|
2022-06-01 10:33:58 +03:00
|
|
|
!__elem compiler-nix-name ["ghc865" "ghc884" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]))
|
2022-05-19 11:21:16 +03:00
|
|
|
&&
|
|
|
|
# aarch64-linux requires ghc 8.8.4
|
|
|
|
(v != "aarch64-linux" || (
|
2022-06-01 10:33:58 +03:00
|
|
|
!__elem compiler-nix-name ["ghc865" "ghc8104" "ghc810420210212" "ghc8105" "ghc8106" "ghc901" "ghc921" "ghc922"]
|
2022-05-19 11:21:16 +03:00
|
|
|
))) supportedSystems) (v: v);
|
2020-07-08 13:54:01 +03:00
|
|
|
crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system:
|
2020-03-25 14:20:58 +03:00
|
|
|
# We need to use the actual nixpkgs version we're working with here, since the values
|
|
|
|
# of 'lib.systems.examples' are not understood between all versions
|
|
|
|
let lib = nixpkgs.lib;
|
2022-04-21 03:46:49 +03:00
|
|
|
in lib.optionalAttrs (nixpkgsName == "unstable"
|
2022-07-31 12:41:50 +03:00
|
|
|
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc865" "ghc884" "ghc8107"])
|
2022-04-21 03:46:49 +03:00
|
|
|
|| (system == "x86_64-darwin" && __elem compiler-nix-name ["ghc8107"]))) {
|
2020-11-17 12:22:53 +03:00
|
|
|
inherit (lib.systems.examples) ghcjs;
|
2022-06-01 10:33:58 +03:00
|
|
|
} // lib.optionalAttrs (nixpkgsName == "unstable"
|
2022-07-31 12:41:50 +03:00
|
|
|
&& ((system == "x86_64-linux" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc924"])
|
2022-06-01 10:33:58 +03:00
|
|
|
|| (system == "x86_64-darwin" && __elem compiler-nix-name []))) { # TODO add ghc versions when we have more darwin build capacity
|
2020-03-25 14:20:58 +03:00
|
|
|
inherit (lib.systems.examples) mingwW64;
|
2022-07-31 12:41:50 +03:00
|
|
|
} // lib.optionalAttrs (system == "x86_64-linux" && nixpkgsName == "unstable" && __elem compiler-nix-name ["ghc8107" "ghc902" "ghc922" "ghc923" "ghc924"]) {
|
2020-03-25 14:20:58 +03:00
|
|
|
# Musl cross only works on linux
|
|
|
|
# aarch64 cross only works on linux
|
|
|
|
inherit (lib.systems.examples) musl64 aarch64-multiplatform;
|
2020-03-20 10:52:34 +03:00
|
|
|
};
|
2021-03-28 11:03:20 +03:00
|
|
|
isDisabled = d: d.meta.disabled or false;
|
Overlays (#261)
The Overlays branch
This is a major reorganization in how haskell.nix is used, and marks our 1.0 release.
The branch doesn't build due to numerous issues that we believe to be with the CI
and not this branch. We expect only very minor adjustments prior to calling this the
official 1.0 release.
* Move iohk-nix patches into haskell.nix
This moves the customizations we did in iohk-nix
into haskell.nix via overlays and config.
Add bootPkgs logic
this moves the nuking of bootPkgs where it belongs. This should eventually still be
removed and replaced by a proper solution, that doesn't require the nuking of
bootPkgs.
Allow us to bootstrap binary ghcs and a cabal-install
With this we can do the following:
```
$ nix repl compiler/old-ghc-nix
nix-repl> :b (let pkgs = import <nixpkgs> {}; in with import ./. {}; import ./compiler/bootstrap/cabal-install.nix { inherit (pkgs) fetchurl stdenv zlib; inherit hackage
; ghc = ghc844; src = pkgs.fetchurl { url = "https://github.com/haskell/cabal/archive/Cabal-v3.0.0.0-rc3.tar.gz"; sha256 = "1zl2mgg8307ykq3v8nmafc6zdhhj1cw7w8ffpap16dsm6
5lbnx33"; }; })
```
which wile it may look daunting, will allow us to bootstrap a
cabal-install with a ghc. From that point onwards, we should be able to
build any hackage package via haskell.nix.
Pass through cabal-install version
Better threading of arguments.
Add bootstrap overlay
Allow alex + happy to be built
This still has a wart: we need nix-tools, and for that we use the ghc865 from
nixpkgs. Ideally we'd build nix-tools against a specific ghc, but then
we'd need a build expression for that.
Make ghcjs work
Building something like this:
```
nix build '(with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; }; (haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; })).components.exes.hello'
```
will now work. Assuming `nixpkgs` has been appropriately patched to support the `js-unknown-ghcjs` triple.
Also: this will need an additional `Cabal` patch, to make `Cabal` understand what it needs to do with: `dist/build/hello/hello: copyFile: does not exist (No such file or directory)`
It needs to learn that `dist/build/hello/hello.jsexe` is what it wants to copy and that that is a directory. Luckily we do have some code in Cabal already that does this for `.exe` on windows.
Build `js-unknown-ghcjs` packages with haskell.nix
Using the following expression:
```
with import ./. { nixpkgs = ../nixpkgs; nixpkgsArgs = { crossSystem = { config = "js-unknown-ghcjs"; }; }; };
let Cabal = buildPackages.haskell-nix.hackage-package {
name = "Cabal"; version = "2.4.1.0";
modules = [
{ packages.Cabal.patches = [ ./Cabal-install-folder.diff ]; }
];
}; in
(haskell-nix.hackage-package {
name = "hello"; version = "1.0.0.2";
modules = [
({config, ... }:{ packages.hello.package.setup-depends = [ Cabal ]; })
];}).components.exes.hello
```
in a `test.nix` file. And running
```
nix build -f ./test.nix
```
on it, will produce
```
./result
├── bin
│ └── hello.jsexe
│ ├── all.js
│ ├── all.js.externs
│ ├── index.html
│ ├── lib.js
│ ├── manifest.webapp
│ ├── out.frefs.js
│ ├── out.frefs.json
│ ├── out.js
│ ├── out.stats
│ ├── rts.js
│ └── runmain.js
└── share
└── doc
└── x86_64-linux-ghc-8.6.5
└── hello-1.0.0.2
└── LICENSE
6 directories, 12 files
```
2019-10-21 15:07:58 +03:00
|
|
|
in
|
2020-03-25 14:20:58 +03:00
|
|
|
dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
|
2020-03-31 04:12:40 +03:00
|
|
|
let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
|
2022-07-28 11:03:05 +03:00
|
|
|
evalPackages = import pinnedNixpkgsSrc nixpkgsArgs;
|
|
|
|
in dimension "GHC version" (compilerNixNames nixpkgsName evalPackages) (compiler-nix-name: {runTests}:
|
|
|
|
dimension "System" (systems nixpkgsName evalPackages compiler-nix-name) (systemName: system:
|
2020-06-02 02:44:03 +03:00
|
|
|
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
|
2022-07-28 11:03:05 +03:00
|
|
|
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
|
2020-06-02 02:44:03 +03:00
|
|
|
platformFilter = platformFilterGeneric pkgs system;
|
2021-01-06 06:44:43 +03:00
|
|
|
in filterAttrsOnlyRecursive (_: v: platformFilter v && !(isDisabled v)) ({
|
2020-06-02 02:44:03 +03:00
|
|
|
# Native builds
|
|
|
|
# TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
|
|
|
|
native = pkgs.recurseIntoAttrs ({
|
2020-08-14 15:34:32 +03:00
|
|
|
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
|
2020-07-08 13:54:01 +03:00
|
|
|
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
|
2020-08-14 15:34:32 +03:00
|
|
|
} // pkgs.lib.optionalAttrs runTests {
|
|
|
|
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
|
2020-06-02 02:44:03 +03:00
|
|
|
} // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
|
2021-03-04 10:10:58 +03:00
|
|
|
iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
|
2020-06-07 06:05:44 +03:00
|
|
|
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
|
2022-07-28 11:03:05 +03:00
|
|
|
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit evalPackages compiler-nix-name; }).getComponent "exe:hello";
|
2020-06-02 02:44:03 +03:00
|
|
|
});
|
2020-03-20 10:52:34 +03:00
|
|
|
}
|
2020-03-25 14:20:58 +03:00
|
|
|
//
|
2022-07-28 11:03:05 +03:00
|
|
|
dimension "Cross system" (crossSystems nixpkgsName evalPackages compiler-nix-name system) (crossSystemName: crossSystem:
|
2020-06-02 02:44:03 +03:00
|
|
|
# Cross builds
|
|
|
|
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
|
2022-07-28 11:03:05 +03:00
|
|
|
build = import ./build.nix { inherit pkgs evalPackages ifdLevel compiler-nix-name; };
|
2020-08-14 15:34:32 +03:00
|
|
|
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
|
|
|
|
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
|
|
|
|
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
|
|
|
|
# TODO: look into cross compiling ghc itself
|
|
|
|
# ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}";
|
|
|
|
# TODO: look into making tools work when cross compiling
|
|
|
|
# inherit (build) tools;
|
|
|
|
} // pkgs.lib.optionalAttrs (runTests && crossSystemName != "aarch64-multiplatform") {
|
|
|
|
# Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
|
|
|
|
inherit (build) tests;
|
2020-11-17 12:22:53 +03:00
|
|
|
}) // pkgs.lib.optionalAttrs (ifdLevel >= 2 && crossSystemName != "ghcjs") {
|
|
|
|
# GHCJS builds its own template haskell runner.
|
2021-03-04 10:10:58 +03:00
|
|
|
remote-iserv = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "remote-iserv:exe:remote-iserv";
|
|
|
|
iserv-proxy = pkgs.ghc-extra-projects."${compiler-nix-name}".getComponent "iserv-proxy:exe:iserv-proxy";
|
2020-06-02 02:44:03 +03:00
|
|
|
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
|
2021-03-04 10:10:58 +03:00
|
|
|
hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).getComponent "exe:hello";
|
2020-06-02 02:44:03 +03:00
|
|
|
})
|
2021-01-06 06:44:43 +03:00
|
|
|
))
|
2020-03-20 10:52:34 +03:00
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|