Skip to content

Commit e610c27

Browse files
hamishmackmrBliss
authored andcommitted
Update haskell.nix and fix windows cross
Currently the use of nonReinstallablePkgs to make the Win32 reinstallable breaks cross compilation of any package using a custom-setup. This is because nonReinstallablePkgs is applied unconditionally and therefor applies to the "build" packages that are used for compiling the setup executables. The work around has been to add `buildType - lib.mkForce "Simple"` to any packages that use a custom setup executable. Maintaining this list is annoying and difficult (in part because the error message given when a package needs to be added a long way from clear). It turns out the correct fix is to make the override for nonReinstallablePkgs conditional and the correct way to do that is to use `pkgs` from the module arguments to detect when the `hostPlatform.isWindows`. We also need to use `mkIf` to avoid infinite recursion. So the windows specific module is now wrapped in: ``` ({ pkgs, ... }: lib.mkIf pkgs.stdenv.hostPlatform.isWindows {...}) ``` This change also updates to a more recent `haskell.nix` commit and removes the references to the `.all` components (they have been removed from haskell.nix).
1 parent fe19347 commit e610c27

File tree

2 files changed

+21
-29
lines changed

2 files changed

+21
-29
lines changed

nix/haskell.nix

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,6 @@ let
3333
compiler-nix-name = compiler;
3434
modules = [
3535

36-
# Allow reinstallation of Win32
37-
{ nonReinstallablePkgs =
38-
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
39-
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
40-
# ghcjs custom packages
41-
"ghcjs-prim" "ghcjs-th"
42-
"ghc-boot"
43-
"ghc" "array" "binary" "bytestring" "containers"
44-
"filepath" "ghc-boot" "ghc-compact" "ghc-prim"
45-
# "ghci" "haskeline"
46-
"hpc"
47-
"mtl" "parsec" "text" "transformers"
48-
"xhtml"
49-
# "stm" "terminfo"
50-
];
51-
}
5236
# Compile all local packages with -Werror:
5337
{
5438
packages = lib.genAttrs projectPackages
@@ -57,15 +41,22 @@ let
5741
{
5842
enableLibraryProfiling = profiling;
5943
}
60-
(if stdenv.hostPlatform.isWindows then {
61-
# Disable cabal-doctest tests by turning off custom setups
62-
packages.comonad.package.buildType = lib.mkForce "Simple";
63-
packages.distributive.package.buildType = lib.mkForce "Simple";
64-
packages.generic-data.package.buildType = lib.mkForce "Simple";
65-
packages.nonempty-vector.package.buildType = lib.mkForce "Simple";
66-
packages.semigroupoids.package.buildType = lib.mkForce "Simple";
67-
packages.system-filepath.package.buildType = lib.mkForce "Simple";
68-
44+
({ pkgs, ... }: lib.mkIf pkgs.stdenv.hostPlatform.isWindows {
45+
# Allow reinstallation of Win32
46+
nonReinstallablePkgs =
47+
[ "rts" "ghc-heap" "ghc-prim" "integer-gmp" "integer-simple" "base"
48+
"deepseq" "array" "ghc-boot-th" "pretty" "template-haskell"
49+
# ghcjs custom packages
50+
"ghcjs-prim" "ghcjs-th"
51+
"ghc-boot"
52+
"ghc" "array" "binary" "bytestring" "containers"
53+
"filepath" "ghc-boot" "ghc-compact" "ghc-prim"
54+
# "ghci" "haskeline"
55+
"hpc"
56+
"mtl" "parsec" "text" "transformers"
57+
"xhtml"
58+
# "stm" "terminfo"
59+
];
6960
# ruby/perl dependencies cannot be cross-built for cddl tests:
7061
packages.ouroboros-network.flags.cddl = false;
7162

@@ -85,7 +76,8 @@ let
8576
packages.ouroboros-consensus-test.components.tests.test-consensus.postInstall = ''ln -s ${libsodium}/bin/libsodium-23.dll $out/bin/libsodium-23.dll'';
8677
packages.ouroboros-consensus-test.components.tests.test-infra.postInstall = ''ln -s ${libsodium}/bin/libsodium-23.dll $out/bin/libsodium-23.dll'';
8778
packages.ouroboros-consensus-test.components.tests.test-storage.postInstall = ''ln -s ${libsodium}/bin/libsodium-23.dll $out/bin/libsodium-23.dll'';
88-
} else {
79+
})
80+
({ pkgs, ... }: lib.mkIf (!pkgs.stdenv.hostPlatform.isWindows) {
8981
packages.ouroboros-network.flags.cddl = true;
9082
packages.ouroboros-network.components.tests.test-cddl.build-tools = [pkgs.cddl pkgs.cbor-diag];
9183
packages.ouroboros-network.components.tests.test-cddl.preCheck = "export HOME=`pwd`";

nix/sources.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"homepage": "https://input-output-hk.github.io/haskell.nix",
66
"owner": "input-output-hk",
77
"repo": "haskell.nix",
8-
"rev": "c639cbe655725d6389b225af867cd413ca99c7d9",
9-
"sha256": "0ri8w0s7925lpgq8jgijrgzwcpydx660mkskiqq02d3ac1lcq273",
8+
"rev": "6134e66e1decf2155ba500dd5de00adb06e2cdee",
9+
"sha256": "1w6mvlblszl3spx46m3a4bz13xah18gkznzpk0fzkmfizasv7lgi",
1010
"type": "tarball",
11-
"url": "https://github.com/input-output-hk/haskell.nix/archive/c639cbe655725d6389b225af867cd413ca99c7d9.tar.gz",
11+
"url": "https://github.com/input-output-hk/haskell.nix/archive/6134e66e1decf2155ba500dd5de00adb06e2cdee.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"iohk-nix": {

0 commit comments

Comments
 (0)