Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update haskell.nix and fix windows cross #2655

Closed

Conversation

hamishmack
Copy link
Contributor

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).

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).
Copy link
Contributor

@angerman angerman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neat!

@mrBliss
Copy link
Contributor

mrBliss commented Oct 2, 2020

Much appreciated! I'll try it out in #2540.

@mrBliss
Copy link
Contributor

mrBliss commented Oct 2, 2020

Hmm, if I cherry-pick this commit in #2540, I get evaluation errors: https://hydra.iohk.io/jobset/Cardano/ouroboros-network-pr-2540#tabs-errors

...
error: build of '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' on 'ssh://root@packet-ipxe-3.ci.iohkdev.io' failed: dependency '/nix/store/ygp5pjsdbd1bxakni1vg3dwhw1fjdkr0-Cabal-lib-Cabal-3.2.0.0' of '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' does not exist, and substitution is disabled
builder for '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' failed with exit code 1
cannot build derivation '/nix/store/yz7swf2zh7wp28v5pbh3ry2mnyg2hady-hackage-db-lib-hackage-db-2.1.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/407a4a127k8cjyk4xarby9l9aa6gzbxh-nix-tools-exe-hackage-to-nix-0.1.0.0-config.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1ww63h6jxg9gaa7mfvbvv224w5cyh39c-nix-tools-exe-hackage-to-nix-0.1.0.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5whf37wby1snp1b72lckxhsgcr6hn5q4-nix-tools.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4c1l4871068mw5kfxrypz83hcr31dpb5-ouroboros-network-src-plan-to-nix-pkgs.drv': 1 dependencies couldn't be built
error: "build of '/nix/store/4c1l4871068mw5kfxrypz83hcr31dpb5-ouroboros-network-src-plan-to-nix-pkgs.drv' failed"
error: unexpected EOF reading a line

@angerman
Copy link
Contributor

angerman commented Oct 2, 2020

Hmm, if I cherry-pick this commit in #2540, I get evaluation errors: https://hydra.iohk.io/jobset/Cardano/ouroboros-network-pr-2540#tabs-errors

...
error: build of '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' on 'ssh://root@packet-ipxe-3.ci.iohkdev.io' failed: dependency '/nix/store/ygp5pjsdbd1bxakni1vg3dwhw1fjdkr0-Cabal-lib-Cabal-3.2.0.0' of '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' does not exist, and substitution is disabled
builder for '/nix/store/q050k9dhccqdpfd001fh3g1p104nfzq8-hackage-db-lib-hackage-db-2.1.0-config.drv' failed with exit code 1
cannot build derivation '/nix/store/yz7swf2zh7wp28v5pbh3ry2mnyg2hady-hackage-db-lib-hackage-db-2.1.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/407a4a127k8cjyk4xarby9l9aa6gzbxh-nix-tools-exe-hackage-to-nix-0.1.0.0-config.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1ww63h6jxg9gaa7mfvbvv224w5cyh39c-nix-tools-exe-hackage-to-nix-0.1.0.0.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/5whf37wby1snp1b72lckxhsgcr6hn5q4-nix-tools.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/4c1l4871068mw5kfxrypz83hcr31dpb5-ouroboros-network-src-plan-to-nix-pkgs.drv': 1 dependencies couldn't be built
error: "build of '/nix/store/4c1l4871068mw5kfxrypz83hcr31dpb5-ouroboros-network-src-plan-to-nix-pkgs.drv' failed"
error: unexpected EOF reading a line

This kinda sounds like a corrupted nix derivation?

@mrBliss
Copy link
Contributor

mrBliss commented Oct 13, 2020

I should have merged this in #2540 instead of cherry-picking. Closing.

@mrBliss mrBliss closed this Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants