lukexi / halive

Live recompiler for Haskell
BSD 2-Clause "Simplified" License
263 stars 18 forks source link

Fails on NixOS #36

Open turion opened 4 years ago

turion commented 4 years ago

For some reason, halive tries to open a GHC that doesn't exist. It's probably saving an incorrect path:

$ halive My/File.hs
██╗  ██╗ █████╗ ██╗     ██╗██╗   ██╗███████╗
██║  ██║██╔══██╗██║     ██║██║   ██║██╔════╝
███████║███████║██║     ██║██║   ██║█████╗  
██╔══██║██╔══██║██║     ██║╚██╗ ██╔╝██╔══╝  
██║  ██║██║  ██║███████╗██║ ╚████╔╝ ███████╗
╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═══╝  ╚══════╝
                  engaged
halive: /nix/store/mz4mmizf0h33q3sybibkp476a7ixkpq7-ghc-8.6.5-with-packages/lib/ghc-8.6.5/settings: openFile: does not exist (No such file or directory)
halive: thread blocked indefinitely in an MVar operation
turion commented 4 years ago

In fact the store file doesn't exist:

$ ls /nix/store/mz4mmizf0h33q3sybibkp476a7ixkpq7-ghc-8.6.5-with-packages/
ls: cannot access '/nix/store/mz4mmizf0h33q3sybibkp476a7ixkpq7-ghc-8.6.5-with-packages/': No such file or directory
turion commented 4 years ago

I've tried to build halive using Nix directly:

{ nixpkgs ? import <nixpkgs> {} }:

let haskellPackages = nixpkgs.pkgs.haskellPackages.override {
    overrides = super: self: {
      halive = super.callCabal2nix "halive" ./. {
        mkDerivation = args: self.mkDerivation (args // { doCheck = false; });
      };
    };
  };
in
haskellPackages.halive

But it fails because halive references something in /build:

...
checking for references to /build/ in /nix/store/dixcmngccxgl9c5kkcs70yrzsak0fkra-halive-0.1.6...
RPATH of binary /nix/store/dixcmngccxgl9c5kkcs70yrzsak0fkra-halive-0.1.6/bin/halive contains a forbidden reference to /build/
builder for '/nix/store/aqpfrhvcr0sgjidr07346h9ixmff3r8f-halive-0.1.6.drv' failed with exit code 1
error: build of '/nix/store/aqpfrhvcr0sgjidr07346h9ixmff3r8f-halive-0.1.6.drv' failed

Does halive somehow remember the GHC with which is what built? Is it possible to configure this GHC in the build process?