diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index 17fb1ab8ae8..1418cfef057 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -124,7 +124,7 @@ let sha256Arg = if sha256 == null then "--sha256=" else ''--sha256="${sha256}"''; in buildPackages.stdenv.mkDerivation { name = "cabal2nix-${name}"; - nativeBuildInputs = [ buildPackages.cabal2nix ]; + nativeBuildInputs = [ buildPackages.cabal2nix-unwrapped ]; preferLocalBuild = true; allowSubstitutes = false; phases = ["installPhase"]; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index bcf0a5871a4..16ace1102cc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1342,19 +1342,17 @@ in cue2pops = callPackage ../tools/cd-dvd/cue2pops { }; - cabal2nix = haskell.lib.overrideCabal (haskell.lib.generateOptparseApplicativeCompletion "cabal2nix" haskell.packages.ghc881.cabal2nix) (drv: { - isLibrary = false; - enableSharedExecutables = false; - executableToolDepends = (drv.executableToolDepends or []) ++ [ makeWrapper ]; - postInstall = '' - exe=$out/libexec/${drv.pname}-${drv.version}/${drv.pname} - install -D $out/bin/${drv.pname} $exe - rm -rf $out/{bin,lib,share} - makeWrapper $exe $out/bin/${drv.pname} \ - --prefix PATH ":" "${nix}/bin" \ - --prefix PATH ":" "${nix-prefetch-scripts}/bin" - '' + (drv.postInstall or ""); - }); + cabal2nix-unwrapped = haskell.lib.justStaticExecutables (haskell.lib.generateOptparseApplicativeCompletion "cabal2nix" haskellPackages.cabal2nix); + + cabal2nix = symlinkJoin { + inherit (cabal2nix-unwrapped) name meta; + nativeBuildInputs = [ makeWrapper ]; + paths = [ cabal2nix-unwrapped ]; + postBuild = '' + wrapProgram $out/bin/cabal2nix \ + --prefix PATH ":" "${lib.makeBinPath [ nix nix-prefetch-scripts ]}" + ''; + }; stack2nix = with haskell.lib; overrideCabal (justStaticExecutables haskellPackages.stack2nix) (drv: { executableToolDepends = [ makeWrapper ];