From 33d52b37f3c0e79e590445fdebf095b96f944aef Mon Sep 17 00:00:00 2001 From: Mateusz Kowalczyk Date: Wed, 15 Apr 2015 21:31:17 +0100 Subject: [PATCH] haskell-yi: improve wrapper and use haskell-ng Now pkgs.yi is the package to use and override --- pkgs/applications/editors/yi/wrapper.nix | 29 +++++++++++++++++++ .../editors/yi/yi-custom-cabal/LICENSE | 24 --------------- .../yi/yi-custom-cabal/yi-custom.cabal | 17 ----------- pkgs/applications/editors/yi/yi-custom.nix | 2 +- .../haskell/diagrams/builder/wrapper.nix | 15 +++++----- pkgs/top-level/all-packages.nix | 5 ++++ pkgs/top-level/haskell-packages.nix | 8 ++--- 7 files changed, 44 insertions(+), 56 deletions(-) create mode 100644 pkgs/applications/editors/yi/wrapper.nix delete mode 100644 pkgs/applications/editors/yi/yi-custom-cabal/LICENSE delete mode 100644 pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal diff --git a/pkgs/applications/editors/yi/wrapper.nix b/pkgs/applications/editors/yi/wrapper.nix new file mode 100644 index 00000000000..f8a33a78577 --- /dev/null +++ b/pkgs/applications/editors/yi/wrapper.nix @@ -0,0 +1,29 @@ +# Note: this relies on dyre patched for NIX_GHC which is done in +# haskell-ng only. +# +# To use this for hacking of your Yi config file, drop into a shell +# with env attribute. +{ stdenv, makeWrapper +, haskellPackages +, extraPackages ? (s: []) +}: +let + yiEnv = haskellPackages.ghcWithPackages + (self: [ self.yi ] ++ extraPackages self); +in +stdenv.mkDerivation { + name = "yi-custom"; + version = "0.0.0.1"; + unpackPhase = "true"; + nativeBuildInputs = [ makeWrapper ]; + + buildCommand = '' + mkdir -p $out/bin + makeWrapper ${haskellPackages.yi}/bin/yi $out/bin/yi \ + --set NIX_GHC ${yiEnv}/bin/ghc + ''; + + # For hacking purposes + env = yiEnv; + +} diff --git a/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE b/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE deleted file mode 100644 index cf1ab25da03..00000000000 --- a/pkgs/applications/editors/yi/yi-custom-cabal/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal b/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal deleted file mode 100644 index d9ffbb8e481..00000000000 --- a/pkgs/applications/editors/yi/yi-custom-cabal/yi-custom.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: yi-custom -version: 0.0.0.1 -category: Yi -synopsis: Convenience wrapper for nix -description: Convenience wrapper for nix -license: PublicDomain -license-file: LICENSE -author: Mateusz Kowalczyk -maintainer: fuuzetsu@fuuzetsu.co.uk -Cabal-Version: >= 1.10 -build-type: Simple - -library - hs-source-dirs: . - default-language: Haskell2010 - build-depends: base, yi - ghc-options: -threaded diff --git a/pkgs/applications/editors/yi/yi-custom.nix b/pkgs/applications/editors/yi/yi-custom.nix index 3dbd4611998..2f1e76e06cc 100644 --- a/pkgs/applications/editors/yi/yi-custom.nix +++ b/pkgs/applications/editors/yi/yi-custom.nix @@ -37,4 +37,4 @@ cabal.mkDerivation (self: rec { maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ]; }; -}) \ No newline at end of file +}) diff --git a/pkgs/development/libraries/haskell/diagrams/builder/wrapper.nix b/pkgs/development/libraries/haskell/diagrams/builder/wrapper.nix index 8d175398414..3fbc8c3f2b0 100644 --- a/pkgs/development/libraries/haskell/diagrams/builder/wrapper.nix +++ b/pkgs/development/libraries/haskell/diagrams/builder/wrapper.nix @@ -2,7 +2,7 @@ If user need access to more haskell package for building his diagrams, he simply has to pass these package through the extra packages function as follow in `config.nix`: - + ~~~ diagramBuilderWrapper.override { extraPackages = self : [myHaskellPackage]; @@ -10,22 +10,21 @@ ­~~~ WARNING: - Note that this solution works well but however, as this is a + Note that this solution works well but however, as this is a non-cabal derivation, user should be carefull to never put this package inside the listing passed as argument to `ghcWithPackages` as it will silently disregard the package. This silent disregard should be regarded as an issue for `ghcWithPackages`. It should rather raise an error instead when a non-cabal dirivation is directly passed to it. The alternative would have been to - use a fake cabal file in order to make this a cabal derivation - such as what `yiCustom` package did. + use a fake cabal file in order to make this a cabal derivation. */ -{ stdenv, diagramsBuilder, ghcWithPackages, makeWrapper, +{ stdenv, diagramsBuilder, ghcWithPackages, makeWrapper, extraPackages ? (self: []) }: let - # Used same technique as for the yiCustom package. - w = ghcWithPackages + # Used same technique such as xmonad + w = ghcWithPackages (self: [ diagramsBuilder ] ++ extraPackages self); wrappedGhc = w.override { ignoreCollisions = true; }; in @@ -50,4 +49,4 @@ stdenv.mkDerivation { ''; preferLocalBuild = true; meta = diagramsBuilder.meta; -} \ No newline at end of file +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a07b04d165a..c62f8a9d5cc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3220,6 +3220,11 @@ let inherit (xlibs) libXt libXaw libXtst xextproto libXi libXpm gccmakedep; }; + # To expose more packages for Yi, override the extraPackages arg. + yi = callPackage ../applications/editors/yi/wrapper.nix { + haskellPackages = haskellngPackages; + }; + youtube-dl = callPackage ../tools/misc/youtube-dl { }; zbar = callPackage ../tools/graphics/zbar { diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index b2cebf63fff..82550b9c931 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -3139,14 +3139,10 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in wordTrie = callPackage ../development/libraries/haskell/word-trie {}; - # This is an unwrapped version of Yi, it will not behave well (no - # M-x or reload). Use ‘yiCustom’ instead. + # This is an unwrapped version of Yi, it will not behave well. Use + # ‘yi’ from all-packages.nix instead. yi = callPackage ../applications/editors/yi/yi.nix { }; - yiCustom = callPackage ../applications/editors/yi/yi-custom.nix { - extraPackages = pkgs: []; - }; - yiFuzzyOpen = callPackage ../development/libraries/haskell/yi-fuzzy-open {}; yiMonokai = callPackage ../development/libraries/haskell/yi-monokai {};