haskell-yi: improve wrapper and use haskell-ng

Now pkgs.yi is the package to use and override
This commit is contained in:
Mateusz Kowalczyk 2015-04-15 21:31:17 +01:00
parent 7bc23e994c
commit 33d52b37f3
7 changed files with 44 additions and 56 deletions

View File

@ -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;
}

View File

@ -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 <http://unlicense.org>

View File

@ -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

View File

@ -37,4 +37,4 @@ cabal.mkDerivation (self: rec {
maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ]; maintainers = with self.stdenv.lib.maintainers; [ fuuzetsu ];
}; };
}) })

View File

@ -2,7 +2,7 @@
If user need access to more haskell package for building his If user need access to more haskell package for building his
diagrams, he simply has to pass these package through the diagrams, he simply has to pass these package through the
extra packages function as follow in `config.nix`: extra packages function as follow in `config.nix`:
~~~ ~~~
diagramBuilderWrapper.override { diagramBuilderWrapper.override {
extraPackages = self : [myHaskellPackage]; extraPackages = self : [myHaskellPackage];
@ -10,22 +10,21 @@
­~~~ ­~~~
WARNING: 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 non-cabal derivation, user should be carefull to never put this
package inside the listing passed as argument to `ghcWithPackages` package inside the listing passed as argument to `ghcWithPackages`
as it will silently disregard the package. This silent disregard as it will silently disregard the package. This silent disregard
should be regarded as an issue for `ghcWithPackages`. It should should be regarded as an issue for `ghcWithPackages`. It should
rather raise an error instead when a non-cabal dirivation is rather raise an error instead when a non-cabal dirivation is
directly passed to it. The alternative would have been to directly passed to it. The alternative would have been to
use a fake cabal file in order to make this a cabal derivation use a fake cabal file in order to make this a cabal derivation.
such as what `yiCustom` package did.
*/ */
{ stdenv, diagramsBuilder, ghcWithPackages, makeWrapper, { stdenv, diagramsBuilder, ghcWithPackages, makeWrapper,
extraPackages ? (self: []) }: extraPackages ? (self: []) }:
let let
# Used same technique as for the yiCustom package. # Used same technique such as xmonad
w = ghcWithPackages w = ghcWithPackages
(self: [ diagramsBuilder ] ++ extraPackages self); (self: [ diagramsBuilder ] ++ extraPackages self);
wrappedGhc = w.override { ignoreCollisions = true; }; wrappedGhc = w.override { ignoreCollisions = true; };
in in
@ -50,4 +49,4 @@ stdenv.mkDerivation {
''; '';
preferLocalBuild = true; preferLocalBuild = true;
meta = diagramsBuilder.meta; meta = diagramsBuilder.meta;
} }

View File

@ -3220,6 +3220,11 @@ let
inherit (xlibs) libXt libXaw libXtst xextproto libXi libXpm gccmakedep; 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 { }; youtube-dl = callPackage ../tools/misc/youtube-dl { };
zbar = callPackage ../tools/graphics/zbar { zbar = callPackage ../tools/graphics/zbar {

View File

@ -3139,14 +3139,10 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
wordTrie = callPackage ../development/libraries/haskell/word-trie {}; wordTrie = callPackage ../development/libraries/haskell/word-trie {};
# This is an unwrapped version of Yi, it will not behave well (no # This is an unwrapped version of Yi, it will not behave well. Use
# M-x or reload). Use yiCustom instead. # yi from all-packages.nix instead.
yi = callPackage ../applications/editors/yi/yi.nix { }; 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 {}; yiFuzzyOpen = callPackage ../development/libraries/haskell/yi-fuzzy-open {};
yiMonokai = callPackage ../development/libraries/haskell/yi-monokai {}; yiMonokai = callPackage ../development/libraries/haskell/yi-monokai {};