Profpatsch / libnix-haskell

Haskell library to interface with the nix package manager
GNU General Public License v3.0
25 stars 2 forks source link

Using libnix-haskell within cabal2nix results in test failures #1

Closed nzhang-zh closed 2 years ago

nzhang-zh commented 5 years ago

Hi, when using this library under cabal2nix, we get test failures:

Preprocessing test suite 'tests' for libnix-0.2.0.1..
Building test suite 'tests' for libnix-0.2.0.1..
[1 of 2] Compiling TestShellout     ( tests/TestShellout.hs, dist/build/tests/tests-tmp/TestShellout.o )
[2 of 2] Compiling Main             ( tests/Main.hs, dist/build/tests/tests-tmp/Main.o )
Linking dist/build/tests/tests ...
running tests
Running 1 test suites...
Test suite tests: RUNNING...
shellout tests
  parsing
    syntax error:                       FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
  evaluating
    infinite recursion:                 FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
    not a derivation:                   FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
    a basic derivation:                 FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
  realizing
    nixpkgs is accessible:              FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
    nixpkgs multiline stderr it parsed: FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
    build the GNU hello package:        FAIL
      Exception: nix-instantiate: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
    copy a temporary file to store:     FAIL
      Exception: nix-store: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

8 out of 8 tests failed (0.00s)
Test suite tests: FAIL
Test suite logged to: dist/test/libnix-0.2.0.1-tests.log
0 of 1 test suites (0 of 1 test cases) passed.
builder for '/nix/store/vdnkknix4c0czdkcrn5i2c5r3gj54b9f-libnix-0.2.0.1.drv' failed with exit code 1
cannot build derivation '/nix/store/mdq71h78kizf57q2zbiv8n84xc1gq99z-ghc-8.4.3-with-packages.drv': 1 dependencies couldn't be built
error: build of '/nix/store/mdq71h78kizf57q2zbiv8n84xc1gq99z-ghc-8.4.3-with-packages.drv' failed

We put libnix in the dependencies of our package.yaml, and then we use cabal2nix to generate the cabal.nix file with the --hpack flag. We're running on NixOS inside a nix-shell. But it seems we are missing somethings in our build/test environment. We tried putting nix and nix-prefetch-scripts into the build-tools section as well, but the same error occurred.

Profpatsch commented 5 years ago

Running nix within a nix build requires setting up a local nix store. I’d just disable the tests for now, here’s a PR for that: https://github.com/NixOS/nixpkgs/pull/50733