Skip to content

TMPDIR handling by nix-shell #395

@michaeljones

Description

@michaeljones

Hi,

Lethalman in #nixos has asked me to report this. I've had trouble with building a Haskell Yesod project using a nix-shell on Ubuntu 14.04. I get a GHC panic error when building with:

nix-shell --pure
eval "$configurePhase"
eval "$buildPhase"

But not when building with nix-build. My setup is the standard code that you get from yesod init along with the following default.nix:

{ haskellPackages ? (import <nixpkgs> {}).haskellPackages }:

let inherit (haskellPackages);

in with haskellPackages; cabal.mkDerivation (self: {
  pname = "cal";
  version = "0.0.1";
  src = ./.;
  buildDepends = with haskellPackages; [
    yesod yesodStatic yesodTest
    yesodBin
    hjsmin persistentSqlite hspec
    ];
  buildTools = with haskellPackages; [ cabalInstall ];
})

It seems to come down to my normal shell not having TMPDIR set (I'm not sure why) so when I use nix-shell --pure it is picking up the XDG_RUNTIME_DIR=/run/user/1000/ and using that as the TMP directory. Lethalman pointed to this line.

That directory was then potentially upsetting GHC as it didn't have the correct permissions or something. I'm unfortunately new to nix & haskell so I am reporting what others have told me. Happy to help where I can though.

Cheers,
Michael

Metadata

Metadata

Assignees

No one assigned

    Labels

    UXThe way in which users interact with Nix. Higher level than UI.nix-shellnix-shell, nix develop, nix print-dev-env, etc

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions