diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index b99b6b86e1..c9629f8176 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,6 +1,6 @@ steps: - - label: 'Run tests' - command: "./test/tests.sh" + - label: 'Run tests with ghc883' + command: "./test/tests.sh ghc883" agents: system: x86_64-linux @@ -14,9 +14,9 @@ steps: agents: system: x86_64-linux - - label: 'Check closure size' + - label: 'Check closure size with ghc883' command: - - nix-build build.nix -A maintainer-scripts.check-closure-size -o check-closure-size.sh + - nix-build build.nix -A maintainer-scripts.check-closure-size --argstr compiler-nix-name ghc883 -o check-closure-size.sh - echo "+++ Closure size (MB)" - ./check-closure-size.sh agents: @@ -36,5 +36,5 @@ steps: - label: 'Make sure non store paths like can be used as src' command: - - nix-build build.nix -A maintainer-scripts.check-path-support -o check-path-support.sh + - nix-build build.nix -A maintainer-scripts.check-path-support --argstr compiler-nix-name ghc883 -o check-path-support.sh - ./check-path-support.sh diff --git a/build.nix b/build.nix index de1e34bbd9..0828858cf8 100644 --- a/build.nix +++ b/build.nix @@ -5,10 +5,11 @@ let haskellNix = (import ./default.nix {}); in -{ nixpkgs ? haskellNix.sources.nixpkgs-default +{ nixpkgs ? haskellNix.sources.nixpkgs , nixpkgsArgs ? haskellNix.nixpkgsArgs , pkgs ? import nixpkgs nixpkgsArgs , ifdLevel ? 1000 +, compiler-nix-name ? throw "No `compiler-nix-name` passed to build.nix" }: let @@ -16,16 +17,14 @@ let buildHaskell = pkgs.buildPackages.haskell-nix; tool = buildHaskell.tool; in rec { - tests = import ./test/default.nix { inherit pkgs ifdLevel; }; + tests = import ./test/default.nix { inherit pkgs ifdLevel compiler-nix-name; }; tools = pkgs.lib.optionalAttrs (ifdLevel >= 3) ( pkgs.recurseIntoAttrs { - ghcide-020 = tool "ghcide" "0.2.0"; - } // pkgs.lib.optionalAttrs (buildHaskell.defaultCompilerNixName == "ghc865") { - cabal-30 = tool "cabal" "3.0.0.0"; - } // pkgs.lib.optionalAttrs (buildHaskell.defaultCompilerNixName != "ghc8101") { - cabal-32 = tool "cabal" "3.2.0.0"; - ghcide-object-code = tool "ghcide" "object-code"; + ghcide-020 = tool compiler-nix-name "ghcide" "0.2.0"; + cabal-32 = tool compiler-nix-name "cabal" "3.2.0.0"; + } // pkgs.lib.optionalAttrs (compiler-nix-name != "ghc8101") { + ghcide-object-code = tool compiler-nix-name "ghcide" "object-code"; } ); @@ -34,8 +33,21 @@ in rec { # as not all of them can work in restricted eval mode (as they # are not pure). maintainer-scripts = pkgs.dontRecurseIntoAttrs { - update-hackage = haskell.callPackage ./scripts/update-hackage.nix {}; - update-stackage = haskell.callPackage ./scripts/update-stackage.nix {}; + update-hackage = import ./scripts/update-hackage.nix { + inherit (pkgs) stdenv writeScript coreutils glibc git + openssh nix-prefetch-git gawk bash curl findutils; + # Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version) + nix-tools = haskell.internal-nix-tools; + cabal-install = haskell.internal-cabal-install; + inherit (haskell) update-index-state-hashes; + }; + update-stackage = haskell.callPackage ./scripts/update-stackage.nix { + inherit (pkgs) stdenv writeScript coreutils glibc git + openssh nix-prefetch-git gawk bash curl findutils; + # Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version) + nix-tools = haskell.internal-nix-tools; + cabal-install = haskell.internal-cabal-install; + }; update-pins = haskell.callPackage ./scripts/update-pins.nix {}; update-docs = pkgs.buildPackages.callPackage ./scripts/update-docs.nix { generatedOptions = pkgs.callPackage ./scripts/options-doc.nix { }; @@ -47,11 +59,10 @@ in rec { # use) check-hydra = pkgs.buildPackages.callPackage ./scripts/check-hydra.nix {}; check-closure-size = pkgs.buildPackages.callPackage ./scripts/check-closure-size.nix { - # Includes cabal-install and hpack since these are commonly used. + # Includes cabal-install since this is commonly used. nix-tools = pkgs.linkFarm "common-tools" [ - { name = "nix-tools"; path = haskell.nix-tools; } - { name = "cabal-install"; path = haskell.cabal-install; } - { name = "hpack"; path = haskell.haskellPackages.hpack.components.exes.hpack; } + { name = "nix-tools"; path = haskell.nix-tools.${compiler-nix-name}; } + { name = "cabal-install"; path = haskell.cabal-install.${compiler-nix-name}; } ]; }; check-materialization-concurrency = pkgs.buildPackages.callPackage ./scripts/check-materialization-concurrency/check.nix {}; diff --git a/builder/default.nix b/builder/default.nix index bfb9fee1f8..c9d29b6d38 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -1,4 +1,4 @@ -{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, fetchurl, pkgconfig, nonReinstallablePkgs, hsPkgs }: +{ pkgs, buildPackages, stdenv, lib, haskellLib, ghc, fetchurl, pkgconfig, nonReinstallablePkgs, hsPkgs, compiler }: let # Builds a single component of a package. @@ -44,7 +44,7 @@ let hoogleLocal = let nixpkgsHoogle = import (pkgs.path + /pkgs/development/haskell-modules/hoogle.nix); - in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool "hoogle" { + in { packages ? [], hoogle ? pkgs.buildPackages.haskell-nix.tool compiler.nix-name "hoogle" { version = "5.0.17.15"; index-state = pkgs.haskell-nix.internalHackageIndexState; } @@ -59,9 +59,8 @@ let # Same as haskellPackages.shellFor in nixpkgs. shellFor = haskellLib.weakCallPackage pkgs ./shell-for.nix { - inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib buildPackages; + inherit hsPkgs ghcForComponent makeConfigFiles hoogleLocal haskellLib buildPackages compiler; inherit (buildPackages) glibcLocales; - buildGHC = ghc.passthru.buildGHC or ghc; }; # Same as haskellPackages.ghcWithPackages and ghcWithHoogle in nixpkgs. diff --git a/builder/shell-for.nix b/builder/shell-for.nix index 6336103cd4..77863d6498 100644 --- a/builder/shell-for.nix +++ b/builder/shell-for.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, buildGHC }: +{ lib, stdenv, glibcLocales, pkgconfig, ghcForComponent, makeConfigFiles, hsPkgs, hoogleLocal, haskellLib, buildPackages, compiler }: { packages ? ps: let @@ -94,7 +94,7 @@ in nativeBuildInputs = [ ghcEnv ] ++ nativeBuildInputs ++ mkDrvArgs.nativeBuildInputs or [] - ++ lib.attrValues (buildPackages.haskell-nix.toolsForGhc buildGHC tools); + ++ lib.attrValues (buildPackages.haskell-nix.tools compiler.nix-name tools); phases = ["installPhase"]; installPhase = "echo $nativeBuildInputs $buildInputs > $out"; LANG = "en_US.UTF-8"; diff --git a/changelog.md b/changelog.md index ab377c55dc..8686a12eb9 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,28 @@ This file contains a summary of changes to Haskell.nix and `nix-tools` that will impact users. +## July 8, 2019 +* Removed `sources.nixpkgs-default`, use `sources.nixpkgs` instead. +* Removed `./nixpkgs` directory, use `(import ./. {}).sources` + or `./nix/sources.nix` instead. +* Removes V1 interface for details on how to fix old code see: + https://github.com/input-output-hk/haskell.nix/issues/709 +* Removed defaultCompilerNixName. +* cabalProject, cabalProject', hackage-project and hackage-package + now require a `compiler-nix-name` argument. +* `haskell-nix.tool` and `.tools` now require a `compiler-nix-name` argument. + New functions `p.tool` and `p.tools` (where p is a project) do not. + Like `shellFor { tools = ... }` they will use the compiler nix name + from the project (including stack projects where it is derived from + the resolver). +* `haskell-nix.alex` and `haskell-nix.happy` have been removed. Use + `p.tool "alex" "3.2.5"` or `shellFor { tools = { alex = "3.2.5"; } }`. +* `haskell-nix.nix-tools` -> `haskell-nix.nix-tools.ghc883` (it includes + the hpack exe now). +* `haskell-nix.cabal-install` -> + `p.tool "cabal" "3.2.0.0"` or `shellFor { tools = { cabal = "3.2.0.0"; } }` +* `haskell-nix.haskellNixRoots` -> `haskell-nix.roots ghc883` or `p.roots` + ## June 25, 2019 * Haddock docs are now built in their own derivation when needed (not as part of the component build). diff --git a/ci-lib.nix b/ci-lib.nix index 0d7795643c..4aa541cd5e 100644 --- a/ci-lib.nix +++ b/ci-lib.nix @@ -1,6 +1,6 @@ let # Generic nixpkgs, use *only* for lib functions that are stable across versions - pkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {}; + pkgs = import (import ./nix/sources.nix).nixpkgs {}; lib = pkgs.lib; in rec { inherit (import ./dimension.nix) dimension; diff --git a/ci.nix b/ci.nix index ac731cf85b..64de964bfe 100644 --- a/ci.nix +++ b/ci.nix @@ -12,8 +12,8 @@ "R1909" = "nixpkgs-1909"; "R2003" = "nixpkgs-2003"; }; - compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (defaultCompilerNixName: _: - (import ./default.nix { inherit checkMaterialization defaultCompilerNixName; }).nixpkgsArgs) ({ + compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: _: + (import ./default.nix { inherit checkMaterialization; }).nixpkgsArgs) ({ ghc865 = {}; } // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2003") { ghc883 = {}; @@ -24,11 +24,11 @@ linux = "x86_64-linux"; darwin = "x86_64-darwin"; }; - crossSystems = nixpkgsName: nixpkgs: compilerNixName: system: + crossSystems = nixpkgsName: nixpkgs: compiler-nix-name: system: # 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; - in lib.optionalAttrs (system == "x86_64-linux" && compilerNixName != "ghc8101") { + in lib.optionalAttrs (system == "x86_64-linux" && compiler-nix-name != "ghc8101") { # Windows cross compilation is currently broken on macOS inherit (lib.systems.examples) mingwW64; } // lib.optionalAttrs (system == "x86_64-linux") { @@ -41,32 +41,32 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin: let pinnedNixpkgsSrc = sources.${nixpkgs-pin}; # We need this for generic nixpkgs stuff at the right version genericPkgs = import pinnedNixpkgsSrc {}; - in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compilerNixName: nixpkgsArgs: + in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: nixpkgsArgs: dimension "System" (systems genericPkgs) (systemName: system: let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; }); - build = import ./build.nix { inherit pkgs ifdLevel; }; + build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; }; platformFilter = platformFilterGeneric pkgs system; in filterAttrsOnlyRecursive (_: v: platformFilter v) { # Native builds # TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native? native = pkgs.recurseIntoAttrs ({ inherit (build) tests tools maintainer-scripts maintainer-script-cache; - ghc = pkgs.buildPackages.haskell-nix.compiler."${compilerNixName}"; + ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}"; } // pkgs.lib.optionalAttrs (ifdLevel >= 1) { - iserv-proxy = pkgs.ghc-extra-packages."${compilerNixName}".iserv-proxy.components.exes.iserv-proxy; + iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy; } // pkgs.lib.optionalAttrs (ifdLevel >= 3) { - hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello; + hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).components.exes.hello; }); } // - dimension "Cross system" (crossSystems nixpkgsName genericPkgs compilerNixName system) (crossSystemName: crossSystem: + dimension "Cross system" (crossSystems nixpkgsName genericPkgs compiler-nix-name system) (crossSystemName: crossSystem: # Cross builds let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; }); - build = import ./build.nix { inherit pkgs ifdLevel; }; + build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; }; in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) { - ghc = pkgs.buildPackages.haskell-nix.compiler."${compilerNixName}"; + ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}"; # TODO: look into cross compiling ghc itself - # ghc = pkgs.haskell-nix.compiler."${compilerNixName}"; + # ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}"; # TODO: look into making tools work when cross compiling # inherit (build) tools; # Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513 @@ -75,13 +75,13 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin: then build.tests else pkgs.recurseIntoAttrs { # Even on aarch64 we still want to build the pinned files - inherit (build.tests) haskellNixRoots; + inherit (build.tests) roots; }; } // pkgs.lib.optionalAttrs (ifdLevel >= 2) { - remote-iserv = pkgs.ghc-extra-packages."${compilerNixName}".remote-iserv.components.exes.remote-iserv; - iserv-proxy = pkgs.ghc-extra-packages."${compilerNixName}".iserv-proxy.components.exes.iserv-proxy; + remote-iserv = pkgs.ghc-extra-packages."${compiler-nix-name}".remote-iserv.components.exes.remote-iserv; + iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy; } // pkgs.lib.optionalAttrs (ifdLevel >= 3) { - hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; }).components.exes.hello; + hello = (pkgs.haskell-nix.hackage-package { name = "hello"; version = "1.0.0.2"; inherit compiler-nix-name; }).components.exes.hello; }) ) ) diff --git a/default.nix b/default.nix index c351d71944..93f79cbf3b 100644 --- a/default.nix +++ b/default.nix @@ -1,56 +1,28 @@ -let haskellNix = { - checkMaterialization ? false, # Allows us to easily switch on materialization checking - defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883" - system ? builtins.currentSystem, - sourcesOverride ? {}, - ... }@args: rec { - sources = (import ./nix/sources.nix) // sourcesOverride; - - config = import ./config.nix; - overlays = [ allOverlays.combined ] ++ ( - if checkMaterialization == true - then [( - final: prev: { - haskell-nix = prev.haskell-nix // { - checkMaterialization = true; - }; - } - )] - else [] - ) ++ ( - if defaultCompilerNixName != null - then [( - final: prev: { - haskell-nix = prev.haskell-nix // { - inherit defaultCompilerNixName; - }; - } - )] - else [] - ); - allOverlays = import ./overlays args; - nixpkgsArgs = { inherit config overlays system; }; - pkgs = import sources.nixpkgs-default nixpkgsArgs; - }; - - v1DeprecationMessage = "Version 1 is deprecated: use version 2 (nixpkgs arguments are available as the `nixpkgsArgs` attribute of version 2)"; - haskellNixV1 = (haskellNix {}).nixpkgsArgs // { - overlays = builtins.trace v1DeprecationMessage (haskellNix {}).nixpkgsArgs.overlays; - }; - haskellNixV2 = haskellNix; - -# If no arguments, then you get V1 -in haskellNixV1 // { - __functor = _: { - version ? 2, - checkMaterialization ? false, # Allows us to easily switch on materialization checking - defaultCompilerNixName ? null, # Quick way to override the default compiler e.g. "ghc883" - system ? builtins.currentSystem, - sourcesOverride ? {}, - ... }@args: - if version == 1 - then haskellNixV1 - else if version == 2 - then haskellNixV2 args - else builtins.throw ("haskell.nix: unknown version: " + (builtins.toString version)); +{ checkMaterialization ? false # Allows us to easily switch on materialization checking +, system ? builtins.currentSystem +, sourcesOverride ? {} +, ... }@args: rec { + sources = (import ./nix/sources.nix) // sourcesOverride; + config = import ./config.nix; + overlays = [ allOverlays.combined ] ++ ( + if checkMaterialization == true + then [( + final: prev: { + haskell-nix = prev.haskell-nix // { + checkMaterialization = true; + }; + } + )] + else [] + ) ++ [( + final: prev: { + haskell-nix = prev.haskell-nix // { + inherit overlays; + sources = prev.haskell-nix.sources // sourcesOverride; + }; + } + )]; + allOverlays = import ./overlays args; + nixpkgsArgs = { inherit config overlays system; }; + pkgs = import sources.nixpkgs nixpkgsArgs; } diff --git a/docs/reference/library.md b/docs/reference/library.md index 2996b3dc1a..943e1fb1b1 100644 --- a/docs/reference/library.md +++ b/docs/reference/library.md @@ -266,19 +266,22 @@ needed for `importAndFilterProject`. })).pkgs; ``` -| Argument | Type | Description | -|------------------|------|---------------------| -| `name` | String | Optional name for better error messages. | -| `src` | Path | Location of the cabal project files. | -| `index-state` | Timestamp | Optional hackage index-state, eg. "2019-10-10T00:00:00Z". | -| `index-sha256` | Sha256 | Optional hash of the truncated hackage index-state. | -| `plan-sha256` | Sha256 | Optional hash of the plan-to-nix output (makes the plan-to-nix step a fixed output derivation). | -| `cabalProject` | Path | Optional cabal project file (defaults to "${src}/cabal.project"). | -| `ghc` | | Optional ghc to use | -| `nix-tools` | | Optional nix-tools to use | -| `hpack` | | Optional hpack to use | -| `cabal-install` | | Optional cabal-install to use | -| `configureArgs` | String | Optional extra arguments to pass to `cabal new-configure` (--enable-tests is included by default, include `--disable-tests` to override that). | +| Argument | Type | Description | +|----------------------|------|---------------------| +| `name` | String | Optional name for better error messages. | +| `src` | Path | Location of the cabal project files. | +| `compiler-nix-name` | String | The name of the ghc compiler to use eg. "ghc883" | +| `index-state` | Timestamp | Optional hackage index-state, eg. "2019-10-10T00:00:00Z". | +| `index-sha256` | Sha256 | Optional hash of the truncated hackage index-state. | +| `plan-sha256` | Sha256 | Optional hash of the plan-to-nix output (makes the plan-to-nix step a fixed output derivation). | +| `cabalProject` | String | Optional cabal project file contents (defaults to readFile "${src}/cabal.project"). | +| `cabalProjectLocal` | String | Optional cabal project file contents (defaults to readFile "${src}/cabal.project.local"). | +| `cabalProjectFreeze` | String | Optional cabal project file contents (defaults to readFile "${src}/cabal.project.freeze"). | +| `ghc` | | Deprecated. Use `compiler-nix-name` instead. Optional ghc to use | +| `nix-tools` | | Optional nix-tools to use | +| `hpack` | | Optional hpack to use | +| `cabal-install` | | Optional cabal-install to use | +| `configureArgs` | String | Optional extra arguments to pass to `cabal new-configure` (--enable-tests is included by default, include `--disable-tests` to override that). | ## importAndFilterProject diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 092ad15ae5..343fbd94a5 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -66,6 +66,7 @@ So this is expected, unfortunately. ### How do I prevent the evaluation-time dependencies of my project from being garbage-collected? -The `haskellNixRoots` attribute should include all the evaluation-time dependencies. +The `haskell-nix.roots "ghc883"` should include all the evaluation-time dependencies +and the main build time dependecies of a project using ghc 8.8.3. So you can add that to the relevant GC root. In practice, if you're using a CI system like Hydra/Hercules, this means adding it to a job in `release.nix`/`ci.nix`. diff --git a/docs/tutorials/getting-started.md b/docs/tutorials/getting-started.md index 555cee3119..94f4d02163 100644 --- a/docs/tutorials/getting-started.md +++ b/docs/tutorials/getting-started.md @@ -52,6 +52,8 @@ Add `default.nix`: name = "haskell-nix-project"; src = ./.; }; + # For `cabal.project` based projects specify the GHC version to use. + compiler-nix-name = "ghc883"; # Not used for `stack.yaml` based projects. } ``` diff --git a/docs/tutorials/materialization.md b/docs/tutorials/materialization.md index 3098ce1047..307cc79831 100644 --- a/docs/tutorials/materialization.md +++ b/docs/tutorials/materialization.md @@ -40,8 +40,9 @@ file that looks like this: ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.11"; }; @@ -64,8 +65,9 @@ inputs. For cabal projects this means we must specify the ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.11"; index-state = "2020-04-15T00:00:00Z"; @@ -92,8 +94,9 @@ stack projects) ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.11"; index-state = "2020-04-15T00:00:00Z"; @@ -121,8 +124,9 @@ To capture the nix we can do something like: ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.11"; index-state = "2020-04-15T00:00:00Z"; @@ -155,8 +159,9 @@ If we choose to add the `checkMaterialization` flag you would have: ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.10"; index-state = "2020-04-15T00:00:00Z"; @@ -199,8 +204,9 @@ For instance: ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlint = pkgs.haskell-nix.hackage-project { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.10"; index-state = "2020-04-15T00:00:00Z"; @@ -236,9 +242,10 @@ a non-existing path is now an error: ```nix let inherit (import ./. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; hlintPlan = /nix/store/kk047cqsjvbj4w8psv4l05abdcnyrqdc-hlint-plan-to-nix-pkgs; hlint = pkgs.haskell-nix.hackage-package { + compiler-nix-name = "ghc883"; name = "hlint"; version = "2.2.11"; index-state = "2020-04-15T00:00:00Z"; diff --git a/examples/cardano-sl-mingw32.nix b/examples/cardano-sl-mingw32.nix index 184746aa37..6dd0180d0a 100644 --- a/examples/cardano-sl-mingw32.nix +++ b/examples/cardano-sl-mingw32.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); + pkgs = import sources.nixpkgs (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all diff --git a/examples/cardano-sl.nix b/examples/cardano-sl.nix index 76016e7900..ed7cb43605 100644 --- a/examples/cardano-sl.nix +++ b/examples/cardano-sl.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; in (pkgs.haskell-nix.stackProject (import ./cardano-sl-args.nix)).cardano-sl.components.all diff --git a/examples/cardano-wallet-ghcjs.nix b/examples/cardano-wallet-ghcjs.nix index 2d1e2dd9e9..18d1e8fed9 100644 --- a/examples/cardano-wallet-ghcjs.nix +++ b/examples/cardano-wallet-ghcjs.nix @@ -1,5 +1,5 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "js-unknown-ghcjs"; }); + pkgs = import sources.nixpkgs (nixpkgsArgs // { crossSystem.config = "js-unknown-ghcjs"; }); Cabal = pkgs.buildPackages.haskell-nix.hackage-package { name = "Cabal"; version = "2.4.1.0"; modules = [ diff --git a/examples/cardano-wallet-mingw32.nix b/examples/cardano-wallet-mingw32.nix index a53dd02e2d..7ae77f0a0b 100644 --- a/examples/cardano-wallet-mingw32.nix +++ b/examples/cardano-wallet-mingw32.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); + pkgs = import sources.nixpkgs (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all diff --git a/examples/cardano-wallet-rpi.nix b/examples/cardano-wallet-rpi.nix index f5747cf4db..eb407628de 100644 --- a/examples/cardano-wallet-rpi.nix +++ b/examples/cardano-wallet-rpi.nix @@ -1,5 +1,5 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "armv6l-unknown-linux-gnueabihf"; }); + pkgs = import sources.nixpkgs (nixpkgsArgs // { crossSystem.config = "armv6l-unknown-linux-gnueabihf"; }); Cabal = pkgs.buildPackages.haskell-nix.hackage-package { name = "Cabal"; version = "2.4.1.0"; modules = [ diff --git a/examples/cardano-wallet.nix b/examples/cardano-wallet.nix index eb7363c9aa..b36579f27f 100644 --- a/examples/cardano-wallet.nix +++ b/examples/cardano-wallet.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; in (pkgs.haskell-nix.stackProject (import ./cardano-wallet-args.nix)).cardano-wallet.components.all diff --git a/examples/plutus-mingw32.nix b/examples/plutus-mingw32.nix index 0b3de52e45..67d9433add 100644 --- a/examples/plutus-mingw32.nix +++ b/examples/plutus-mingw32.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); + pkgs = import sources.nixpkgs (nixpkgsArgs // { crossSystem.config = "x86_64-pc-mingw32"; }); in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all diff --git a/examples/plutus.nix b/examples/plutus.nix index 6e4fd49200..c84dc2ead5 100644 --- a/examples/plutus.nix +++ b/examples/plutus.nix @@ -1,3 +1,3 @@ let inherit (import ../. {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; in (pkgs.haskell-nix.stackProject (import ./plutus-args.nix)).language-plutus-core.components.all diff --git a/flake.nix b/flake.nix index 3390c591e7..cf2865f1b1 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,7 @@ value = f name; }) lst); in genAttrs [ "x86_64-linux" "x86_64-darwin" ] (system: - import self.sources.nixpkgs-default + import self.sources.nixpkgs (self.nixpkgsArgs // { localSystem = { inherit system; }; })); }; } diff --git a/lib/cabal-licenses.nix b/lib/cabal-licenses.nix index a56cff3931..564c020ef0 100644 --- a/lib/cabal-licenses.nix +++ b/lib/cabal-licenses.nix @@ -12,6 +12,7 @@ lib: with lib.licenses; "AGPL-3.0-only" = agpl3; "AGPL-3.0-or-later" = agpl3Plus; "Apache-2.0" = asl20; + "GPL-2.0-or-later AND BSD-3-Clause" = [gpl2Plus bsd3]; # Generic LicenseRef-Apache = "Apache"; LicenseRef-GPL = "GPL"; diff --git a/lib/call-cabal-project-to-nix.nix b/lib/call-cabal-project-to-nix.nix index f4004cf11c..226ef39cb3 100644 --- a/lib/call-cabal-project-to-nix.nix +++ b/lib/call-cabal-project-to-nix.nix @@ -1,4 +1,4 @@ -{ dotCabal, pkgs, runCommand, nix-tools, cabal-install, ghc, hpack, symlinkJoin, cacert, index-state-hashes, haskellLib, materialize }@defaults: +{ dotCabal, pkgs, runCommand, evalPackages, symlinkJoin, cacert, index-state-hashes, haskellLib, materialize }@defaults: let readIfExists = src: fileName: let origSrcDir = src.origSrcSubDir or src; in @@ -8,6 +8,7 @@ let readIfExists = src: fileName: in { name ? src.name or null # optional name for better error messages , src +, compiler-nix-name # The name of the ghc compiler to use eg. "ghc883" , index-state ? null # Hackage index-state, eg. "2019-10-10T00:00:00Z" , index-sha256 ? null # The hash of the truncated hackage index-state , plan-sha256 ? null # The hash of the plan-to-nix output (makes the plan-to-nix step a fixed output derivation) @@ -17,12 +18,11 @@ in , cabalProject ? readIfExists src cabalProjectFileName , cabalProjectLocal ? readIfExists src "${cabalProjectFileName}.local" , cabalProjectFreeze ? readIfExists src "${cabalProjectFileName}.freeze" -, compiler-nix-name ? null # Nix name of the ghc compiler as a string eg. "ghc883" +, caller ? "callCabalProjectToNix" # Name of the calling funcion for better warning messages , ghc ? null # Deprecated in favour of `compiler-nix-name` , ghcOverride ? null # Used when we need to set ghc explicitly during bootstrapping -, nix-tools ? defaults.nix-tools -, hpack ? defaults.hpack -, cabal-install ? defaults.cabal-install +, nix-tools ? evalPackages.haskell-nix.nix-tools.${compiler-nix-name} # When building cabal projects we use the nix-tools +, cabal-install ? evalPackages.haskell-nix.cabal-install.${compiler-nix-name} # and cabal-install compiled with matching ghc version , configureArgs ? "" # Extra arguments to pass to `cabal v2-configure`. # `--enable-tests --enable-benchmarks` are included by default. # If the tests and benchmarks are not needed and they @@ -56,7 +56,6 @@ let + "pick the correct `ghc` package from the respective buildPackages. " + "For example use `compiler-nix-name = \"ghc865\";` for ghc 8.6.5") ghc else - if compiler-nix-name != null # Do note that `pkgs = final.buildPackages` in the `overlays/haskell.nix` # call to this file. And thus `pkgs` here is the proper `buildPackages` # set and we do not need, nor should pick the compiler from another level @@ -65,8 +64,7 @@ let # # > The option `packages.Win32.package.identifier.name' is used but not defined. # - then pkgs.haskell-nix.compiler."${compiler-nix-name}" - else defaults.ghc; + pkgs.haskell-nix.compiler."${compiler-nix-name}"; in assert (if ghc'.isHaskellNixCompiler or false then true @@ -386,7 +384,7 @@ let } // pkgs.lib.optionalAttrs (checkMaterialization != null) { inherit checkMaterialization; }) (pkgs.evalPackages.runCommand (if name == null then "plan-to-nix-pkgs" else name + "-plan-to-nix-pkgs") { - nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg hpack cabal-install pkgs.evalPackages.rsync ]; + nativeBuildInputs = [ nix-tools dummy-ghc dummy-ghc-pkg cabal-install pkgs.evalPackages.rsync ]; # Needed or stack-to-nix will die on unicode inputs LOCALE_ARCHIVE = pkgs.lib.optionalString (pkgs.stdenv.hostPlatform.libc == "glibc") "${pkgs.glibcLocales}/lib/locale/locale-archive"; LANG = "en_US.UTF-8"; diff --git a/lib/call-stack-to-nix.nix b/lib/call-stack-to-nix.nix index 748ce7a3e2..8ede83f9e6 100644 --- a/lib/call-stack-to-nix.nix +++ b/lib/call-stack-to-nix.nix @@ -5,7 +5,7 @@ * * see also `call-cabal-project-to-nix`! */ -{ runCommand, nix-tools, pkgs, mkCacheFile, materialize, haskellLib }: +{ runCommand, pkgs, mkCacheFile, materialize, haskellLib }: { name ? src.name or null # optional name for better error messages , src , stackYaml ? "stack.yaml" @@ -15,6 +15,7 @@ , resolverSha256 ? null , materialized ? null # Location of a materialized copy of the nix files , checkMaterialization ? null # If true the nix files will be generated used to check plan-sha256 and material +, nix-tools ? pkgs.haskell-nix.internal-nix-tools # When building stack projects we use the internal nix-tools (compiled with a fixed GHC version) , ... }: let inherit (haskellLib.fetchResolver { diff --git a/lib/stack-cache-generator.nix b/lib/stack-cache-generator.nix index b1a9174006..6d4664eed6 100644 --- a/lib/stack-cache-generator.nix +++ b/lib/stack-cache-generator.nix @@ -1,6 +1,6 @@ # Generate cache entries for dependencies of package defined in `src` -{ pkgs, haskellLib, nix-tools }: +{ pkgs, haskellLib }: { src , stackYaml ? "stack.yaml" , sha256map ? null @@ -14,6 +14,7 @@ then { location, tag, ...}: sha256map."${location}"."${tag}" else _: null , resolverSha256 ? null +, nix-tools ? pkgs.haskell-nix.internal-nix-tools # When building stack projects we use the internal nix-tools (compiled with a fixed GHC version) , ... }: let diff --git a/materialized/ghc8101/happy/.plan.nix/happy.nix b/materialized/bootstrap/ghc844/happy-1.19.12/.plan.nix/happy.nix similarity index 100% rename from materialized/ghc8101/happy/.plan.nix/happy.nix rename to materialized/bootstrap/ghc844/happy-1.19.12/.plan.nix/happy.nix diff --git a/materialized/ghc865/happy/default.nix b/materialized/bootstrap/ghc844/happy-1.19.12/default.nix similarity index 56% rename from materialized/ghc865/happy/default.nix rename to materialized/bootstrap/ghc844/happy-1.19.12/default.nix index 3c8efdd15a..ffa30c89fc 100644 --- a/materialized/ghc865/happy/default.nix +++ b/materialized/bootstrap/ghc844/happy-1.19.12/default.nix @@ -2,40 +2,40 @@ pkgs = hackage: { packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default; + "ghc-prim".revision = (((hackage."ghc-prim")."0.5.2.0").revisions).default; "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; "mtl".revision = (((hackage."mtl")."2.2.2").revisions).default; "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default; + "deepseq".revision = (((hackage."deepseq")."1.4.3.0").revisions).default; + "directory".revision = (((hackage."directory")."1.3.1.5").revisions).default; + "containers".revision = (((hackage."containers")."0.5.11.0").revisions).default; "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default; - "base".revision = (((hackage."base")."4.12.0.0").revisions).default; + "base".revision = (((hackage."base")."4.11.1.0").revisions).default; "time".revision = (((hackage."time")."1.8.0.2").revisions).default; - "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.5.0").revisions).default; - "array".revision = (((hackage."array")."0.5.3.0").revisions).default; + "transformers".revision = (((hackage."transformers")."0.5.5.0").revisions).default; + "filepath".revision = (((hackage."filepath")."1.4.2").revisions).default; + "process".revision = (((hackage."process")."1.6.3.0").revisions).default; + "array".revision = (((hackage."array")."0.5.2.0").revisions).default; "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default; }; compiler = { - version = "8.6.5"; - nix-name = "ghc865"; + version = "8.4.4"; + nix-name = "ghc844"; packages = { - "ghc-prim" = "0.5.3"; + "ghc-prim" = "0.5.2.0"; "unix" = "2.7.2.2"; "mtl" = "2.2.2"; "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.3.0"; - "containers" = "0.6.0.1"; + "deepseq" = "1.4.3.0"; + "directory" = "1.3.1.5"; + "containers" = "0.5.11.0"; "bytestring" = "0.10.8.2"; - "base" = "4.12.0.0"; + "base" = "4.11.1.0"; "time" = "1.8.0.2"; - "transformers" = "0.5.6.2"; - "filepath" = "1.4.2.1"; - "process" = "1.6.5.0"; - "array" = "0.5.3.0"; + "transformers" = "0.5.5.0"; + "filepath" = "1.4.2"; + "process" = "1.6.3.0"; + "array" = "0.5.2.0"; "integer-gmp" = "1.0.2.0"; }; }; diff --git a/materialized/ghc-extra-projects/cross/ghc865/.plan.nix/ghc.nix b/materialized/ghc-extra-projects/cross/ghc865/.plan.nix/ghc.nix index 33a43c6e1f..bf6facb9b4 100644 --- a/materialized/ghc-extra-projects/cross/ghc865/.plan.nix/ghc.nix +++ b/materialized/ghc-extra-projects/cross/ghc865/.plan.nix/ghc.nix @@ -14,6 +14,7 @@ stage1 = false; stage2 = true; stage3 = false; + dynamic-system-linker = true; }; package = { specVersion = "1.10"; diff --git a/materialized/ghc-extra-projects/cross/ghc865/default.nix b/materialized/ghc-extra-projects/cross/ghc865/default.nix index 81b71eda42..f477ad1436 100644 --- a/materialized/ghc-extra-projects/cross/ghc865/default.nix +++ b/materialized/ghc-extra-projects/cross/ghc865/default.nix @@ -73,6 +73,7 @@ "stage1" = lib.mkOverride 900 false; "stage2" = lib.mkOverride 900 true; "stage3" = lib.mkOverride 900 false; + "dynamic-system-linker" = lib.mkOverride 900 true; "ghci" = lib.mkOverride 900 true; "terminfo" = lib.mkOverride 900 true; }; diff --git a/materialized/ghc-extra-projects/default/ghc865/.plan.nix/ghc.nix b/materialized/ghc-extra-projects/default/ghc865/.plan.nix/ghc.nix index 33a43c6e1f..bf6facb9b4 100644 --- a/materialized/ghc-extra-projects/default/ghc865/.plan.nix/ghc.nix +++ b/materialized/ghc-extra-projects/default/ghc865/.plan.nix/ghc.nix @@ -14,6 +14,7 @@ stage1 = false; stage2 = true; stage3 = false; + dynamic-system-linker = true; }; package = { specVersion = "1.10"; diff --git a/materialized/ghc-extra-projects/default/ghc865/default.nix b/materialized/ghc-extra-projects/default/ghc865/default.nix index e7c8174b11..249cf49fc6 100644 --- a/materialized/ghc-extra-projects/default/ghc865/default.nix +++ b/materialized/ghc-extra-projects/default/ghc865/default.nix @@ -74,6 +74,7 @@ "stage1" = lib.mkOverride 900 false; "stage2" = lib.mkOverride 900 true; "stage3" = lib.mkOverride 900 false; + "dynamic-system-linker" = lib.mkOverride 900 true; "ghci" = lib.mkOverride 900 true; "terminfo" = lib.mkOverride 900 true; }; diff --git a/materialized/ghc-extra-projects/windows/ghc865/.plan.nix/ghc.nix b/materialized/ghc-extra-projects/windows/ghc865/.plan.nix/ghc.nix index 33a43c6e1f..bf6facb9b4 100644 --- a/materialized/ghc-extra-projects/windows/ghc865/.plan.nix/ghc.nix +++ b/materialized/ghc-extra-projects/windows/ghc865/.plan.nix/ghc.nix @@ -14,6 +14,7 @@ stage1 = false; stage2 = true; stage3 = false; + dynamic-system-linker = true; }; package = { specVersion = "1.10"; diff --git a/materialized/ghc-extra-projects/windows/ghc865/default.nix b/materialized/ghc-extra-projects/windows/ghc865/default.nix index 86912706f7..4f4f64bb0e 100644 --- a/materialized/ghc-extra-projects/windows/ghc865/default.nix +++ b/materialized/ghc-extra-projects/windows/ghc865/default.nix @@ -71,6 +71,7 @@ "stage1" = lib.mkOverride 900 false; "stage2" = lib.mkOverride 900 true; "stage3" = lib.mkOverride 900 false; + "dynamic-system-linker" = lib.mkOverride 900 true; "ghci" = lib.mkOverride 900 true; "terminfo" = lib.mkOverride 900 true; }; diff --git a/materialized/ghc8101/alex/.plan.nix/alex.nix b/materialized/ghc8101/alex/.plan.nix/alex.nix deleted file mode 100644 index abf25a360c..0000000000 --- a/materialized/ghc8101/alex/.plan.nix/alex.nix +++ /dev/null @@ -1,160 +0,0 @@ -{ system - , compiler - , flags - , pkgs - , hsPkgs - , pkgconfPkgs - , errorHandler - , config - , ... }: - { - flags = { small_base = true; }; - package = { - specVersion = "1.8"; - identifier = { name = "alex"; version = "3.2.5"; }; - license = "BSD-3-Clause"; - copyright = "(c) Chis Dornan, Simon Marlow"; - maintainer = "Simon Marlow "; - author = "Chris Dornan and Simon Marlow"; - homepage = "http://www.haskell.org/alex/"; - url = ""; - synopsis = "Alex is a tool for generating lexical analysers in Haskell"; - description = "Alex is a tool for generating lexical analysers in Haskell.\nIt takes a description of tokens based on regular\nexpressions and generates a Haskell module containing code\nfor scanning text efficiently. It is similar to the tool\nlex or flex for C/C++."; - buildType = "Simple"; - isLocal = true; - detailLevel = "FullDetails"; - licenseFiles = [ "LICENSE" ]; - dataDir = "data/"; - dataFiles = [ - "AlexTemplate" - "AlexTemplate-ghc" - "AlexTemplate-ghc-nopred" - "AlexTemplate-ghc-debug" - "AlexTemplate-debug" - "AlexWrapper-basic" - "AlexWrapper-basic-bytestring" - "AlexWrapper-strict-bytestring" - "AlexWrapper-posn" - "AlexWrapper-posn-bytestring" - "AlexWrapper-monad" - "AlexWrapper-monad-bytestring" - "AlexWrapper-monadUserState" - "AlexWrapper-monadUserState-bytestring" - "AlexWrapper-gscan" - ]; - extraSrcFiles = [ - "CHANGELOG.md" - "README.md" - "TODO" - "alex.spec" - "doc/Makefile" - "doc/aclocal.m4" - "doc/alex.1.in" - "doc/alex.xml" - "doc/config.mk.in" - "doc/configure.ac" - "doc/docbook-xml.mk" - "doc/fptools.css" - "examples/Makefile" - "examples/Tokens.x" - "examples/Tokens_gscan.x" - "examples/Tokens_posn.x" - "examples/examples.x" - "examples/haskell.x" - "examples/lit.x" - "examples/pp.x" - "examples/state.x" - "examples/tiny.y" - "examples/words.x" - "examples/words_monad.x" - "examples/words_posn.x" - "src/Parser.y.boot" - "src/Scan.x.boot" - "src/ghc_hooks.c" - "templates/GenericTemplate.hs" - "templates/wrappers.hs" - "tests/Makefile" - "tests/simple.x" - "tests/null.x" - "tests/tokens.x" - "tests/tokens_gscan.x" - "tests/tokens_posn.x" - "tests/tokens_bytestring.x" - "tests/tokens_posn_bytestring.x" - "tests/tokens_scan_user.x" - "tests/tokens_strict_bytestring.x" - "tests/tokens_monad_bytestring.x" - "tests/tokens_monadUserState_bytestring.x" - "tests/tokens_bytestring_unicode.x" - "tests/basic_typeclass.x" - "tests/basic_typeclass_bytestring.x" - "tests/default_typeclass.x" - "tests/gscan_typeclass.x" - "tests/posn_typeclass.x" - "tests/monad_typeclass.x" - "tests/monad_typeclass_bytestring.x" - "tests/monadUserState_typeclass.x" - "tests/monadUserState_typeclass_bytestring.x" - "tests/posn_typeclass_bytestring.x" - "tests/strict_typeclass.x" - "tests/unicode.x" - ]; - extraTmpFiles = []; - extraDocFiles = []; - }; - components = { - exes = { - "alex" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - ] ++ (if flags.small_base - then [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."array" or (errorHandler.buildDepError "array")) - (hsPkgs."containers" or (errorHandler.buildDepError "containers")) - (hsPkgs."directory" or (errorHandler.buildDepError "directory")) - ] - else [ (hsPkgs."base" or (errorHandler.buildDepError "base")) ]); - buildable = true; - modules = [ - "AbsSyn" - "CharSet" - "DFA" - "DFAMin" - "DFS" - "Info" - "Map" - "NFA" - "Output" - "Paths_alex" - "Parser" - "ParseMonad" - "Scan" - "Set" - "Sort" - "Util" - "UTF8" - "Data/Ranged" - "Data/Ranged/Boundaries" - "Data/Ranged/RangedSet" - "Data/Ranged/Ranges" - ]; - hsSourceDirs = [ "src" ]; - mainPath = [ "Main.hs" ] ++ [ "" ]; - }; - }; - tests = { - "tests" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."process" or (errorHandler.buildDepError "process")) - ]; - build-tools = [ - (hsPkgs.buildPackages.alex or (pkgs.buildPackages.alex or (errorHandler.buildToolDepError "alex"))) - ]; - buildable = true; - mainPath = [ "test.hs" ]; - }; - }; - }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file diff --git a/materialized/ghc8101/alex/default.nix b/materialized/ghc8101/alex/default.nix deleted file mode 100644 index 9780cefcdf..0000000000 --- a/materialized/ghc8101/alex/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - pkgs = hackage: - { - packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.6.1").revisions).default; - "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; - "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.6.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.2.1").revisions).default; - "bytestring".revision = (((hackage."bytestring")."0.10.10.0").revisions).default; - "base".revision = (((hackage."base")."4.14.0.0").revisions).default; - "time".revision = (((hackage."time")."1.9.3").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.8.2").revisions).default; - "array".revision = (((hackage."array")."0.5.4.0").revisions).default; - "integer-gmp".revision = (((hackage."integer-gmp")."1.0.3.0").revisions).default; - }; - compiler = { - version = "8.10.1"; - nix-name = "ghc8101"; - packages = { - "ghc-prim" = "0.6.1"; - "unix" = "2.7.2.2"; - "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.6.0"; - "containers" = "0.6.2.1"; - "bytestring" = "0.10.10.0"; - "base" = "4.14.0.0"; - "time" = "1.9.3"; - "filepath" = "1.4.2.1"; - "process" = "1.6.8.2"; - "array" = "0.5.4.0"; - "integer-gmp" = "1.0.3.0"; - }; - }; - }; - extras = hackage: - { packages = { alex = ./.plan.nix/alex.nix; }; }; - modules = [ - ({ lib, ... }: - { - packages = { - "alex" = { flags = { "small_base" = lib.mkOverride 900 true; }; }; - }; - }) - ]; - } \ No newline at end of file diff --git a/materialized/ghc8101/cabal-install/default.nix b/materialized/ghc8101/cabal-install/default.nix index 559e2c4045..80f6f06274 100644 --- a/materialized/ghc8101/cabal-install/default.nix +++ b/materialized/ghc8101/cabal-install/default.nix @@ -35,7 +35,7 @@ "bytestring".revision = (((hackage."bytestring")."0.10.10.0").revisions).default; "text".revision = (((hackage."text")."1.2.3.2").revisions).default; "Cabal".revision = (((hackage."Cabal")."3.2.0.0").revisions).default; - "base64-bytestring".revision = (((hackage."base64-bytestring")."1.1.0.0").revisions).default; + "base64-bytestring".revision = (((hackage."base64-bytestring")."1.0.0.3").revisions).default; "base".revision = (((hackage."base")."4.14.0.0").revisions).default; "time".revision = (((hackage."time")."1.9.3").revisions).default; "base16-bytestring".revision = (((hackage."base16-bytestring")."0.1.1.6").revisions).default; diff --git a/materialized/ghc8101/happy/default.nix b/materialized/ghc8101/happy/default.nix deleted file mode 100644 index 97d9b29960..0000000000 --- a/materialized/ghc8101/happy/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - pkgs = hackage: - { - packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.6.1").revisions).default; - "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; - "mtl".revision = (((hackage."mtl")."2.2.2").revisions).default; - "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.6.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.2.1").revisions).default; - "bytestring".revision = (((hackage."bytestring")."0.10.10.0").revisions).default; - "base".revision = (((hackage."base")."4.14.0.0").revisions).default; - "time".revision = (((hackage."time")."1.9.3").revisions).default; - "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.8.2").revisions).default; - "array".revision = (((hackage."array")."0.5.4.0").revisions).default; - "integer-gmp".revision = (((hackage."integer-gmp")."1.0.3.0").revisions).default; - }; - compiler = { - version = "8.10.1"; - nix-name = "ghc8101"; - packages = { - "ghc-prim" = "0.6.1"; - "unix" = "2.7.2.2"; - "mtl" = "2.2.2"; - "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.6.0"; - "containers" = "0.6.2.1"; - "bytestring" = "0.10.10.0"; - "base" = "4.14.0.0"; - "time" = "1.9.3"; - "transformers" = "0.5.6.2"; - "filepath" = "1.4.2.1"; - "process" = "1.6.8.2"; - "array" = "0.5.4.0"; - "integer-gmp" = "1.0.3.0"; - }; - }; - }; - extras = hackage: - { packages = { happy = ./.plan.nix/happy.nix; }; }; - modules = [ - ({ lib, ... }: - { - packages = { - "happy" = { flags = { "small_base" = lib.mkOverride 900 true; }; }; - }; - }) - ]; - } \ No newline at end of file diff --git a/materialized/ghc865/alex/.plan.nix/alex.nix b/materialized/ghc865/alex/.plan.nix/alex.nix deleted file mode 100644 index abf25a360c..0000000000 --- a/materialized/ghc865/alex/.plan.nix/alex.nix +++ /dev/null @@ -1,160 +0,0 @@ -{ system - , compiler - , flags - , pkgs - , hsPkgs - , pkgconfPkgs - , errorHandler - , config - , ... }: - { - flags = { small_base = true; }; - package = { - specVersion = "1.8"; - identifier = { name = "alex"; version = "3.2.5"; }; - license = "BSD-3-Clause"; - copyright = "(c) Chis Dornan, Simon Marlow"; - maintainer = "Simon Marlow "; - author = "Chris Dornan and Simon Marlow"; - homepage = "http://www.haskell.org/alex/"; - url = ""; - synopsis = "Alex is a tool for generating lexical analysers in Haskell"; - description = "Alex is a tool for generating lexical analysers in Haskell.\nIt takes a description of tokens based on regular\nexpressions and generates a Haskell module containing code\nfor scanning text efficiently. It is similar to the tool\nlex or flex for C/C++."; - buildType = "Simple"; - isLocal = true; - detailLevel = "FullDetails"; - licenseFiles = [ "LICENSE" ]; - dataDir = "data/"; - dataFiles = [ - "AlexTemplate" - "AlexTemplate-ghc" - "AlexTemplate-ghc-nopred" - "AlexTemplate-ghc-debug" - "AlexTemplate-debug" - "AlexWrapper-basic" - "AlexWrapper-basic-bytestring" - "AlexWrapper-strict-bytestring" - "AlexWrapper-posn" - "AlexWrapper-posn-bytestring" - "AlexWrapper-monad" - "AlexWrapper-monad-bytestring" - "AlexWrapper-monadUserState" - "AlexWrapper-monadUserState-bytestring" - "AlexWrapper-gscan" - ]; - extraSrcFiles = [ - "CHANGELOG.md" - "README.md" - "TODO" - "alex.spec" - "doc/Makefile" - "doc/aclocal.m4" - "doc/alex.1.in" - "doc/alex.xml" - "doc/config.mk.in" - "doc/configure.ac" - "doc/docbook-xml.mk" - "doc/fptools.css" - "examples/Makefile" - "examples/Tokens.x" - "examples/Tokens_gscan.x" - "examples/Tokens_posn.x" - "examples/examples.x" - "examples/haskell.x" - "examples/lit.x" - "examples/pp.x" - "examples/state.x" - "examples/tiny.y" - "examples/words.x" - "examples/words_monad.x" - "examples/words_posn.x" - "src/Parser.y.boot" - "src/Scan.x.boot" - "src/ghc_hooks.c" - "templates/GenericTemplate.hs" - "templates/wrappers.hs" - "tests/Makefile" - "tests/simple.x" - "tests/null.x" - "tests/tokens.x" - "tests/tokens_gscan.x" - "tests/tokens_posn.x" - "tests/tokens_bytestring.x" - "tests/tokens_posn_bytestring.x" - "tests/tokens_scan_user.x" - "tests/tokens_strict_bytestring.x" - "tests/tokens_monad_bytestring.x" - "tests/tokens_monadUserState_bytestring.x" - "tests/tokens_bytestring_unicode.x" - "tests/basic_typeclass.x" - "tests/basic_typeclass_bytestring.x" - "tests/default_typeclass.x" - "tests/gscan_typeclass.x" - "tests/posn_typeclass.x" - "tests/monad_typeclass.x" - "tests/monad_typeclass_bytestring.x" - "tests/monadUserState_typeclass.x" - "tests/monadUserState_typeclass_bytestring.x" - "tests/posn_typeclass_bytestring.x" - "tests/strict_typeclass.x" - "tests/unicode.x" - ]; - extraTmpFiles = []; - extraDocFiles = []; - }; - components = { - exes = { - "alex" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - ] ++ (if flags.small_base - then [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."array" or (errorHandler.buildDepError "array")) - (hsPkgs."containers" or (errorHandler.buildDepError "containers")) - (hsPkgs."directory" or (errorHandler.buildDepError "directory")) - ] - else [ (hsPkgs."base" or (errorHandler.buildDepError "base")) ]); - buildable = true; - modules = [ - "AbsSyn" - "CharSet" - "DFA" - "DFAMin" - "DFS" - "Info" - "Map" - "NFA" - "Output" - "Paths_alex" - "Parser" - "ParseMonad" - "Scan" - "Set" - "Sort" - "Util" - "UTF8" - "Data/Ranged" - "Data/Ranged/Boundaries" - "Data/Ranged/RangedSet" - "Data/Ranged/Ranges" - ]; - hsSourceDirs = [ "src" ]; - mainPath = [ "Main.hs" ] ++ [ "" ]; - }; - }; - tests = { - "tests" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."process" or (errorHandler.buildDepError "process")) - ]; - build-tools = [ - (hsPkgs.buildPackages.alex or (pkgs.buildPackages.alex or (errorHandler.buildToolDepError "alex"))) - ]; - buildable = true; - mainPath = [ "test.hs" ]; - }; - }; - }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file diff --git a/materialized/ghc865/alex/default.nix b/materialized/ghc865/alex/default.nix deleted file mode 100644 index 2f68e39d74..0000000000 --- a/materialized/ghc865/alex/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - pkgs = hackage: - { - packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default; - "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; - "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.3.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.0.1").revisions).default; - "bytestring".revision = (((hackage."bytestring")."0.10.8.2").revisions).default; - "base".revision = (((hackage."base")."4.12.0.0").revisions).default; - "time".revision = (((hackage."time")."1.8.0.2").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.5.0").revisions).default; - "array".revision = (((hackage."array")."0.5.3.0").revisions).default; - "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default; - }; - compiler = { - version = "8.6.5"; - nix-name = "ghc865"; - packages = { - "ghc-prim" = "0.5.3"; - "unix" = "2.7.2.2"; - "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.3.0"; - "containers" = "0.6.0.1"; - "bytestring" = "0.10.8.2"; - "base" = "4.12.0.0"; - "time" = "1.8.0.2"; - "filepath" = "1.4.2.1"; - "process" = "1.6.5.0"; - "array" = "0.5.3.0"; - "integer-gmp" = "1.0.2.0"; - }; - }; - }; - extras = hackage: - { packages = { alex = ./.plan.nix/alex.nix; }; }; - modules = [ - ({ lib, ... }: - { - packages = { - "alex" = { flags = { "small_base" = lib.mkOverride 900 true; }; }; - }; - }) - ]; - } \ No newline at end of file diff --git a/materialized/ghc865/happy/.plan.nix/happy.nix b/materialized/ghc865/happy/.plan.nix/happy.nix deleted file mode 100644 index b5455c571d..0000000000 --- a/materialized/ghc865/happy/.plan.nix/happy.nix +++ /dev/null @@ -1,200 +0,0 @@ -{ system - , compiler - , flags - , pkgs - , hsPkgs - , pkgconfPkgs - , errorHandler - , config - , ... }: - { - flags = { small_base = true; }; - package = { - specVersion = "1.8"; - identifier = { name = "happy"; version = "1.19.12"; }; - license = "BSD-2-Clause"; - copyright = "(c) Andy Gill, Simon Marlow"; - maintainer = "Simon Marlow "; - author = "Andy Gill and Simon Marlow"; - homepage = "https://www.haskell.org/happy/"; - url = ""; - synopsis = "Happy is a parser generator for Haskell"; - description = "Happy is a parser generator for Haskell. Given a grammar\nspecification in BNF, Happy generates Haskell code to parse the\ngrammar. Happy works in a similar way to the @yacc@ tool for C."; - buildType = "Simple"; - isLocal = true; - detailLevel = "FullDetails"; - licenseFiles = [ "LICENSE" ]; - dataDir = "data/"; - dataFiles = [ - "HappyTemplate" - "HappyTemplate-arrays" - "HappyTemplate-arrays-coerce" - "HappyTemplate-arrays-coerce-debug" - "HappyTemplate-arrays-debug" - "HappyTemplate-arrays-ghc" - "HappyTemplate-arrays-ghc-debug" - "HappyTemplate-coerce" - "HappyTemplate-ghc" - "GLR_Base" - "GLR_Lib" - "GLR_Lib-ghc" - "GLR_Lib-ghc-debug" - ]; - extraSrcFiles = [ - "ANNOUNCE" - "CHANGES" - "Makefile" - "README.md" - "TODO" - "doc/Makefile" - "doc/aclocal.m4" - "doc/config.mk.in" - "doc/configure.ac" - "doc/docbook-xml.mk" - "doc/fptools.css" - "doc/happy.1.in" - "doc/happy.xml" - "examples/glr/nlp/Main.lhs" - "examples/glr/nlp/Makefile" - "examples/glr/nlp/README" - "examples/glr/nlp/English.y" - "examples/glr/nlp/Hugs.lhs" - "examples/glr/Makefile" - "examples/glr/Makefile.defs" - "examples/glr/expr-eval/Main.lhs" - "examples/glr/expr-eval/Makefile" - "examples/glr/expr-eval/Expr.y" - "examples/glr/expr-eval/README" - "examples/glr/expr-eval/Hugs.lhs" - "examples/glr/expr-tree/Main.lhs" - "examples/glr/expr-tree/Makefile" - "examples/glr/expr-tree/Expr.y" - "examples/glr/expr-tree/README" - "examples/glr/expr-tree/Tree.lhs" - "examples/glr/expr-tree/Hugs.lhs" - "examples/glr/highly-ambiguous/Main.lhs" - "examples/glr/highly-ambiguous/Makefile" - "examples/glr/highly-ambiguous/Expr.y" - "examples/glr/highly-ambiguous/README" - "examples/glr/highly-ambiguous/Hugs.lhs" - "examples/glr/hidden-leftrec/Main.lhs" - "examples/glr/hidden-leftrec/Makefile" - "examples/glr/hidden-leftrec/Expr.y" - "examples/glr/hidden-leftrec/README" - "examples/glr/hidden-leftrec/Hugs.lhs" - "examples/glr/expr-monad/Main.lhs" - "examples/glr/expr-monad/Makefile" - "examples/glr/expr-monad/Expr.y" - "examples/glr/expr-monad/README" - "examples/glr/expr-monad/Hugs.lhs" - "examples/glr/bio-eg/Main.lhs" - "examples/glr/bio-eg/Makefile" - "examples/glr/bio-eg/Bio.y" - "examples/glr/bio-eg/README" - "examples/glr/bio-eg/1-1200.dna" - "examples/glr/bio-eg/1-600.dna" - "examples/glr/common/DV_lhs" - "examples/glr/common/DaVinciTypes.hs" - "examples/glr/packing/Main.lhs" - "examples/glr/packing/Makefile" - "examples/glr/packing/Expr.y" - "examples/glr/packing/README" - "examples/glr/packing/Hugs.lhs" - "examples/PgnParser.ly" - "examples/MonadTest.ly" - "examples/igloo/ParserM.hs" - "examples/igloo/Makefile" - "examples/igloo/Parser.y" - "examples/igloo/Foo.hs" - "examples/igloo/README" - "examples/igloo/Lexer.x" - "examples/README" - "examples/Calc.ly" - "examples/DavesExample.ly" - "examples/ErrorTest.ly" - "examples/ErlParser.ly" - "examples/SimonsExample.ly" - "examples/LexerTest.ly" - "happy.spec" - "src/ARRAY-NOTES" - "tests/AttrGrammar001.y" - "tests/AttrGrammar002.y" - "tests/Makefile" - "tests/Partial.ly" - "tests/Test.ly" - "tests/TestMulti.ly" - "tests/TestPrecedence.ly" - "tests/bogus-token.y" - "tests/bug001.ly" - "tests/bug002.y" - "tests/error001.stderr" - "tests/error001.stdout" - "tests/error001.y" - "tests/monad001.y" - "tests/monad002.ly" - "tests/monaderror.y" - "tests/precedence001.ly" - "tests/precedence002.y" - "tests/test_rules.y" - "tests/issue91.y" - "tests/issue93.y" - "tests/issue94.y" - "tests/issue95.y" - "tests/monaderror-explist.y" - "tests/typeclass_monad001.y" - "tests/typeclass_monad002.ly" - "tests/typeclass_monad_lexer.y" - "tests/rank2.y" - ]; - extraTmpFiles = []; - extraDocFiles = []; - }; - components = { - exes = { - "happy" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."array" or (errorHandler.buildDepError "array")) - (hsPkgs."containers" or (errorHandler.buildDepError "containers")) - (hsPkgs."mtl" or (errorHandler.buildDepError "mtl")) - ]; - buildable = true; - modules = [ - "Paths_happy" - "AbsSyn" - "First" - "GenUtils" - "Grammar" - "Info" - "LALR" - "Lexer" - "ParseMonad" - "Parser" - "ProduceCode" - "ProduceGLRCode" - "NameSet" - "Target" - "AttrGrammar" - "AttrGrammarParser" - "ParamRules" - "PrettyGrammar" - ]; - hsSourceDirs = [ "src" ]; - mainPath = [ "Main.lhs" ]; - }; - }; - tests = { - "tests" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."process" or (errorHandler.buildDepError "process")) - ]; - build-tools = [ - (hsPkgs.buildPackages.happy or (pkgs.buildPackages.happy or (errorHandler.buildToolDepError "happy"))) - ]; - buildable = true; - mainPath = [ "test.hs" ]; - }; - }; - }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file diff --git a/materialized/ghc883/alex/.plan.nix/alex.nix b/materialized/ghc883/alex/.plan.nix/alex.nix deleted file mode 100644 index abf25a360c..0000000000 --- a/materialized/ghc883/alex/.plan.nix/alex.nix +++ /dev/null @@ -1,160 +0,0 @@ -{ system - , compiler - , flags - , pkgs - , hsPkgs - , pkgconfPkgs - , errorHandler - , config - , ... }: - { - flags = { small_base = true; }; - package = { - specVersion = "1.8"; - identifier = { name = "alex"; version = "3.2.5"; }; - license = "BSD-3-Clause"; - copyright = "(c) Chis Dornan, Simon Marlow"; - maintainer = "Simon Marlow "; - author = "Chris Dornan and Simon Marlow"; - homepage = "http://www.haskell.org/alex/"; - url = ""; - synopsis = "Alex is a tool for generating lexical analysers in Haskell"; - description = "Alex is a tool for generating lexical analysers in Haskell.\nIt takes a description of tokens based on regular\nexpressions and generates a Haskell module containing code\nfor scanning text efficiently. It is similar to the tool\nlex or flex for C/C++."; - buildType = "Simple"; - isLocal = true; - detailLevel = "FullDetails"; - licenseFiles = [ "LICENSE" ]; - dataDir = "data/"; - dataFiles = [ - "AlexTemplate" - "AlexTemplate-ghc" - "AlexTemplate-ghc-nopred" - "AlexTemplate-ghc-debug" - "AlexTemplate-debug" - "AlexWrapper-basic" - "AlexWrapper-basic-bytestring" - "AlexWrapper-strict-bytestring" - "AlexWrapper-posn" - "AlexWrapper-posn-bytestring" - "AlexWrapper-monad" - "AlexWrapper-monad-bytestring" - "AlexWrapper-monadUserState" - "AlexWrapper-monadUserState-bytestring" - "AlexWrapper-gscan" - ]; - extraSrcFiles = [ - "CHANGELOG.md" - "README.md" - "TODO" - "alex.spec" - "doc/Makefile" - "doc/aclocal.m4" - "doc/alex.1.in" - "doc/alex.xml" - "doc/config.mk.in" - "doc/configure.ac" - "doc/docbook-xml.mk" - "doc/fptools.css" - "examples/Makefile" - "examples/Tokens.x" - "examples/Tokens_gscan.x" - "examples/Tokens_posn.x" - "examples/examples.x" - "examples/haskell.x" - "examples/lit.x" - "examples/pp.x" - "examples/state.x" - "examples/tiny.y" - "examples/words.x" - "examples/words_monad.x" - "examples/words_posn.x" - "src/Parser.y.boot" - "src/Scan.x.boot" - "src/ghc_hooks.c" - "templates/GenericTemplate.hs" - "templates/wrappers.hs" - "tests/Makefile" - "tests/simple.x" - "tests/null.x" - "tests/tokens.x" - "tests/tokens_gscan.x" - "tests/tokens_posn.x" - "tests/tokens_bytestring.x" - "tests/tokens_posn_bytestring.x" - "tests/tokens_scan_user.x" - "tests/tokens_strict_bytestring.x" - "tests/tokens_monad_bytestring.x" - "tests/tokens_monadUserState_bytestring.x" - "tests/tokens_bytestring_unicode.x" - "tests/basic_typeclass.x" - "tests/basic_typeclass_bytestring.x" - "tests/default_typeclass.x" - "tests/gscan_typeclass.x" - "tests/posn_typeclass.x" - "tests/monad_typeclass.x" - "tests/monad_typeclass_bytestring.x" - "tests/monadUserState_typeclass.x" - "tests/monadUserState_typeclass_bytestring.x" - "tests/posn_typeclass_bytestring.x" - "tests/strict_typeclass.x" - "tests/unicode.x" - ]; - extraTmpFiles = []; - extraDocFiles = []; - }; - components = { - exes = { - "alex" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - ] ++ (if flags.small_base - then [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."array" or (errorHandler.buildDepError "array")) - (hsPkgs."containers" or (errorHandler.buildDepError "containers")) - (hsPkgs."directory" or (errorHandler.buildDepError "directory")) - ] - else [ (hsPkgs."base" or (errorHandler.buildDepError "base")) ]); - buildable = true; - modules = [ - "AbsSyn" - "CharSet" - "DFA" - "DFAMin" - "DFS" - "Info" - "Map" - "NFA" - "Output" - "Paths_alex" - "Parser" - "ParseMonad" - "Scan" - "Set" - "Sort" - "Util" - "UTF8" - "Data/Ranged" - "Data/Ranged/Boundaries" - "Data/Ranged/RangedSet" - "Data/Ranged/Ranges" - ]; - hsSourceDirs = [ "src" ]; - mainPath = [ "Main.hs" ] ++ [ "" ]; - }; - }; - tests = { - "tests" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."process" or (errorHandler.buildDepError "process")) - ]; - build-tools = [ - (hsPkgs.buildPackages.alex or (pkgs.buildPackages.alex or (errorHandler.buildToolDepError "alex"))) - ]; - buildable = true; - mainPath = [ "test.hs" ]; - }; - }; - }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file diff --git a/materialized/ghc883/alex/default.nix b/materialized/ghc883/alex/default.nix deleted file mode 100644 index 5a3c26abcd..0000000000 --- a/materialized/ghc883/alex/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ - pkgs = hackage: - { - packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default; - "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; - "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.6.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.2.1").revisions).default; - "bytestring".revision = (((hackage."bytestring")."0.10.10.0").revisions).default; - "base".revision = (((hackage."base")."4.13.0.0").revisions).default; - "time".revision = (((hackage."time")."1.9.3").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.8.0").revisions).default; - "array".revision = (((hackage."array")."0.5.4.0").revisions).default; - "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default; - }; - compiler = { - version = "8.8.3"; - nix-name = "ghc883"; - packages = { - "ghc-prim" = "0.5.3"; - "unix" = "2.7.2.2"; - "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.6.0"; - "containers" = "0.6.2.1"; - "bytestring" = "0.10.10.0"; - "base" = "4.13.0.0"; - "time" = "1.9.3"; - "filepath" = "1.4.2.1"; - "process" = "1.6.8.0"; - "array" = "0.5.4.0"; - "integer-gmp" = "1.0.2.0"; - }; - }; - }; - extras = hackage: - { packages = { alex = ./.plan.nix/alex.nix; }; }; - modules = [ - ({ lib, ... }: - { - packages = { - "alex" = { flags = { "small_base" = lib.mkOverride 900 true; }; }; - }; - }) - ]; - } \ No newline at end of file diff --git a/materialized/ghc883/happy/.plan.nix/happy.nix b/materialized/ghc883/happy/.plan.nix/happy.nix deleted file mode 100644 index b5455c571d..0000000000 --- a/materialized/ghc883/happy/.plan.nix/happy.nix +++ /dev/null @@ -1,200 +0,0 @@ -{ system - , compiler - , flags - , pkgs - , hsPkgs - , pkgconfPkgs - , errorHandler - , config - , ... }: - { - flags = { small_base = true; }; - package = { - specVersion = "1.8"; - identifier = { name = "happy"; version = "1.19.12"; }; - license = "BSD-2-Clause"; - copyright = "(c) Andy Gill, Simon Marlow"; - maintainer = "Simon Marlow "; - author = "Andy Gill and Simon Marlow"; - homepage = "https://www.haskell.org/happy/"; - url = ""; - synopsis = "Happy is a parser generator for Haskell"; - description = "Happy is a parser generator for Haskell. Given a grammar\nspecification in BNF, Happy generates Haskell code to parse the\ngrammar. Happy works in a similar way to the @yacc@ tool for C."; - buildType = "Simple"; - isLocal = true; - detailLevel = "FullDetails"; - licenseFiles = [ "LICENSE" ]; - dataDir = "data/"; - dataFiles = [ - "HappyTemplate" - "HappyTemplate-arrays" - "HappyTemplate-arrays-coerce" - "HappyTemplate-arrays-coerce-debug" - "HappyTemplate-arrays-debug" - "HappyTemplate-arrays-ghc" - "HappyTemplate-arrays-ghc-debug" - "HappyTemplate-coerce" - "HappyTemplate-ghc" - "GLR_Base" - "GLR_Lib" - "GLR_Lib-ghc" - "GLR_Lib-ghc-debug" - ]; - extraSrcFiles = [ - "ANNOUNCE" - "CHANGES" - "Makefile" - "README.md" - "TODO" - "doc/Makefile" - "doc/aclocal.m4" - "doc/config.mk.in" - "doc/configure.ac" - "doc/docbook-xml.mk" - "doc/fptools.css" - "doc/happy.1.in" - "doc/happy.xml" - "examples/glr/nlp/Main.lhs" - "examples/glr/nlp/Makefile" - "examples/glr/nlp/README" - "examples/glr/nlp/English.y" - "examples/glr/nlp/Hugs.lhs" - "examples/glr/Makefile" - "examples/glr/Makefile.defs" - "examples/glr/expr-eval/Main.lhs" - "examples/glr/expr-eval/Makefile" - "examples/glr/expr-eval/Expr.y" - "examples/glr/expr-eval/README" - "examples/glr/expr-eval/Hugs.lhs" - "examples/glr/expr-tree/Main.lhs" - "examples/glr/expr-tree/Makefile" - "examples/glr/expr-tree/Expr.y" - "examples/glr/expr-tree/README" - "examples/glr/expr-tree/Tree.lhs" - "examples/glr/expr-tree/Hugs.lhs" - "examples/glr/highly-ambiguous/Main.lhs" - "examples/glr/highly-ambiguous/Makefile" - "examples/glr/highly-ambiguous/Expr.y" - "examples/glr/highly-ambiguous/README" - "examples/glr/highly-ambiguous/Hugs.lhs" - "examples/glr/hidden-leftrec/Main.lhs" - "examples/glr/hidden-leftrec/Makefile" - "examples/glr/hidden-leftrec/Expr.y" - "examples/glr/hidden-leftrec/README" - "examples/glr/hidden-leftrec/Hugs.lhs" - "examples/glr/expr-monad/Main.lhs" - "examples/glr/expr-monad/Makefile" - "examples/glr/expr-monad/Expr.y" - "examples/glr/expr-monad/README" - "examples/glr/expr-monad/Hugs.lhs" - "examples/glr/bio-eg/Main.lhs" - "examples/glr/bio-eg/Makefile" - "examples/glr/bio-eg/Bio.y" - "examples/glr/bio-eg/README" - "examples/glr/bio-eg/1-1200.dna" - "examples/glr/bio-eg/1-600.dna" - "examples/glr/common/DV_lhs" - "examples/glr/common/DaVinciTypes.hs" - "examples/glr/packing/Main.lhs" - "examples/glr/packing/Makefile" - "examples/glr/packing/Expr.y" - "examples/glr/packing/README" - "examples/glr/packing/Hugs.lhs" - "examples/PgnParser.ly" - "examples/MonadTest.ly" - "examples/igloo/ParserM.hs" - "examples/igloo/Makefile" - "examples/igloo/Parser.y" - "examples/igloo/Foo.hs" - "examples/igloo/README" - "examples/igloo/Lexer.x" - "examples/README" - "examples/Calc.ly" - "examples/DavesExample.ly" - "examples/ErrorTest.ly" - "examples/ErlParser.ly" - "examples/SimonsExample.ly" - "examples/LexerTest.ly" - "happy.spec" - "src/ARRAY-NOTES" - "tests/AttrGrammar001.y" - "tests/AttrGrammar002.y" - "tests/Makefile" - "tests/Partial.ly" - "tests/Test.ly" - "tests/TestMulti.ly" - "tests/TestPrecedence.ly" - "tests/bogus-token.y" - "tests/bug001.ly" - "tests/bug002.y" - "tests/error001.stderr" - "tests/error001.stdout" - "tests/error001.y" - "tests/monad001.y" - "tests/monad002.ly" - "tests/monaderror.y" - "tests/precedence001.ly" - "tests/precedence002.y" - "tests/test_rules.y" - "tests/issue91.y" - "tests/issue93.y" - "tests/issue94.y" - "tests/issue95.y" - "tests/monaderror-explist.y" - "tests/typeclass_monad001.y" - "tests/typeclass_monad002.ly" - "tests/typeclass_monad_lexer.y" - "tests/rank2.y" - ]; - extraTmpFiles = []; - extraDocFiles = []; - }; - components = { - exes = { - "happy" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."array" or (errorHandler.buildDepError "array")) - (hsPkgs."containers" or (errorHandler.buildDepError "containers")) - (hsPkgs."mtl" or (errorHandler.buildDepError "mtl")) - ]; - buildable = true; - modules = [ - "Paths_happy" - "AbsSyn" - "First" - "GenUtils" - "Grammar" - "Info" - "LALR" - "Lexer" - "ParseMonad" - "Parser" - "ProduceCode" - "ProduceGLRCode" - "NameSet" - "Target" - "AttrGrammar" - "AttrGrammarParser" - "ParamRules" - "PrettyGrammar" - ]; - hsSourceDirs = [ "src" ]; - mainPath = [ "Main.lhs" ]; - }; - }; - tests = { - "tests" = { - depends = [ - (hsPkgs."base" or (errorHandler.buildDepError "base")) - (hsPkgs."process" or (errorHandler.buildDepError "process")) - ]; - build-tools = [ - (hsPkgs.buildPackages.happy or (pkgs.buildPackages.happy or (errorHandler.buildToolDepError "happy"))) - ]; - buildable = true; - mainPath = [ "test.hs" ]; - }; - }; - }; - } // rec { src = (pkgs.lib).mkDefault ../.; } \ No newline at end of file diff --git a/materialized/ghc883/happy/default.nix b/materialized/ghc883/happy/default.nix deleted file mode 100644 index a7e3c57652..0000000000 --- a/materialized/ghc883/happy/default.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - pkgs = hackage: - { - packages = { - "ghc-prim".revision = (((hackage."ghc-prim")."0.5.3").revisions).default; - "unix".revision = (((hackage."unix")."2.7.2.2").revisions).default; - "mtl".revision = (((hackage."mtl")."2.2.2").revisions).default; - "rts".revision = (((hackage."rts")."1.0").revisions).default; - "deepseq".revision = (((hackage."deepseq")."1.4.4.0").revisions).default; - "directory".revision = (((hackage."directory")."1.3.6.0").revisions).default; - "containers".revision = (((hackage."containers")."0.6.2.1").revisions).default; - "bytestring".revision = (((hackage."bytestring")."0.10.10.0").revisions).default; - "base".revision = (((hackage."base")."4.13.0.0").revisions).default; - "time".revision = (((hackage."time")."1.9.3").revisions).default; - "transformers".revision = (((hackage."transformers")."0.5.6.2").revisions).default; - "filepath".revision = (((hackage."filepath")."1.4.2.1").revisions).default; - "process".revision = (((hackage."process")."1.6.8.0").revisions).default; - "array".revision = (((hackage."array")."0.5.4.0").revisions).default; - "integer-gmp".revision = (((hackage."integer-gmp")."1.0.2.0").revisions).default; - }; - compiler = { - version = "8.8.3"; - nix-name = "ghc883"; - packages = { - "ghc-prim" = "0.5.3"; - "unix" = "2.7.2.2"; - "mtl" = "2.2.2"; - "rts" = "1.0"; - "deepseq" = "1.4.4.0"; - "directory" = "1.3.6.0"; - "containers" = "0.6.2.1"; - "bytestring" = "0.10.10.0"; - "base" = "4.13.0.0"; - "time" = "1.9.3"; - "transformers" = "0.5.6.2"; - "filepath" = "1.4.2.1"; - "process" = "1.6.8.0"; - "array" = "0.5.4.0"; - "integer-gmp" = "1.0.2.0"; - }; - }; - }; - extras = hackage: - { packages = { happy = ./.plan.nix/happy.nix; }; }; - modules = [ - ({ lib, ... }: - { - packages = { - "happy" = { flags = { "small_base" = lib.mkOverride 900 true; }; }; - }; - }) - ]; - } \ No newline at end of file diff --git a/modules/component-driver.nix b/modules/component-driver.nix index 5927e4e53d..11851d093f 100644 --- a/modules/component-driver.nix +++ b/modules/component-driver.nix @@ -3,7 +3,7 @@ let builder = haskellLib.weakCallPackage pkgs ../builder { inherit haskellLib; ghc = config.ghc.package; - inherit (config) nonReinstallablePkgs hsPkgs; + inherit (config) nonReinstallablePkgs hsPkgs compiler; }; in diff --git a/nix-tools/regenerate.nix b/nix-tools/regenerate.nix index 4d291732fa..cfcdde3e0e 100644 --- a/nix-tools/regenerate.nix +++ b/nix-tools/regenerate.nix @@ -25,7 +25,7 @@ let inherit (import ../default.nix {}) sources nixpkgsArgs; in { specJSON ? ./nix-tools-src.json }: -with import sources.nixpkgs-default nixpkgsArgs; +with import sources.nixpkgs nixpkgsArgs; let src = haskell-nix.cleanSourceHaskell { src = haskell-nix.fetchExternal { @@ -36,6 +36,7 @@ let }; in let plan-to-nix = (haskell-nix.cabalProject { + compiler-nix-name = "ghc865"; name = "nix-tools"; inherit src; modules = [{ diff --git a/nix/sources.json b/nix/sources.json index bae54f4406..e8172b5527 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -1,6 +1,20 @@ { + "cabal-32": { + "branch": "3.2", + "builtin": false, + "description": "Official upstream development repository for Cabal and cabal-install", + "homepage": "https://haskell.org/cabal", + "owner": "haskell", + "repo": "cabal", + "rev": "94aaa8e4720081f9c75497e2735b90f6a819b08e", + "sha256": "09m59w794zk4mxk1m3qkkmf5ydi0zhh89a7jk1wglrgxxadfndmh", + "type": "tarball", + "url": "https://github.com/haskell/cabal/archive/94aaa8e4720081f9c75497e2735b90f6a819b08e.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "niv": { "branch": "master", + "builtin": false, "description": "Easy dependency management for Nix projects", "homepage": "https://github.com/nmattia/niv", "owner": "nmattia", @@ -13,6 +27,7 @@ }, "nix-tools": { "branch": "master", + "builtin": false, "description": "Translate Cabals Generic Package Description to a Nix expression", "homepage": null, "owner": "input-output-hk", @@ -25,6 +40,7 @@ }, "nixpkgs-1909": { "branch": "nixpkgs-19.09-darwin", + "builtin": false, "description": "Nix Packages collection", "homepage": null, "owner": "NixOS", @@ -37,6 +53,7 @@ }, "nixpkgs-2003": { "branch": "nixpkgs-20.03-darwin", + "builtin": false, "description": "Nix Packages collection", "homepage": null, "owner": "NixOS", @@ -47,8 +64,9 @@ "url": "https://github.com/NixOS/nixpkgs/archive/db31e48c5c8d99dcaf4e5883a96181f6ac4ad6f6.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, - "nixpkgs-default": { + "nixpkgs": { "branch": "nixpkgs-20.03-darwin", + "builtin": false, "description": "Nix Packages collection", "homepage": null, "owner": "NixOS", diff --git a/nixpkgs/default.nix b/nixpkgs/default.nix deleted file mode 100644 index 867d2d7fa9..0000000000 --- a/nixpkgs/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -# This file is for backwards compatibility only -{ - inherit (import ../nix/sources.nix) nixpkgs-2003 nixpkgs-1909 nixpkgs-default; -} diff --git a/overlays/bootstrap.nix b/overlays/bootstrap.nix index 27debf4b30..35e31068c2 100644 --- a/overlays/bootstrap.nix +++ b/overlays/bootstrap.nix @@ -28,18 +28,14 @@ let fi done ''; - # For each architecture, we need to know two (somewhat ad-hoc) things: - # - What GHC version we should use for bootstrapping. - # - What Happy version we should use for bootstrapping. + # For each architecture, what GHC version we should use for bootstrapping. buildBootstrapper = if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 then { compilerNixName = "ghc882"; - happyVersion = "1.19.12"; } else { compilerNixName = "ghc844"; - happyVersion = "1.19.11"; }; in { haskell-nix = prev.haskell-nix // { @@ -47,15 +43,9 @@ in { compiler = let bootPkgs = with final.buildPackages; { ghc = final.buildPackages.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; - alex = final.haskell-nix.bootstrap.packages.alex-tool { - checkMaterialization = false; - }; - happy = final.haskell-nix.bootstrap.packages.happy-tool { - checkMaterialization = false; - }; - hscolour = final.haskell-nix.bootstrap.packages.hscolour-tool { - checkMaterialization = false; - }; + alex = final.haskell-nix.bootstrap.packages.alex-unchecked; + happy = final.haskell-nix.bootstrap.packages.happy-unchecked; + hscolour = final.haskell-nix.bootstrap.packages.hscolour-unchecked; }; sphinx = with final.buildPackages; (python3Packages.sphinx_1_7_9 or python3Packages.sphinx); hsc2hs-align-conditionals-patch = final.fetchpatch { @@ -147,7 +137,11 @@ in { ghc844 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc844; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_5; llvmPackages = final.llvmPackages_5; @@ -165,7 +159,11 @@ in { ghc861 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc861; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_6; llvmPackages = final.llvmPackages_6; @@ -181,7 +179,11 @@ in { ghc862 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc862; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_6; llvmPackages = final.llvmPackages_6; @@ -198,7 +200,11 @@ in { ghc863 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc863; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_6; llvmPackages = final.llvmPackages_6; @@ -215,7 +221,11 @@ in { ghc864 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc864; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_6; llvmPackages = final.llvmPackages_6; @@ -232,7 +242,11 @@ in { ghc865 = final.callPackage ../compiler/ghc { extra-passthru = { buildGHC = final.buildPackages.haskell-nix.compiler.ghc865; }; - inherit bootPkgs sphinx installDeps; + inherit sphinx installDeps; + bootPkgs = bootPkgs // { + # GHC 8.6.5 and earlier need happy 1.19.11 + happy = final.haskell-nix.bootstrap.packages.happy-old-unchecked; + }; buildLlvmPackages = final.buildPackages.llvmPackages_6; llvmPackages = final.llvmPackages_6; @@ -302,8 +316,6 @@ in { bootPkgs = bootPkgs // { ghc = buildPkgs.haskell-nix.compiler.ghc883; - alex = buildPkgs.haskell-nix.haskellPackages.alex.components.exes.alex; - happy = buildPkgs.haskell-nix.haskellPackages.happy.components.exes.happy; }; inherit sphinx installDeps; @@ -365,41 +377,27 @@ in { '' + installDeps targetPrefix); }))); - # Need to use something from 8.8.x as the default to build aarch64 native compiler: - defaultCompilerNixName = - if final.targetPlatform.isAarch64 && final.buildPlatform.isAarch64 - then "ghc883" - else "ghc865"; - ghc = final.haskell-nix.compiler."${final.haskell-nix.defaultCompilerNixName}"; # Both `cabal-install` and `nix-tools` are needed for `cabalProject` # to check materialized results. We need to take care that when # it is doing this we do not check the materialization of the # tools used or there will be infinite recursion. # always has `checkMaterialization = false` to avoid infinite # recursion. - cabal-install-tool = args: - # Hackage version of cabal-install does not compiler with ghc 8.10.1 yet. - let compiler-nix-name = args.compiler-nix-name or - (if final.haskell-nix.defaultCompilerNixName == "ghc8101" - then "ghc883" - else final.haskell-nix.defaultCompilerNixName); - in final.haskell-nix.tool "cabal" ({ + cabal-install-tool = {compiler-nix-name, ...}@args: + (final.haskell-nix.hackage-package ({ + name = "cabal-install"; version = "3.2.0.0"; index-state = final.haskell-nix.internalHackageIndexState; - inherit compiler-nix-name; # When building cabal-install (only happens when checking materialization) # disable checking of the tools used to avoid infinite recursion. - cabal-install = final.evalPackages.haskell-nix.cabal-install-tool - (args // { checkMaterialization = false; }); - nix-tools = final.evalPackages.haskell-nix.nix-tools-set - (args // { checkMaterialization = false; }); + cabal-install = final.evalPackages.haskell-nix.cabal-install-unchecked.${compiler-nix-name}; + nix-tools = final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name}; materialized = ../materialized + "/${compiler-nix-name}/cabal-install"; - } // args); - cabal-install = final.buildPackages.haskell-nix.cabal-install-tool {}; - nix-tools-set = args: + } // args)).components.exes.cabal; + nix-tools-set = { compiler-nix-name, ... }@args: let - exes = - (final.haskell-nix.cabalProject ({ + project = + final.haskell-nix.cabalProject ({ name = "nix-tools"; src = final.haskell-nix.sources.nix-tools; index-state = final.haskell-nix.internalHackageIndexState; @@ -409,13 +407,9 @@ in { ''; # When building cabal-install (only happens when checking materialization) # disable checking of the tools used to avoid infinite recursion. - cabal-install = final.evalPackages.haskell-nix.cabal-install-tool - (args // { checkMaterialization = false; }); - nix-tools = final.evalPackages.haskell-nix.nix-tools-set - (args // { checkMaterialization = false; }); - materialized = ../materialized + "/${ - args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName - }/nix-tools"; + cabal-install = final.evalPackages.haskell-nix.cabal-install-unchecked.${compiler-nix-name}; + nix-tools = final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name}; + materialized = ../materialized + "/${compiler-nix-name}/nix-tools"; modules = [{ packages.transformers-compat.components.library.doExactConfig = true; packages.time-compat.components.library.doExactConfig = true; @@ -432,7 +426,8 @@ in { "unix" "xhtml" ]; }]; - } // args)).nix-tools.components.exes; + } // args); + exes = project.nix-tools.components.exes // project.hpack.components.exes; tools = [ final.buildPackages.nix # Double buildPackages is intentional, see comment in lib/default.nix for details. @@ -452,23 +447,39 @@ in { done ''; }; - nix-tools = final.buildPackages.haskell-nix.nix-tools-set {}; - alex-tool = args: final.haskell-nix.tool "alex" ({ - version = "3.2.5"; - index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized + "/${ - args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName - }/alex"; - } // args); - alex = final.buildPackages.haskell-nix.alex-tool {}; - happy-tool = args: final.haskell-nix.tool "happy" ({ - version = "1.19.12"; - index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized + "/${ - args.compiler-nix-name or final.haskell-nix.defaultCompilerNixName - }/happy"; - } // args); - happy = final.buildPackages.haskell-nix.happy-tool {}; + + # Memoize the cabal-install and nix-tools derivations by adding: + # haskell-nix.cabal-install.ghcXXX + # haskell-nix.cabal-install-unchecked.ghcXXX + # haskell-nix.nix-tools.ghcXXX + # haskell-nix.nix-tools-unchecked.ghcXXX + # Using these avoids unecessary calls to mkDerivation. + # For cabal projects we match the versions used to the compiler + # selected for the project to avoid the chance of a dependency + # another GHC version (particularly useful on macOS where + # executables are dynamically linked to GHC itself, which means + # that if you use a tool built with a different GHC you will get + # that GHC itself in your closure). + cabal-install = final.lib.mapAttrs (compiler-nix-name: _: + final.haskell-nix.cabal-install-tool { inherit compiler-nix-name; }) final.haskell-nix.compiler; + cabal-install-unchecked = final.lib.mapAttrs (compiler-nix-name: _: + final.haskell-nix.cabal-install-tool { inherit compiler-nix-name; checkMaterialization = false; }) final.haskell-nix.compiler; + nix-tools = final.lib.mapAttrs (compiler-nix-name: _: + final.haskell-nix.nix-tools-set { inherit compiler-nix-name; }) final.haskell-nix.compiler; + nix-tools-unchecked = final.lib.mapAttrs (compiler-nix-name: _: + final.haskell-nix.nix-tools-set { inherit compiler-nix-name; checkMaterialization = false; }) final.haskell-nix.compiler; + + # These `internal` versions are used for: + # * `nix-tools` for stack projects (since we use `nix-tools` to process + # the `stack.yaml` file we cannot match the ghc of the project the + # way we do for cabal projects). + # * Scripts are used to update stackage and hackage + # Updating the version of GHC selected here should be fairly safe as + # there should be no difference in the behaviour of these tools. + # (stack projects on macOS may see a significant change in the + # closure size of their build dependencies due to dynamic linking). + internal-cabal-install = final.haskell-nix.cabal-install.ghc883; + internal-nix-tools = final.haskell-nix.nix-tools.ghc883; # WARN: The `import ../. {}` will prevent # any cross to work, as we will loose @@ -497,7 +508,16 @@ in { # the bootstrap infra structure (pre-compiled ghc; bootstrapped cabal-install, ...) bootstrap = with final.haskell-nix; - let ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; + let + # This compiler-nix-name will only be used to build nix-tools and cabal-install + # when checking materialization of alex, happy and hscolour. + compiler-nix-name = "ghc865"; + nix-tools = final.evalPackages.haskell-nix.nix-tools.${compiler-nix-name}; + cabal-install = final.evalPackages.haskell-nix.cabal-install.${compiler-nix-name}; + # The ghc boot compiler to use to compile alex, happy and hscolour + ghc = final.buildPackages.haskell-nix.bootstrap.compiler."${buildBootstrapper.compilerNixName}"; + ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; + index-state = final.haskell-nix.internalHackageIndexState; in { # XXX: import ../. will throw away all other overlays, config values, ... # this is not ideal! @@ -525,31 +545,31 @@ in { # building ghc itself (since GHC is a dependency # of the materialization check it would cause # infinite recusion). - alex-tool = args: tool "alex" ({ + alex-tool = args: tool buildBootstrapper.compilerNixName "alex" ({ version = "3.2.4"; - # Only a boot compiler is suitable here - ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; - index-state = final.haskell-nix.internalHackageIndexState; + inherit ghcOverride nix-tools cabal-install index-state; materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/alex"; } // args); alex = bootstrap.packages.alex-tool {}; - happy-tool = args: tool "happy" ({ - version = buildBootstrapper.happyVersion; - # Only a boot compiler is suitable here - ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; - index-state = final.haskell-nix.internalHackageIndexState; - materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${buildBootstrapper.happyVersion}"; + alex-unchecked = bootstrap.packages.alex-tool { checkMaterialization = false; }; + happy-tool = { version ? "1.19.12", ... }@args: tool buildBootstrapper.compilerNixName "happy" ({ + inherit version ghcOverride nix-tools cabal-install index-state; + materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/happy-${version}"; } // args); happy = bootstrap.packages.happy-tool {}; + happy-unchecked = bootstrap.packages.happy-tool { checkMaterialization = false; }; + # Older version needed when building ghc 8.6.5 + happy-old = bootstrap.packages.happy-tool { version = "1.19.11"; }; + happy-old-unchecked = bootstrap.packages.happy-tool { version = "1.19.11"; checkMaterialization = false; }; hscolour-tool = args: (hackage-package ({ + compiler-nix-name = buildBootstrapper.compilerNixName; name = "hscolour"; version = "1.24.4"; - # Only a boot compiler is suitable here - ghcOverride = ghc // { isHaskellNixCompiler = ghc.isHaskellNixBootCompiler; }; - index-state = final.haskell-nix.internalHackageIndexState; + inherit ghcOverride nix-tools cabal-install index-state; materialized = ../materialized/bootstrap + "/${buildBootstrapper.compilerNixName}/hscolour"; } // args)).components.exes.HsColour; hscolour = bootstrap.packages.hscolour-tool {}; + hscolour-unchecked = bootstrap.packages.hscolour-tool { checkMaterialization = false; }; }; }; }; diff --git a/overlays/eval-on-current.nix b/overlays/eval-on-current.nix index 1f580ce47a..76a53fc338 100644 --- a/overlays/eval-on-current.nix +++ b/overlays/eval-on-current.nix @@ -2,7 +2,7 @@ final: prev: { # This overlay makes `evalPackages` is like `buildPackages`, but on # `builtins.currentSystem`. # See `eval-on-build.nix` for alternative that just uses `buildPackages`. - evalPackages = (import final.path (import ../. { - inherit (final.haskell-nix) defaultCompilerNixName; - }).nixpkgsArgs).buildPackages; + evalPackages = (import final.path { + inherit (final.haskell-nix) overlays; + }).buildPackages; } \ No newline at end of file diff --git a/overlays/ghc-packages.nix b/overlays/ghc-packages.nix index 2a7ae4dc98..3c65fe8037 100644 --- a/overlays/ghc-packages.nix +++ b/overlays/ghc-packages.nix @@ -1,14 +1,14 @@ final: prev: let - callCabal2Nix = name: src: final.stdenv.mkDerivation { + callCabal2Nix = compiler-nix-name: name: src: final.evalPackages.stdenv.mkDerivation { name = "${name}-package.nix"; inherit src; - nativeBuildInputs = [ (final.buildPackages.haskell-nix.nix-tools-set { - # It is not safe to checkk the nix-tools materialization here + nativeBuildInputs = [ + # It is not safe to check the nix-tools materialization here # as we would need to run this code to do so leading to - # infinite recursion. - checkMaterialization = false; - }) ]; + # infinite recursion (so using nix-tools-unchecked). + final.evalPackages.haskell-nix.nix-tools-unchecked.${compiler-nix-name} + ]; phases = [ "unpackPhase" "buildPhase" ]; LOCALE_ARCHIVE = final.lib.optionalString (final.stdenv.hostPlatform.libc == "glibc") "${final.glibcLocales}/lib/locale/locale-archive"; @@ -117,7 +117,7 @@ in rec { fi '' else "${value.passthru.configured-src}/${dir}"; - nix = callCabal2Nix "${ghcName}-${pkgName}" src; + nix = callCabal2Nix ghcName "${ghcName}-${pkgName}" src; }) ghc-extra-pkgs) final.buildPackages.haskell-nix.compiler; @@ -178,7 +178,7 @@ in rec { if __pathExists materializedPath then materializedPath else null; - ghcOverride = final.buildPackages.haskell-nix.compiler.${ghcName}; + compiler-nix-name = ghcName; configureArgs = "--disable-tests --allow-newer='terminfo:base'"; # avoid failures satisfying bytestring package tests dependencies }) ghc-extra-pkgs-cabal-projects; diff --git a/overlays/hackage-quirks.nix b/overlays/hackage-quirks.nix index 257e0b2b1d..3ab2095f44 100644 --- a/overlays/hackage-quirks.nix +++ b/overlays/hackage-quirks.nix @@ -13,6 +13,20 @@ in { haskell-nix = prev.haskell-nix // { # but also for # https://github.com/input-output-hk/haskell.nix/issues/422 cabal-install = { + cabalProject = '' + packages: . + allow-newer: cabal-install:base + ''; + modules = [ + { reinstallableLibGhc = true; } + # Version of of cabal-install in hacakge is borken for GHC 8.10.1 + (lib.optionalAttrs (version == "3.2.0.0") { + packages.cabal-install.src = final.haskell-nix.sources.cabal-32 + "/cabal-install"; + }) + ]; + }; + + hpack = { modules = [ { reinstallableLibGhc = true; } ]; }; diff --git a/overlays/haskell.nix b/overlays/haskell.nix index 7ae5eb7dfc..a4bd8c64cb 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -252,22 +252,26 @@ final: prev: { }; update-index-state-hashes = import ../scripts/update-index-state-hashes.nix { - inherit (final.haskell-nix) indexStateHashesPath nix-tools; + inherit (final.haskell-nix) indexStateHashesPath; inherit (final) coreutils nix writeShellScriptBin stdenv curl; + # Update scripts use the internal nix-tools and cabal-install (compiled with a fixed GHC version) + nix-tools = final.haskell-nix.internal-nix-tools; }; # Function to call stackToNix callStackToNix = import ../lib/call-stack-to-nix.nix { pkgs = final.evalPackages.pkgs; inherit (final.evalPackages.pkgs) runCommand; - inherit (final.evalPackages.haskell-nix) nix-tools mkCacheFile materialize haskellLib; + inherit (final.evalPackages.haskell-nix) mkCacheFile materialize haskellLib; }; # given a source location call `cabal-to-nix` (from nix-tools) on it # to produce the nix representation of it. callCabalToNix = { name, src, cabal-file ? "${name}.cabal" }: final.buildPackages.pkgs.runCommand "${name}.nix" { - nativeBuildInputs = [ final.buildPackages.haskell-nix.nix-tools ]; + # This function is only used when building stack projects (via mkCacheLine and mkCacheFile) + # When building stack projects we use the internal nix-tools and cabal-install (compiled with a fixed GHC version) + nativeBuildInputs = [ final.buildPackages.haskell-nix.internal-nix-tools ]; LOCALE_ARCHIVE = final.lib.optionalString (final.stdenv.buildPlatform.libc == "glibc") "${final.buildPackages.glibcLocales}/lib/locale/locale-archive"; LANG = "en_US.UTF-8"; @@ -364,7 +368,7 @@ final: prev: { genStackCache = import ../lib/stack-cache-generator.nix { inherit (final.evalPackages) pkgs; - inherit (final.evalPackages.haskell-nix) haskellLib nix-tools; + inherit (final.evalPackages.haskell-nix) haskellLib; }; mkCacheModule = cache: @@ -410,9 +414,8 @@ final: prev: { index-state-hashes = import indexStateHashesPath; inherit (final.buildPackages.haskell-nix) haskellLib materialize; pkgs = final.buildPackages.pkgs; - inherit (final.evalPackages.haskell-nix.haskellPackages.hpack.components.exes) hpack; - inherit (final.buildPackages.haskell-nix) ghc; - inherit (final.evalPackages.haskell-nix) cabal-install dotCabal nix-tools; + inherit (final) evalPackages; + inherit (final.evalPackages.haskell-nix) dotCabal; inherit (final.buildPackages.pkgs) runCommand symlinkJoin cacert; }; @@ -436,12 +439,17 @@ final: prev: { # the index-state-hashes is used. This guarantees reproducability wrt # to the haskell.nix revision. If reproducability beyond haskell.nix # is required, a specific index-state should be provided! - hackage-package = { name, ... }@args: (hackage-project args).hsPkgs.${name}; + hackage-package = + { name, compiler-nix-name, ... }@args': + let args = { caller = "hackage-package"; } // args'; + in (hackage-project args).hsPkgs.${name}; hackage-project = { name + , compiler-nix-name , version - , ... }@args: - let tarball = final.pkgs.fetchurl { + , ... }@args': + let args = { caller = "hackage-project"; } // args'; + tarball = final.pkgs.fetchurl { url = "mirror://hackage/${name}-${version}.tar.gz"; inherit (hackage.${name}.${version}) sha256; }; in let src = final.buildPackages.pkgs.runCommand "${name}-${version}-src" { } '' @@ -458,8 +466,9 @@ final: prev: { # separately from the hsPkgs. The advantage is that the you can get the # plan-nix without building the project. cabalProject' = - { ... }@args: + { src, compiler-nix-name, ... }@args': let + args = { caller = "cabalProject'"; } // args'; callProjectResults = callCabalProjectToNix args; in let pkg-set = mkCabalProjectPkgSet { plan-pkgs = importAndFilterProject { @@ -478,6 +487,9 @@ final: prev: { inherit pkg-set; plan-nix = callProjectResults.projectNix; inherit (callProjectResults) index-state; + tool = final.buildPackages.haskell-nix.tool pkg-set.config.compiler.nix-name; + tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name; + roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name; }; # Take `hsPkgs` from the `rawProject` and update all the packages and @@ -507,16 +519,20 @@ final: prev: { }); }); - cabalProject = args: let p = cabalProject' args; + cabalProject = + { src, compiler-nix-name, ... }@args': + let + args = { caller = "hackage-package"; } // args'; + p = cabalProject' args; in p.hsPkgs // { - inherit (p) plan-nix; + inherit (p) plan-nix index-state tool tools roots; # Provide `nix-shell -A shells.ghc` for users migrating from the reflex-platform. # But we should encourage use of `nix-shell -A shellFor` shells.ghc = p.hsPkgs.shellFor {}; }; stackProject' = - { ... }@args: + { src, ... }@args: let callProjectResults = callStackToNix ({ inherit cache; } // args); generatedCache = genStackCache args; cache = args.cache or generatedCache; @@ -531,11 +547,14 @@ final: prev: { inherit (pkg-set.config) hsPkgs; inherit pkg-set; stack-nix = callProjectResults.projectNix; - }; + tool = final.buildPackages.haskell-nix.tool pkg-set.config.compiler.nix-name; + tools = final.buildPackages.haskell-nix.tools pkg-set.config.compiler.nix-name; + roots = final.haskell-nix.roots pkg-set.config.compiler.nix-name; + }; stackProject = args: let p = stackProject' args; in p.hsPkgs // { - inherit (p) stack-nix; + inherit (p) stack-nix tool tools roots; # Provide `nix-shell -A shells.ghc` for users migrating from the reflex-platform. # But we should encourage use of `nix-shell -A shellFor` shells.ghc = p.hsPkgs.shellFor {}; @@ -550,8 +569,9 @@ final: prev: { # selected file ends in a `.yaml` it is assumed to be for `stackProject`. # If niether `stack.yaml` nor `cabal.project` exist `cabalProject` is # used (as it will use a default `cabal.project`). - project' = { src, projectFileName ? null, ... }@args: + project' = { src, projectFileName ? null, ... }@args': let + args = { caller = "project'"; } // args'; dir = __readDir (src.origSrcSubDir or src); exists = fileName: builtins.elem (dir.${fileName} or "") ["regular" "symlink"]; stackYamlExists = exists "stack.yaml"; @@ -574,8 +594,11 @@ final: prev: { # This is the same as the `cabalPackage` and `stackPackage` wrappers # for `cabalPackage` and `stackPackage`. - project = args: let p = project' args; - in p.hsPkgs // { + project = args': + let + args = { caller = "project'"; } // args'; + p = project' args; + in p.hsPkgs // { # Provide `nix-shell -A shells.ghc` for users migrating from the reflex-platform. # But we should encourage use of `nix-shell -A shellFor` shells.ghc = p.hsPkgs.shellFor {}; @@ -598,17 +621,16 @@ final: prev: { # Add this to your tests to make all the dependencies of haskell.nix # are tested and cached. - haskellNixRoots = final.recurseIntoAttrs { - Level0 = haskellNixRoots' 0; - Level1 = haskellNixRoots' 1; + roots = compiler-nix-name: final.recurseIntoAttrs { + Level0 = roots' compiler-nix-name 0; + Level1 = roots' compiler-nix-name 1; # Should be safe to use this now we have materialized everything # except the tests - Level2 = haskellNixRoots' 2; + Level2 = roots' compiler-nix-name 2; }; - haskellNixRoots' = ifdLevel: - let inherit (final.haskell-nix) defaultCompilerNixName; - in final.recurseIntoAttrs ({ + roots' = compiler-nix-name: ifdLevel: + final.recurseIntoAttrs ({ # Things that require no IFD to build inherit (final.buildPackages.haskell-nix) source-pins; # Double buildPackages is intentional, @@ -624,20 +646,20 @@ final: prev: { boot-alex = final.buildPackages.haskell-nix.bootstrap.packages.alex; boot-happy = final.buildPackages.haskell-nix.bootstrap.packages.happy; boot-hscolour = final.buildPackages.haskell-nix.bootstrap.packages.hscolour; - ghc = final.buildPackages.haskell-nix.ghc; + ghc = final.buildPackages.haskell-nix.compiler.${compiler-nix-name}; ghc-boot-packages-nix = final.recurseIntoAttrs - final.ghc-boot-packages-nix."${defaultCompilerNixName}"; + final.ghc-boot-packages-nix.${compiler-nix-name}; ghc-extra-projects-nix = - final.ghc-extra-projects."${defaultCompilerNixName}".plan-nix; + final.ghc-extra-projects.${compiler-nix-name}.plan-nix; } // final.lib.optionalAttrs (ifdLevel > 1) { # Things that require two levels of IFD to build (inputs should be in level 1) - inherit (final.buildPackages.haskell-nix.haskellPackages.hpack.components.exes) hpack; - inherit (final.buildPackages.haskell-nix) cabal-install dotCabal nix-tools alex happy; + nix-tools = final.buildPackages.haskell-nix.nix-tools.${compiler-nix-name}; + cabal-install = final.buildPackages.haskell-nix.cabal-install.${compiler-nix-name}; # These seem to be the only things we use from `ghc-extra-packages` # in haskell.nix itself. - inherit (final.ghc-extra-packages."${defaultCompilerNixName}" + inherit (final.ghc-extra-packages."${compiler-nix-name}" .iserv-proxy.components.exes) iserv-proxy; - inherit (final.ghc-extra-packages."${defaultCompilerNixName}" + inherit (final.ghc-extra-packages."${compiler-nix-name}" .remote-iserv.components.exes) remote-iserv; }); }; diff --git a/overlays/tools.nix b/overlays/tools.nix index 0d8a9ad577..38afd66353 100644 --- a/overlays/tools.nix +++ b/overlays/tools.nix @@ -6,16 +6,17 @@ # when it is not. # # To get a single tool: -# haskell-nix.tool "cabal" "3.2.0.0" +# haskell-nix.tool "ghc883" "cabal" "3.2.0.0" # # This does the same thing as: # (haskell-nix.hackage-package { +# compiler-nix-name = "ghc883"; # name = "cabal-install" # version = "3.2.0.0" # }).components.exes.cabal # # To get an attr set containing multiple tools: -# haskell-nix.tools { cabal = "3.2.0.0"; hlint = "2.2.11"; } +# haskell-nix.tools "ghc883" { cabal = "3.2.0.0"; hlint = "2.2.11"; } # # To add tools to a shell: # shellFor { tools = { cabal = "3.2.0.0"; hlint = "2.2.11"; }; } @@ -23,13 +24,18 @@ # When used in shellFor the tools will be compiled with the same version # of ghc used in the shell (the build ghc in the case of cross compilation). # +# To get tools for use with project `p` without using shellFor: +# p.tool "cabal" "3.2.0.0" +# p.tools { cabal = "3.2.0.0"; hlint = "2.2.11"; } +# (the ghc version used to build it will match the one used in the project) +# # Instead of a version string we can use an attr set containing # arguments that will be passed to `cabalProject`. # -# For instance to specify the ghc used to compile. Use: -# haskell-nix.tool "cabal" { +# For instance to add haskell.nix modules. Use: +# haskell-nix.tool "ghc883" "cabal" { # version = "3.2.0.0"; -# ghc = haskell-nix.compiler.ghc883; +# modules = [ ... ]; # } # final: prev: @@ -51,21 +57,25 @@ in { haskell-nix = prev.haskell-nix // { cabal-install = "cabal"; }; - hackage-tool = { name, ... }@args: - (final.haskell-nix.hackage-package - (args // { name = final.haskell-nix.toolPackageName.${name} or name; })) - .components.exes."${final.haskell-nix.packageToolName.${name} or name}"; + hackage-tool = { name, ... }@args': + let + args = { caller = "hackage-tool"; } // args'; + in + (final.haskell-nix.hackage-package + (args // { name = final.haskell-nix.toolPackageName.${name} or name; })) + .components.exes."${final.haskell-nix.packageToolName.${name} or name}"; - tool = name: versionOrArgs: + tool = compiler-nix-name: name: versionOrArgs: let - args = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs; + args' = final.haskell-nix.haskellLib.versionOrArgsToArgs versionOrArgs; + args = { inherit compiler-nix-name; } // args'; in (if final.haskell-nix.custom-tools ? "${name}" && final.haskell-nix.custom-tools."${name}" ? "${args.version}" then final.haskell-nix.custom-tools."${name}"."${args.version}" else final.haskell-nix.hackage-tool) (args // { inherit name; }); - tools = lib.mapAttrs final.haskell-nix.tool; + tools = compiler-nix-name: lib.mapAttrs (final.haskell-nix.tool compiler-nix-name); # Like `tools` but allows default ghc to be specified toolsForGhc = ghcOverride: toolSet: diff --git a/release.nix b/release.nix index 9c7eaabdda..331a288894 100644 --- a/release.nix +++ b/release.nix @@ -6,7 +6,7 @@ let inherit (import ./ci-lib.nix) stripAttrsForHydra filterDerivations; - genericPkgs = import (import ./nixpkgs/default.nix).nixpkgs-default {}; + genericPkgs = import (import ./nix/sources.nix).nixpkgs {}; lib = genericPkgs.lib; ci = import ./ci.nix { inherit supportedSystems ifdLevel checkMaterialization; restrictEval = true; }; allJobs = stripAttrsForHydra (filterDerivations ci); diff --git a/scripts/check-path-support.nix b/scripts/check-path-support.nix index 64aa5acfcc..58b1c85793 100644 --- a/scripts/check-path-support.nix +++ b/scripts/check-path-support.nix @@ -1,4 +1,4 @@ -{ stdenv, writeScript, nix }: +{ stdenv, writeScript, coreutils, gnutar, gzip, nix }: with stdenv.lib; @@ -7,7 +7,7 @@ writeScript "check-path-supprot.sh" '' set -euo pipefail - export PATH="${makeBinPath [ nix ]}" + export PATH="${makeBinPath [ coreutils gnutar gzip nix ]}" nix-build -E '((import ./. {}).pkgs.haskell-nix.cabalProject { compiler-nix-name = "ghc865"; src = ./test/cabal-simple; }).cabal-simple.components.library' '' diff --git a/shell.nix b/shell.nix index cf3f00af72..eb7532efe1 100644 --- a/shell.nix +++ b/shell.nix @@ -1,6 +1,6 @@ let inherit (import ./default.nix {}) sources nixpkgsArgs; - pkgs = import sources.nixpkgs-default nixpkgsArgs; + pkgs = import sources.nixpkgs nixpkgsArgs; in pkgs.stdenv.mkDerivation rec { name = "env"; env = pkgs.buildEnv { name = name; paths = buildInputs; }; diff --git a/test/buildable/default.nix b/test/buildable/default.nix index b0841b7df1..268f2b271a 100644 --- a/test/buildable/default.nix +++ b/test/buildable/default.nix @@ -1,9 +1,10 @@ -{ stdenv, cabalProject', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; index-state = "2020-05-25T00:00:00Z"; src = testSrc "buildable"; modules = [ { packages.buildable-test.flags.exclude-broken = true; } ]; diff --git a/test/cabal-22/default.nix b/test/cabal-22/default.nix index bc5a0e5422..f38ff71692 100644 --- a/test/cabal-22/default.nix +++ b/test/cabal-22/default.nix @@ -1,9 +1,10 @@ -{ stdenv, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs, testSrc }: +{ stdenv, mkCabalProjectPkgSet, cabalProject', haskellLib, util, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; src = testSrc "cabal-22"; }; diff --git a/test/cabal-hpack/Setup.hs b/test/cabal-hpack/Setup.hs new file mode 100644 index 0000000000..9a994af677 --- /dev/null +++ b/test/cabal-hpack/Setup.hs @@ -0,0 +1,2 @@ +import Distribution.Simple +main = defaultMain diff --git a/test/cabal-hpack/app/Main.hs b/test/cabal-hpack/app/Main.hs new file mode 100644 index 0000000000..65ae4a05d5 --- /dev/null +++ b/test/cabal-hpack/app/Main.hs @@ -0,0 +1,4 @@ +module Main where + +main :: IO () +main = putStrLn "Hello, Haskell!" diff --git a/test/cabal-hpack/default.nix b/test/cabal-hpack/default.nix new file mode 100644 index 0000000000..0e2174fb04 --- /dev/null +++ b/test/cabal-hpack/default.nix @@ -0,0 +1,74 @@ +# Test a package set +{ stdenv, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: + +with stdenv.lib; + +let + modules = [ + { + # Package has no exposed modules which causes + # haddock: No input file(s) + packages.cabal-hpack.doHaddock = false; + } + ]; + + project = project' { + inherit compiler-nix-name; + src = testSrc "cabal-hpack"; + inherit modules; + }; + + packages = project.hsPkgs; + +in recurseIntoAttrs { + ifdInputs = { + inherit (project) plan-nix; + }; + + # Used for testing externally with nix-shell (../tests.sh). + # This just adds cabal-install to the existing shells. + test-shell = util.addCabalInstall packages.cabal-hpack.components.all; + + run = stdenv.mkDerivation { + name = "cabal-hpack-test"; + + buildCommand = '' + exe="${packages.cabal-hpack.components.exes.cabal-hpack}/bin/cabal-hpack${stdenv.hostPlatform.extensions.executable}" + + size=$(command stat --format '%s' "$exe") + printf "size of executable $exe is $size. \n" >& 2 + + # fixme: run on target platform when cross-compiled + printf "checking whether executable runs... " >& 2 + cat ${haskellLib.check packages.cabal-hpack.components.exes.cabal-hpack} + '' + (if stdenv.hostPlatform.isMusl + then '' + printf "checking that executable is statically linked... " >& 2 + (ldd $exe 2>&1 || true) | grep -i "not a" + '' + else + # Skip this on aarch as we do not have an `ldd` tool + optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64) ('' + printf "checking that executable is dynamically linked to system libraries... " >& 2 + '' + optionalString stdenv.isLinux '' + ldd $exe | grep libpthread + '' + optionalString stdenv.isDarwin '' + otool -L $exe |grep .dylib + '')) + '' + + printf "Checking that \"all\" component has the programs... " >& 2 + all_exe="${packages.cabal-hpack.components.all}/bin/cabal-hpack${stdenv.hostPlatform.extensions.executable}" + test -f "$all_exe" + echo "$all_exe" >& 2 + + touch $out + ''; + + meta.platforms = platforms.all; + + passthru = { + # Used for debugging with nix repl + inherit project packages; + }; + }; +} diff --git a/test/cabal-hpack/package.yaml b/test/cabal-hpack/package.yaml new file mode 100644 index 0000000000..76fa770a1e --- /dev/null +++ b/test/cabal-hpack/package.yaml @@ -0,0 +1,34 @@ +name: cabal-hpack +version: 0.1.0.0 +github: "githubuser/cabal-hpack" +license: BSD3 +author: "Author name here" +maintainer: "example@example.com" +copyright: "2019 Author name here" + +# Metadata used when publishing your package +# synopsis: Short description of your package +# category: Web + +# To avoid duplicated efforts in documentation and dealing with the +# complications of embedding Haddock markup inside cabal files, it is +# common to point users to the README.md file. +description: Please see the README on GitHub at + +dependencies: +- base >= 4.7 && < 5 + +library: + source-dirs: src + +executables: + cabal-hpack: + main: Main.hs + source-dirs: app + ghc-options: + - -threaded + - -rtsopts + - -with-rtsopts=-N + dependencies: + - cabal-hpack + diff --git a/test/cabal-simple-prof/default.nix b/test/cabal-simple-prof/default.nix index c427ddd2d8..6bf9c10980 100644 --- a/test/cabal-simple-prof/default.nix +++ b/test/cabal-simple-prof/default.nix @@ -1,5 +1,5 @@ # Test a package set -{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; @@ -16,6 +16,7 @@ let ]; project = cabalProject' { + inherit compiler-nix-name; src = testSrc "cabal-simple-prof"; inherit modules; }; diff --git a/test/cabal-simple/default.nix b/test/cabal-simple/default.nix index 71216e0895..9cf2c6d7d5 100644 --- a/test/cabal-simple/default.nix +++ b/test/cabal-simple/default.nix @@ -1,5 +1,5 @@ # Test a package set -{ stdenv, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, util, mkCabalProjectPkgSet, project', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; @@ -13,6 +13,7 @@ let ]; project = project' { + inherit compiler-nix-name; src = testSrc "cabal-simple"; inherit modules; }; diff --git a/test/cabal-source-repo/default.nix b/test/cabal-source-repo/default.nix index a40f6b9405..be1a9dd8e7 100644 --- a/test/cabal-source-repo/default.nix +++ b/test/cabal-source-repo/default.nix @@ -1,9 +1,10 @@ -{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc }: +{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; index-state = "2020-05-25T00:00:00Z"; src = testSrc "cabal-source-repo"; }; diff --git a/test/cabal-sublib/default.nix b/test/cabal-sublib/default.nix index f6bd38a8a2..f19a944f30 100644 --- a/test/cabal-sublib/default.nix +++ b/test/cabal-sublib/default.nix @@ -1,5 +1,5 @@ # Test a package set -{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; @@ -14,6 +14,7 @@ let # The ./pkgs.nix works for linux & darwin, but not for windows project = cabalProject' { + inherit compiler-nix-name; src = testSrc "cabal-sublib"; inherit modules; }; diff --git a/test/call-cabal-project-to-nix/default.nix b/test/call-cabal-project-to-nix/default.nix index e3b46974d5..8d3ecaa0bb 100644 --- a/test/call-cabal-project-to-nix/default.nix +++ b/test/call-cabal-project-to-nix/default.nix @@ -1,4 +1,4 @@ -{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc }: +{ stdenv, mkCabalProjectPkgSet, callCabalProjectToNix, importAndFilterProject, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }: with stdenv.lib; @@ -6,6 +6,7 @@ let # This test could use cabalProject', but it does so that it # tests using callCabalProjectToNix and importAndFilterProject callProjectResults = callCabalProjectToNix { + inherit compiler-nix-name; index-state = "2020-05-25T00:00:00Z"; # reuse the cabal-simple test project src = testSrc "cabal-simple"; diff --git a/test/default.nix b/test/default.nix index 2eb379f7c9..2dc1eb2f6c 100644 --- a/test/default.nix +++ b/test/default.nix @@ -1,10 +1,10 @@ -let - haskellNix = (import ../default.nix {}); -in -{ pkgs ? import nixpkgs nixpkgsArgs -, nixpkgs ? haskellNix.sources.nixpkgs-default +{ haskellNix ? import ../default.nix { inherit checkMaterialization; } +, pkgs ? import nixpkgs nixpkgsArgs +, nixpkgs ? haskellNix.sources.nixpkgs , nixpkgsArgs ? haskellNix.nixpkgsArgs , ifdLevel ? 1000 +, compiler-nix-name +, checkMaterialization ? false }: with pkgs; @@ -44,7 +44,7 @@ let else val ); - util = import ./util.nix { inherit (pkgs.haskell-nix) cabal-install; }; + util = import ./util.nix { cabal-install = pkgs.evalPackages.haskell-nix.cabal-install.${compiler-nix-name}; }; # Map the values in an association list over the withIfdInputs function. # @@ -151,10 +151,10 @@ let # All tests. allTests = { - cabal-simple = callTest ./cabal-simple { inherit util; }; - cabal-simple-prof = callTest ./cabal-simple-prof { inherit util; }; - cabal-sublib = callTest ./cabal-sublib { inherit util; }; - cabal-22 = callTest ./cabal-22 { inherit util; }; + cabal-simple = callTest ./cabal-simple { inherit util compiler-nix-name; }; + cabal-simple-prof = callTest ./cabal-simple-prof { inherit util compiler-nix-name; }; + cabal-sublib = callTest ./cabal-sublib { inherit util compiler-nix-name; }; + cabal-22 = callTest ./cabal-22 { inherit util compiler-nix-name; }; with-packages = callTest ./with-packages { inherit util; }; builder-haddock = callTest ./builder-haddock {}; stack-simple = callTest ./stack-simple {}; @@ -162,35 +162,33 @@ let stack-remote-resolver = callTest ./stack-remote-resolver {}; snapshots = callTest ./snapshots {}; shell-for = callTest ./shell-for {}; - shell-for-setup-deps = callTest ./shell-for-setup-deps {}; - setup-deps = import ./setup-deps { inherit pkgs; }; + shell-for-setup-deps = callTest ./shell-for-setup-deps { inherit compiler-nix-name; }; + setup-deps = import ./setup-deps { inherit pkgs compiler-nix-name; }; callStackToNix = callTest ./call-stack-to-nix {}; - callCabalProjectToNix = callTest ./call-cabal-project-to-nix {}; - cabal-source-repo = callTest ./cabal-source-repo {}; - buildable = callTest ./buildable {}; - project-flags-cabal = callTest ./project-flags/cabal.nix {}; + callCabalProjectToNix = callTest ./call-cabal-project-to-nix { inherit compiler-nix-name; }; + cabal-source-repo = callTest ./cabal-source-repo { inherit compiler-nix-name; }; + buildable = callTest ./buildable { inherit compiler-nix-name; }; + project-flags-cabal = callTest ./project-flags/cabal.nix { inherit compiler-nix-name; }; project-flags-stack = callTest ./project-flags/stack.nix {}; - ghc-options-cabal = callTest ./ghc-options/cabal.nix {}; + ghc-options-cabal = callTest ./ghc-options/cabal.nix { inherit compiler-nix-name; }; ghc-options-stack = callTest ./ghc-options/stack.nix {}; - exe-only = callTest ./exe-only { inherit util; }; + exe-only = callTest ./exe-only { inherit util compiler-nix-name; }; stack-source-repo = callTest ./stack-source-repo {}; - extra-hackage = callTest ./extra-hackage {}; + extra-hackage = callTest ./extra-hackage { inherit compiler-nix-name; }; compiler-nix-name = callTest ./compiler-nix-name {}; - hls-cabal = callTest ./haskell-language-server/cabal.nix {}; - hls-stack = callTest ./haskell-language-server/stack.nix {}; + hls-cabal = callTest ./haskell-language-server/cabal.nix { inherit compiler-nix-name; }; + hls-stack = callTest ./haskell-language-server/stack.nix { inherit compiler-nix-name; }; + cabal-hpack = callTest ./cabal-hpack { inherit util compiler-nix-name; }; + index-state = callTest ./index-state { inherit compiler-nix-name; }; unit = unitTests; - } // lib.optionalAttrs (!stdenv.hostPlatform.isGhcjs && pkgs.haskell-nix.defaultCompilerNixName != "ghc8101" ) { + } // lib.optionalAttrs (!stdenv.hostPlatform.isGhcjs && compiler-nix-name != "ghc8101" ) { # Pandoc does not build with ghcjs or ghc 8.10.1 yet (lookup-sha256 and fully-static build pandoc) - lookup-sha256 = callTest ./lookup-sha256 {}; + lookup-sha256 = callTest ./lookup-sha256 { inherit compiler-nix-name; }; fully-static = callTest ./fully-static { inherit (pkgs) buildPackages; }; - } // lib.optionalAttrs (pkgs.haskell-nix.defaultCompilerNixName != "ghc8101") { - # This test makes a plan for building cabal 3.2 using index-states that will - # never work with ghc 8.10.1 - index-state = callTest ./index-state {}; } // lib.optionalAttrs (!pkgs.haskell-nix.haskellLib.isCrossHost) { # Haddock is not included with cross compilers currently - sublib-docs = callTest ./sublib-docs { inherit util; }; + sublib-docs = callTest ./sublib-docs { inherit util compiler-nix-name; }; }; # This is the same as allTests, but filter out all the key/vaules from the @@ -218,7 +216,7 @@ let in pkgs.recurseIntoAttrs { - haskellNixRoots = haskell-nix.haskellNixRoots' ifdLevel; + roots = haskell-nix.roots' compiler-nix-name ifdLevel; } // optionalIfdTests ifdLevel ## more possible test cases diff --git a/test/exe-only/default.nix b/test/exe-only/default.nix index 3e242c9ede..812410d97c 100644 --- a/test/exe-only/default.nix +++ b/test/exe-only/default.nix @@ -1,10 +1,11 @@ # Test a package set -{ stdenv, util, haskell-nix, recurseIntoAttrs, haskellLib, testSrc }: +{ stdenv, util, haskell-nix, recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }: with stdenv.lib; let project = haskell-nix.cabalProject' { + inherit compiler-nix-name; src = testSrc "exe-only"; }; diff --git a/test/extra-hackage/default.nix b/test/extra-hackage/default.nix index eae8e1480f..9d0e26568a 100644 --- a/test/extra-hackage/default.nix +++ b/test/extra-hackage/default.nix @@ -1,4 +1,4 @@ -{ stdenv, cabalProject', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; @@ -14,6 +14,7 @@ let demo-src = ./external-package-demo-0.1.0.0.tar.gz; project = cabalProject' { + inherit compiler-nix-name; src = testSrc "extra-hackage/external-package-user"; extra-hackages = [ hackage ]; @@ -27,7 +28,7 @@ let }; packages = project.hsPkgs; -in project // (recurseIntoAttrs { +in recurseIntoAttrs { ifdInputs = { inherit (project) plan-nix; }; @@ -66,4 +67,4 @@ in project // (recurseIntoAttrs { inherit project; }; }; -}) +} diff --git a/test/fully-static/cross.nix b/test/fully-static/cross.nix index b4cc3f12db..fe25d12e75 100644 --- a/test/fully-static/cross.nix +++ b/test/fully-static/cross.nix @@ -1,5 +1,5 @@ { pkgs ? import nixpkgs { } -, nixpkgs ? import (../../nixpkgs).nixpkgs-default +, nixpkgs ? import (../../nix/sources.nix).nixpkgs }: let diff --git a/test/ghc-options/cabal.nix b/test/ghc-options/cabal.nix index 006fee2203..2f1463ae22 100644 --- a/test/ghc-options/cabal.nix +++ b/test/ghc-options/cabal.nix @@ -1,9 +1,10 @@ -{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc }: +{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; index-state = "2020-05-25T00:00:00Z"; src = testSrc "ghc-options"; # TODO find a way to get the ghc-options into plan.json so we can use it in plan-to-nix diff --git a/test/haskell-language-server/cabal.nix b/test/haskell-language-server/cabal.nix index dfccfac9ec..4a1e6b05de 100644 --- a/test/haskell-language-server/cabal.nix +++ b/test/haskell-language-server/cabal.nix @@ -1,6 +1,7 @@ -{ testSrc, evalPackages, buildPackages }: +{ testSrc, evalPackages, buildPackages, compiler-nix-name }: (buildPackages.haskell-nix.project { + inherit compiler-nix-name; src = evalPackages.fetchgit { url = "https://github.com/haskell/haskell-language-server.git"; fetchSubmodules = true; diff --git a/test/haskell-language-server/stack.nix b/test/haskell-language-server/stack.nix index 5f60248594..1ea4ed40a6 100644 --- a/test/haskell-language-server/stack.nix +++ b/test/haskell-language-server/stack.nix @@ -1,13 +1,14 @@ -{ testSrc, haskell-nix, evalPackages, buildPackages }: +{ testSrc, haskell-nix, evalPackages, buildPackages, compiler-nix-name }: (buildPackages.haskell-nix.project { + inherit compiler-nix-name; src = evalPackages.fetchgit { url = "https://github.com/haskell/haskell-language-server.git"; fetchSubmodules = true; rev = "d2654185eef1b0d703cebc694e85438e20600e37"; sha256 = "0s0k2i0imkcn9zykhrlqq0r4ssv25mwbpdyc675xkzgl1vj1l8kd"; }; - projectFileName = "stack-${haskell-nix.ghc.version}.yaml"; + projectFileName = "stack-${haskell-nix.compiler.${compiler-nix-name}.version}.yaml"; sha256map = { "https://github.com/wz1000/shake.git"."fb3859dca2e54d1bbb2c873e68ed225fa179fbef" = "0sa0jiwgyvjsmjwpfcpvzg2p7277aa0dgra1mm6afh2rfnjphz8z"; "https://github.com/peti/cabal-plan.git"."894b76c0b6bf8f7d2f881431df1f13959a8fce87" = "06iklj51d9kh9bhc42lrayypcpgkjrjvna59w920ln41rskhjr4y"; diff --git a/test/index-state/default.nix b/test/index-state/default.nix index 76c4da27c0..04560e741d 100644 --- a/test/index-state/default.nix +++ b/test/index-state/default.nix @@ -1,14 +1,18 @@ # Test a package set -{ stdenv, testSrc, tool }: +{ stdenv, testSrc, tool, compiler-nix-name }: with stdenv.lib; let # The hackage-security 0.6.0.1 was uploaded at 2020-04-06T20:54:35Z # See https://hackage.haskell.org/package/hackage-security-0.6.0.1 - version-used-at = index-state: (tool "cabal" { + version-used-at = index-state: (tool compiler-nix-name "cabal" { version = "3.2.0.0"; inherit index-state; + cabalProject = '' + packages: . + allow-newer: cabal-install:base, hackage-security:* + ''; }).project.hsPkgs.hackage-security.components.library.version; version-before = version-used-at "2020-04-06T20:54:34Z"; version-after = version-used-at "2020-04-06T20:54:35Z"; diff --git a/test/lookup-sha256/default.nix b/test/lookup-sha256/default.nix index b21a68e325..e0019b80dc 100644 --- a/test/lookup-sha256/default.nix +++ b/test/lookup-sha256/default.nix @@ -1,5 +1,6 @@ -{ pkgs, lib, stdenv, haskell-nix, testSrc, zlib } : +{ pkgs, lib, stdenv, haskell-nix, testSrc, zlib, compiler-nix-name } : (haskell-nix.hackage-package { + inherit compiler-nix-name; name = "pandoc"; version = "2.9.2.1"; index-state = "2020-05-25T00:00:00Z"; diff --git a/test/project-flags/cabal.nix b/test/project-flags/cabal.nix index bf16af12ad..09cb224088 100644 --- a/test/project-flags/cabal.nix +++ b/test/project-flags/cabal.nix @@ -1,9 +1,10 @@ -{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc }: +{ stdenv, cabalProject', recurseIntoAttrs, haskellLib, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; index-state = "2020-05-25T00:00:00Z"; src = testSrc "project-flags"; }; diff --git a/test/regen.nix b/test/regen.nix index 5f1533a08e..aa0af8e1ba 100644 --- a/test/regen.nix +++ b/test/regen.nix @@ -3,7 +3,7 @@ let haskellNix = (import ../default.nix {}); in { pkgs ? import nixpkgs nixpkgsArgs -, nixpkgs ? haskellNix.sources.nixpkgs-default +, nixpkgs ? haskellNix.sources.nixpkgs , nixpkgsArgs ? haskellNix.nixpkgsArgs }: diff --git a/test/setup-deps/default.nix b/test/setup-deps/default.nix index 5465bf5936..80ed2f52a5 100644 --- a/test/setup-deps/default.nix +++ b/test/setup-deps/default.nix @@ -1,10 +1,11 @@ -{ pkgs }: +{ pkgs, compiler-nix-name }: with pkgs; with stdenv.lib; let project = haskell-nix.cabalProject' { + inherit compiler-nix-name; src = pkgs.haskell-nix.haskellLib.cleanGit { src = ../..; name = "setup-deps"; subDir = "test/setup-deps"; }; modules = [{ # Package has no exposed modules which causes diff --git a/test/shell-for-setup-deps/default.nix b/test/shell-for-setup-deps/default.nix index 35ea5f562b..0b1f7b2626 100644 --- a/test/shell-for-setup-deps/default.nix +++ b/test/shell-for-setup-deps/default.nix @@ -1,9 +1,10 @@ -{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand, testSrc }: +{ stdenv, cabal-install, cabalProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; src = testSrc "shell-for-setup-deps"; modules = [{ # Package has no exposed modules which causes diff --git a/test/shell-for/default.nix b/test/shell-for/default.nix index 610b8916f2..e88b8e973c 100644 --- a/test/shell-for/default.nix +++ b/test/shell-for/default.nix @@ -22,7 +22,7 @@ let packages = ps: with ps; [ pkga pkgb ]; # This adds cabal-install to the shell, which helps tests because # they use a nix-shell --pure. Normally you would BYO cabal-install. - buildInputs = [ cabal-install ]; + tools = { cabal = "3.2.0.0"; }; exactDeps = true; }; @@ -31,7 +31,7 @@ let packages = ps: with ps; [ pkga ]; # This adds cabal-install to the shell, which helps tests because # they use a nix-shell --pure. Normally you would BYO cabal-install. - buildInputs = [ cabal-install ]; + tools = { cabal = "3.2.0.0"; }; exactDeps = true; }; @@ -41,7 +41,7 @@ let # packages = ps: with ps; [ pkga pkgb ]; # This adds cabal-install to the shell, which helps tests because # they use a nix-shell --pure. Normally you would BYO cabal-install. - buildInputs = [ cabal-install ]; + tools = { cabal = "3.2.0.0"; }; }; in recurseIntoAttrs (if stdenv.hostPlatform.isWindows diff --git a/test/sublib-docs/default.nix b/test/sublib-docs/default.nix index a1550e75d3..7603fe0645 100644 --- a/test/sublib-docs/default.nix +++ b/test/sublib-docs/default.nix @@ -1,10 +1,11 @@ # Test a package set -{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc }: +{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }: with stdenv.lib; let project = cabalProject' { + inherit compiler-nix-name; src = testSrc "sublib-docs"; }; diff --git a/test/tests.sh b/test/tests.sh index d56e3007d1..8503b19015 100755 --- a/test/tests.sh +++ b/test/tests.sh @@ -7,6 +7,13 @@ NIX_BUILD_ARGS="${NIX_BUILD_ARGS:-}" cd $(dirname $0) +if [ "$#" != "1" ]; then + echo "Please pass a compiler-nix-name to use. For example: ./test/test.sh ghc883" + exit 1 +fi + +GHC=$1 + printf "*** Cleaning package build directories..." >& 2 rm -rvf */cabal.project.local */.ghc.environment* */dist */dist-newstyle */.stack-work echo >& 2 @@ -16,11 +23,12 @@ nix build $NIX_BUILD_ARGS \ -I . -I .. \ --option restrict-eval true \ --option allowed-uris "https://github.com/NixOS https://github.com/input-output-hk" \ - --no-link --keep-going -f default.nix + --no-link --keep-going -f default.nix \ + --argstr compiler-nix-name $GHC echo >& 2 printf "*** Running the unit tests... " >& 2 -res=$(nix-instantiate --eval --json --strict ./default.nix -A unit.tests) +res=$(nix-instantiate --eval --json --strict ./default.nix --argstr compiler-nix-name $GHC -A unit.tests) num_failed=$(jq length <<< "$res") if [ $num_failed -eq 0 ]; then printf "PASSED\n" >& 2 @@ -33,6 +41,7 @@ fi printf "*** Checking that a nix-shell works for runghc...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A with-packages.test-shell \ --run 'runghc with-packages/Point.hs' echo >& 2 @@ -40,6 +49,7 @@ echo >& 2 printf "*** Checking that a nix-shell works for cabal...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A with-packages.test-shell \ --run 'echo CABAL_CONFIG=$CABAL_CONFIG && type -p ghc && cd with-packages && cabal new-build' echo >& 2 @@ -47,6 +57,7 @@ echo >& 2 printf "*** Checking that a nix-shell works for cabal (doExactConfig component)...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A with-packages.test-shell-dec \ --run 'echo CABAL_CONFIG=$CABAL_CONFIG && echo GHC_ENVIRONMENT=$GHC_ENVIRONMENT && cd with-packages && cabal new-build' echo >& 2 @@ -55,6 +66,7 @@ printf "*** Checking that a nix-shell works for a project with test-suite build- printf "!!! This is expected to fail until https://github.com/input-output-hk/haskell.nix/issues/231 is resolved! \n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A cabal-22.shell \ --run 'cd cabal-22 && cabal new-build all --enable-tests --enable-benchmarks' \ || true @@ -63,6 +75,7 @@ echo >& 2 printf "*** Checking that a nix-shell works for a multi-target project...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A cabal-simple.test-shell \ --run 'cd cabal-simple && cabal new-build' echo >& 2 @@ -70,6 +83,7 @@ echo >& 2 printf "*** Checking shellFor works for a cabal project, multiple packages...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A shell-for.env \ --run 'cd shell-for && cabal new-build all' echo >& 2 @@ -77,6 +91,7 @@ echo >& 2 printf "*** Checking shellFor works for a cabal project, single package...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A shell-for.envPkga \ --run 'cd shell-for && cabal new-build --project=single.project all' echo >& 2 @@ -84,14 +99,15 @@ echo >& 2 printf "*** Checking shellFor has a working hoogle index...\n" >& 2 nix-shell $NIX_BUILD_ARGS \ --pure ./default.nix \ + --argstr compiler-nix-name $GHC \ -A shell-for.env \ --run 'hoogle ConduitT | grep Data.Conduit' echo >& 2 printf "*** Checking shellFor does not depend on given packages...\n" >& 2 -drva=$(nix-instantiate ./default.nix -A shell-for.env) +drva=$(nix-instantiate ./default.nix --argstr compiler-nix-name $GHC -A shell-for.env) echo "-- hello" >> shell-for/pkga/PkgA.hs -drvb=$(nix-instantiate ./default.nix -A shell-for.env) +drvb=$(nix-instantiate ./default.nix --argstr compiler-nix-name $GHC -A shell-for.env) sed -i -e '/-- hello/d' shell-for/pkga/PkgA.hs if [ "$drva" != "$drvb" ]; then printf "FAIL\nShell derivations\n$drva\n$drvb\n are not identical.\n" >& 2 @@ -101,19 +117,19 @@ else fi printf "*** Checking the maintainer scripts...\n" >& 2 -nix build $NIX_BUILD_ARGS --no-link --keep-going -f ../build.nix maintainer-scripts +nix build $NIX_BUILD_ARGS --no-link --keep-going -f ../build.nix --argstr compiler-nix-name $GHC maintainer-scripts echo >& 2 printf "*** Checking that plan construction works with extra Hackages...\n" >& 2 nix build $NIX_BUILD_ARGS --no-link \ - -f ./default.nix \ - extra-hackage.plan-nix + -f ./default.nix --argstr compiler-nix-name $GHC \ + extra-hackage.run.project.plan-nix echo >& 2 printf "*** Checking that package with extra Hackages can be build...\n" >& 2 nix build $NIX_BUILD_ARGS --no-link \ - -f ./default.nix \ - extra-hackage.hsPkgs.external-package-user.components.all + -f ./default.nix --argstr compiler-nix-name $GHC \ + extra-hackage.run.project.hsPkgs.external-package-user.components.all echo >& 2 printf "\n*** Finished successfully\n" >& 2