Gabriella439 / haskell-nix

Nix and Haskell in production
1.14k stars 116 forks source link

Recommend use of haskellLib.packagesFromDirectory #55

Open langston-barrett opened 6 years ago

langston-barrett commented 6 years ago

This function seems to do the same work as some of the code here: https://github.com/Gabriel439/haskell-nix/blob/master/project4/README.md. Is there overlap that could be reduced here?

Gabriella439 commented 6 years ago

Yes, I added that function :)

I was planning to reuse it in this guide once I updated it to use (and pin to) a newer nixpkgs revision

langston-barrett commented 6 years ago

Oh, I see you in the commit history :smile:

I think this function doesn't drop in as I expected, can I ask for your advice? I have the following

  config = {
    packageOverrides = pkgs: rec {
        haskellPackages =
        let
          generatedOverrides = pkgs.haskell.lib.packagesFromDirectory { directory = "./nix"; };
          manualOverrides = haskellPackagesNew: haskellPackagesOld: {};
        in
          pkgs.haskellPackages.override {
            overrides =
              pkgs.lib.composeExtensions generatedOverrides manualOverrides;
          };
    };
  };

but it generates the error

error: string './nix' doesn't represent an absolute path, at /nix/store/y83nlg83yv3glcj7hjwcrngmxxzxkl9g-source/pkgs/development/haskell-modules/lib.nix:394:44

How can I get it to accept a relative path, like generatedOverrides does now?

Gabriella439 commented 6 years ago

@siddharthist: I believe you need to remove the quotes around "./nix". i.e.: { directory = ./nix; }

langston-barrett commented 6 years ago

Ah, as it says in the nixpkgs manual, such paths are made absolute at parse time: https://nixos.org/nix/manual/#idm140737318050944