Haskell package ignoring bounds on Darwin?

The following command is succesfull on Darwin but fails on a NixOS machine:

nix-shell -p '(import (((import <nixpkgs> {}).fetchFromGitHub {
    owner = "NixOS";
    repo  = "nixpkgs";
    rev = "23fd1394dc6bef03a2ff010278a24403a97f0647";
    sha256 = "1snry2ab0gjhg394ryfw8jwswjyj31fjxv79pxk219r76031fx20";
})) {}).haskell.packages.ghc844.ghcWithPackages (pkgs: [ pkgs.system-fileio ])'

The linux build fails with:

...
Configuring system-fileio-0.3.16.4...
CallStack (from HasCallStack):
  die', called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:958:20 in Cabal-2.2.0.1:Distribution.Simple.Configure
  configureFinalizedPackage, called at libraries/Cabal/Cabal/Distribution/Simple/Configure.hs:462:12 in Cabal-2.2.0.1:Distribution.Simple.Configure
  configure, called at libraries/Cabal/Cabal/Distribution/Simple.hs:596:20 in Cabal-2.2.0.1:Distribution.Simple
  confHook, called at libraries/Cabal/Cabal/Distribution/Simple/UserHooks.hs:67:5 in Cabal-2.2.0.1:Distribution.Simple.UserHooks
  configureAction, called at libraries/Cabal/Cabal/Distribution/Simple.hs:178:19 in Cabal-2.2.0.1:Distribution.Simple
  defaultMainHelper, called at libraries/Cabal/Cabal/Distribution/Simple.hs:115:27 in Cabal-2.2.0.1:Distribution.Simple
  defaultMain, called at Setup.hs:2:8 in main:Main
Setup: Encountered missing dependencies:
chell ==0.4.*
...

The bound on system-fileio version 0.3.16.4 indeed constraints chell to chell >= 0.4 && < 0.5 (source), but the used nixpkgs contains only chell v0.5:

nix-instantiate --eval -E '(import (((import <nixpkgs> {}).fetchFromGitHub {
    owner = "NixOS";
    repo  = "nixpkgs";
    rev = "23fd1394dc6bef03a2ff010278a24403a97f0647";
    sha256 = "1snry2ab0gjhg394ryfw8jwswjyj31fjxv79pxk219r76031fx20";
})) {}).haskell.packages.ghc844.chell.version'
"0.5"

so the failure is to be expected.

There don’t seem to be any overrides in nixpkgs related to system-fileio as far as I could see.

I am really more interested in how this happened rather than how to fix it (I can just manually override the package).

Unrelated, but please use builtins.fetchGit instead of nixpkgs.fetchFromGitHub to avoid importing from a derivation.

2 Likes

builtins.fetchGit is disabled in pure evaluation mode though, so I cannot pin my nixpkgs if I want to run it in hydra

chell is a test suite dependency of system-fileio. Most likely someone has set dontCheck on Darwin

ok, I just forgot that I need to add the repo url in the allowed-uris nix configuration option.

You were right - it’s set in configuration-nix.nix:

# the system-fileio tests use canonicalizePath, which fails in the sandbox
system-fileio = if pkgs.stdenv.isDarwin then dontCheck super.system-fileio else super.system-fileio;

I get the same behaviour with master:

nix-shell -p '(import (builtins.fetchGit {
    url = "https://github.com/NixOS/nixpkgs.git";
    ref = "master";
}) {}).haskell.packages.ghc844.ghcWithPackages (pkgs: [ pkgs.system-fileio ])'

I’m finding it a bit confusing that some packages are marked as broken, but some are not but still fail to build.

Should I submit a PR to disable the tests on all platforms?