Skip to content

Conversation

wolfgangwalther
Copy link
Contributor

Description of changes

The default for doCheck is meant to disable tests, when they can't be executed in cross environments. However, pkgsStatic and some other package sets are technically implemented as cross, even though the binaries can be executed just fine. Using canExecute is a much better check for this, thus enabling test on pkgsStatic by default.

I found one package already which has broken tests for pkgsStatic only, thus I disabled them. There are very likely many more, but we'd need to build many more packages to find out...

Things done

  • Built on platform(s)
    • x86_64-linux (packages mentioned for pkgsStatic in release-haskell)
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@github-actions github-actions bot added the 6.topic: haskell General-purpose, statically typed, purely functional programming language label Sep 15, 2024
Comment on lines +2277 to +2269
# Preprocessing test suite 'hashable-tests' for hashable-1.4.4.0..
# Mmap.hsc: In function ‘_hsc2hs_test13’:
# Mmap.hsc:54:20: error: storage size of ‘test_array’ isn’t constant
# compilation failed
hashable = dontCheckIf pkgs.stdenv.hostPlatform.isStatic super.hashable;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know whether that's a problem with hashable, hsc2hs or nixpkgs. Any ideas?

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Sep 15, 2024
@sternenseemann
Copy link
Member

@ofborg build pkgsStatic.cachix

@sternenseemann
Copy link
Member

@ofborg build pkgsStatic.haskellPackages.cabal2nix

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
@wolfgangwalther wolfgangwalther removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Dec 21, 2024
The default for doCheck is meant to disable tests, when they can't be
executed in cross environments. However, pkgsStatic and some other
package sets are technically implemented as cross, even though the
binaries can be executed just fine. Using canExecute is a much better
check for this, thus enabling tests on pkgsStatic by default.
@wolfgangwalther
Copy link
Contributor Author

pkgsStatic.cachix

This fails to build on master right now as well, because git doesn't build in pkgsStatic.

pkgsStatic.haskellPackages.cabal2nix

On my way t building that I got the same build failure for 3 packages in a row - and I assume there are going to be many more:

       > Building test suite 'spec' for http-types-0.12.4..
       > ghc: could not execute: hspec-discover

This is because of code similar to this:

https://github.com/Vlix/http-types/blob/master/test/Spec.hs#L1C2-L1C44

I'm not sure, yet, whether that's because hspec-discover is prefixed somehow or whether it's not passed as nativeBuildInput or ... I don't know.

In any case, this needs a generic solution.

@wolfgangwalther
Copy link
Contributor Author

I'm not sure, yet, whether that's because hspec-discover is prefixed somehow or whether it's not passed as nativeBuildInput or ... I don't know.

It seems like the generic-builder doesn't support propagatedNativeBuildInputs, which I think we'd need here?

hspec has hspec-discover as libraryHaskellDepends, which is added to propagatedBuildInputs, which.. doesn't help us here.

@wolfgangwalther wolfgangwalther marked this pull request as draft January 11, 2025 11:00
@sternenseemann
Copy link
Member

@wolfgangwalther In the case of http-types, this is a bug in the upstream package description neglecting to declare hspec-discover a s a build-tool necessary for building the test suite – an issue, upstream has fixed since (unreleased unfortunately).

I suspect that there may be many cases like this where the propagation of libraryHaskellDepends causes them to be available in PATH anyways. We could try to weed out such cases by setting strictDeps = true in haskellPackages.mkDerivation, but there may be significant regressions, actually.

I'd assume that hspec-discover works fine in cases where the upstream package meta data is okay.

@sternenseemann
Copy link
Member

E.g. haskellPackages.BNFC works in pkgsStatic with this PR which also uses hspec-discover!

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 7, 2025
@nixpkgs-ci nixpkgs-ci bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Aug 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: haskell General-purpose, statically typed, purely functional programming language 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants