From 0fac38fd48f3cdad917025d331ee42d6007aa555 Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Fri, 17 Oct 2014 00:06:07 +0100 Subject: [PATCH] haskell-yi: make the wrapper less cumbersome MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It still suffers from ‘everything breaks’ if there is any Haskell in user env: https://github.com/NixOS/nixpkgs/issues/4560 --- pkgs/applications/editors/yi/yi-custom.nix | 20 +++++++++----------- pkgs/applications/editors/yi/yi.nix | 14 +++++--------- pkgs/top-level/haskell-packages.nix | 6 +++--- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/pkgs/applications/editors/yi/yi-custom.nix b/pkgs/applications/editors/yi/yi-custom.nix index 59436392408f..9d63b3808032 100644 --- a/pkgs/applications/editors/yi/yi-custom.nix +++ b/pkgs/applications/editors/yi/yi-custom.nix @@ -9,34 +9,32 @@ # ‘reload’ and similar functions should all work as long as the user # doesn't need new libraries at which point they should add them to # extraPackages and rebuild from the expression. -{ cabal, yi, extraPackages, makeWrapper }: - +{ cabal, yi, extraPackages, makeWrapper, ghcWithPackages }: +let + w = ghcWithPackages (self: [ yi ] ++ extraPackages self); + wrappedGhc = w.override { ignoreCollisions = true; }; +in cabal.mkDerivation (self: rec { pname = "yi-custom"; version = "0.0.0.1"; src = ./yi-custom-cabal; isLibrary = true; - buildDepends = extraPackages ++ [ yi ]; + buildDepends = [ yi ]; buildTools = [ makeWrapper ]; noHaddock = true; doCheck = false; - # Allows Yi to find the libraries it needs at runtime. We drop ‘:’ - # from this GHC_PACKAGE_PATH because we're wrapping over a different - # wrapper that used --prefix: if we didn't, we end up with a - # double-colon, confusing GHC. + # put custom GHC env in front which stops crap from being picked up + # from user database postInstall = '' - makeWrapper ${yi}/bin/yi $out/bin/yi --set GHC_PACKAGE_PATH ''${GHC_PACKAGE_PATH%?} + makeWrapper ${yi}/bin/yi $out/bin/yi --prefix PATH : ${wrappedGhc}/bin ''; - meta = { homepage = "http://haskell.org/haskellwiki/Yi"; description = "Wrapper over user-specified Haskell libraries for use in Yi config"; license = self.stdenv.lib.licenses.publicDomain; platforms = self.ghc.meta.platforms; maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ]; - # The wrapper does not yet work properly if we actually try to use it. - broken = true; }; }) \ No newline at end of file diff --git a/pkgs/applications/editors/yi/yi.nix b/pkgs/applications/editors/yi/yi.nix index c1d1e52db3d7..d6a601a0aef3 100644 --- a/pkgs/applications/editors/yi/yi.nix +++ b/pkgs/applications/editors/yi/yi.nix @@ -2,11 +2,11 @@ { cabal, binary, Cabal, cautiousFile, dataDefault, derive, dlist , dynamicState, dyre, filepath, glib, gtk, hashable, hint, HUnit -, lens, makeWrapper, mtl, ooPrototypes, pango, parsec, pointedlist -, QuickCheck, random, regexBase, regexTdfa, safe, semigroups, split -, tagged, tasty, tastyHunit, tastyQuickcheck, text, time -, transformersBase, unixCompat, unorderedContainers, utf8String -, vty, wordTrie, xdgBasedir, yiLanguage, yiRope +, lens, mtl, ooPrototypes, pango, parsec, pointedlist, QuickCheck +, random, regexBase, regexTdfa, safe, semigroups, split, tagged +, tasty, tastyHunit, tastyQuickcheck, text, time, transformersBase +, unixCompat, unorderedContainers, utf8String, vty, wordTrie +, xdgBasedir, yiLanguage, yiRope }: cabal.mkDerivation (self: { @@ -27,12 +27,8 @@ cabal.mkDerivation (self: { filepath HUnit lens QuickCheck semigroups tasty tastyHunit tastyQuickcheck text yiLanguage yiRope ]; - buildTools = [ makeWrapper ]; configureFlags = "-fpango -fvty"; noHaddock = self.stdenv.lib.versionOlder self.ghc.version "7.8"; - postInstall = '' - wrapProgram $out/bin/yi --suffix GHC_PACKAGE_PATH : $out/lib/ghc-${self.ghc.version}/package.conf.d/yi-$version.installedconf:$GHC_PACKAGE_PATH - ''; meta = { homepage = "http://haskell.org/haskellwiki/Yi"; description = "The Haskell-Scriptable Editor"; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 821bc3e9614e..ccad24235f62 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -3097,14 +3097,14 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in wordTrie = callPackage ../development/libraries/haskell/word-trie {}; - # You should prefer ‘yiCustom’ over ‘yi’ unless you never plan to - # use any external libraries in your config. + # This is an unwrapped version of Yi, it will not behave well (no + # M-x or reload). Use ‘yiCustom’ instead. yi = callPackage ../applications/editors/yi/yi.nix { }; yiContrib = callPackage ../development/libraries/haskell/yi-contrib {}; yiCustom = callPackage ../applications/editors/yi/yi-custom.nix { - extraPackages = []; + extraPackages = pkgs: []; }; yiLanguage = callPackage ../development/libraries/haskell/yi-language {};