From 1f18f65650817268d6dc59d9327395326c2c2f02 Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Sun, 5 Feb 2017 21:18:27 +0100 Subject: [PATCH] callCabal2nix: take "name" parameter as a function argument The callCabal2nix function cannot reliably determine the appropriate "name" for the package it's processing. Attempts to derive this information have led to plenty of evaluation errors, and so I'd like to go for the obvious and reliable solution now and let the caller specify that bit of information. Here is an example that demonstrates how to use callCabal2nix. let pkgs = import {}; src = pkgs.fetchFromGitHub { owner = "gtk2hs"; repo = "gtk2hs"; rev = "eee61d84edf1dd44f8d380d7d7cae2405de50124"; sha256 = "12i53grimni0dyjqjydl120z5amcn668w4pfhl8dxscjh4a0l5nb"; }; in pkgs.haskellPackages.callCabal2nix "gtkhs-tools" "${src}/tools" {} --- pkgs/development/haskell-modules/default.nix | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index 31b20ab19f36..b42f94a36352 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -85,10 +85,7 @@ let callHackage = name: version: self.callPackage (hackage2nix name version); # Creates a Haskell package from a source package by calling cabal2nix on the source. - callCabal2nix = src: self.callPackage (haskellSrc2nix { - inherit src; - name = src.name or baseNameOf src; - }); + callCabal2nix = name: src: self.callPackage (haskellSrc2nix { inherit src name; }); ghcWithPackages = selectFrom: withPackages (selectFrom self);