Search code examples
haskellnixos

NixOS and ghcWithPackages - possibly incorrect information in the wiki


I'm referring here to the page: Haskell - Nix Wiki, both the heading Local use via Nixpkgs config and System-wide use via NixOS config.

Here are the steps to replicate the problem: I download the NixOS-14.04 virtual appliance, load it in Virtual box, and try the System-wide use, so that my configuration.nix is:

{ config, pkgs, ... }:

{
  imports = [ <nixos/modules/installer/virtualbox-demo.nix> ];

  environment.systemPackages = [
      # other system packages
      (pkgs.haskellPackages.ghcWithPackages (self : [
        self.haskellPlatform
    ]))
  ];
}

This is the output of nixos-rebuild test --show-trace -v

When I try the local option setting .nixpkgs/config.nix, here is the output of $ nix-env -iA nixos.pkgs.hsEnv.

The errors seem to me very similar, and so I suspect there may be an error in ghcWithPackages .nix expression. Do you have any suggestion?


Solution

  • This is a known bug in ghcWithPackages. See https://github.com/NixOS/nixpkgs/issues/1438 for more information.

    In short, the fix is to replace ghcWithPackages with ghcWithPackagesOld.