3
0
Fork 0
forked from mirrors/nixpkgs

haskell-yi-custom: convenience wrapper for configs

Now to use Yi along with its config the user passes all the extra
libraries wanted by their config as extraPackages and builds the
expression. This means there is no hassle from the user about having to
manually create a cabal file and wrap over the Yi binary.
This commit is contained in:
Mateusz Kowalczyk 2014-10-15 04:23:05 +01:00
parent 7562afbe19
commit 8842fcfdb1
4 changed files with 87 additions and 0 deletions

View file

@ -0,0 +1,24 @@
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

@ -0,0 +1,17 @@
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

@ -0,0 +1,40 @@
# This is a manually-written expression over an in-tree cabal file.
# It's awkward but this way allows the package user to pass in
# extraPackages without much extra hassle on their end, similarly how
# the XMonad service handles it: the difference is that we don't have
# anything like XMONAD_GHC…
#
# The idea is that the user changes their configs using any libraries
# he likes and then builds it using this expression. Once that's done,
# 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.mkDerivation (self: rec {
pname = "yi-custom";
version = "0.0.0.1";
src = ./yi-custom-cabal;
isLibrary = true;
buildDepends = extraPackages ++ [ 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.
postInstall = ''
makeWrapper ${yi}/bin/yi $out/bin/yi --set GHC_PACKAGE_PATH ''${GHC_PACKAGE_PATH%?}
'';
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 ];
};
})

View file

@ -3090,10 +3090,16 @@ 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.
yi = callPackage ../applications/editors/yi/yi.nix { };
yiContrib = callPackage ../development/libraries/haskell/yi-contrib {};
yiCustom = callPackage ../applications/editors/yi/yi-custom.nix {
extraPackages = [];
};
yiLanguage = callPackage ../development/libraries/haskell/yi-language {};
yiRope = callPackage ../development/libraries/haskell/yi-rope {};