1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 13:10:33 +00:00

Converted Vim package to a template-based form with only lists filled in manually. Added library functions to support it. Added two proposed package templates to top-level, so that every discussion about package format can result in just editing templates or adding new ones.

svn path=/nixpkgs/trunk/; revision=9100
This commit is contained in:
Michael Raskin 2007-08-11 10:34:07 +00:00
parent 2d6a65b666
commit efbabdb598
6 changed files with 131 additions and 21 deletions

View file

@ -1,10 +1,31 @@
args:
args:
let
defList = [];
#stdenv and fetchurl are added automatically
notForBuildInputs = [];
getVal = (args.lib.getValue args defList);
check = args.lib.checkFlag args;
reqsList = [
["gtkGUI" "glib" "gtk" "pkgconfig" "libXpm" "libXext" "x11Support"]
["athenaGUI" "libXau" "libXt" "libXaw" "libXpm" "libXext" "x11Support"]
["x11Support" "libX11"]
["hugeFeatures"]
["true" "ncurses"]
];
buildInputsNames = args.lib.filter (x: (null!=getVal x)&&
(! args.lib.isInList (notForBuildInputs ++
["stdenv" "fetchurl" "lib"] ++
(map builtins.head reqsList)) x))
/*["libX11" "glib" "gtk" "pkgconfig" "libXpm" "libXext"
"libXau" "libXt" "libXaw" "ncurses"];*/
(builtins.attrNames args);
in
assert args.lib.checkReqs args defList reqsList;
args.stdenv.mkDerivation {
name = "vim-7.1" +
(if ((args ? hugeFeatures)
&& args.hugeFeatures) then
(if (check "hugeFeatures") then
"-huge" else "")
+ (if ((args ? libX11)&&(args.libX11 != null))
+ (if (check "x11Support")
then "-X11" else "")
;
@ -15,19 +36,14 @@ args.stdenv.mkDerivation {
inherit (args) ncurses;
buildInputs =(with ({libX11=null; libXext=null;
libSM=null; libXpm=null; libXt=null;
libXaw=null; libXau=null; glib=null;
gtk=null; pkgconfig=null;
} // args); [ncurses] ++
(args.lib.filter (x: x != null)
[libX11 libXext libSM libXpm libXt
libXaw libXau glib gtk pkgconfig]));
debug = builtins.attrNames args;
buildInputs = args.lib.filter (x: x!=null) (map getVal buildInputsNames);
preConfigure = "echo \$debug";
postInstall = "ln -s $out/bin/vim $out/bin/vi";
preBuild="touch src/auto/link.sed";
configureFlags=" --enable-gui=auto --disable-xim "+
(if ((args ? hugeFeatures) && args.hugeFeatures) then
(if (check "hugeFeatures") then
"--with-features=huge --enable-cscope --enable-multibyte --enable-xsmp "
else "");

View file

@ -124,6 +124,40 @@ rec {
then []
else [first] ++ range (builtins.add first 1) last;
#Return [arg] or [] for null arg
# Return true only if there is an attribute and it is true.
checkFlag = attrSet: name:
if (name == "true") then true else
getAttr [name] false attrSet ;
logicalOR = x: y: x || y;
logicalAND = x: y: x && y;
# Input : attrSet, [ [name default] ... ], name
# Output : its value or default.
getValue = attrSet: argList: name:
( getAttr [name] (if argList == [] then null else
let x = builtins.head argList; in
if (head x) == name then
(head (tail x))
else (getValue attrSet
(tail argList) name)) attrSet );
# Input : attrSet, [[name default] ...], [ [flagname reqs..] ... ]
# Output : are reqs satisfied? It's asserted.
checkReqs = attrSet : argList : condList :
(
fold logicalAND true
(map (x: let name = (head x) ; in
((checkFlag attrSet name) ->
(fold logicalAND true
(map (y: let val=(getValue attrSet argList y); in
(val!=null) && (val!=false))
(tail x))))) condList)) ;
isInList = list: x:
if (list == []) then false else
if (x == (head list)) then true else
isInList (tail list) x;
}

View file

@ -6,11 +6,12 @@
stdenv.mkDerivation {
name = "nix-0.11pre8816";
src = fetchurl {
url = http://nix.cs.uu.nl/dist/nix/nix-0.11pre8816/nix-0.11pre8816.tar.bz2;
md5 = "dd432e6a05179fe30a95c3758e70ac51";
};
src =
fetchurl {
url = http://nix.cs.uu.nl/dist/nix/nix-unstable-latest/nix-0.11pre9063.tar.bz2;
sha256 = "0fxsvam0ihzcfg694d28d6b3vkx5klh25jvf3y5igyyqszmmhnxj";
};
buildInputs = [perl curl openssl];
configureFlags = "

View file

@ -3345,6 +3345,8 @@ rec {
libXt libXaw libXau;
inherit (gtkLibs) glib gtk;
hugeFeatures = true;
gtkGUI = true;
x11Support = true;
};
vlc = import ../applications/video/vlc {

View file

@ -0,0 +1,17 @@
args:
args.stdenv.mkDerivation {
name = "";
src = args.fetchurl {
url = ;
sha256 = "";
};
buildInputs =(with args; []);
meta = {
description = "
";
};
}

View file

@ -0,0 +1,40 @@
args:
let
defList = [
(assert false) - correct it; List element is of form ["name" default]
];
#stdenv and fetchurl are added automatically
notForBuildInputs = [
(assert false) - correct it; List of names of non-buildInput arguments
];
getVal = (args.lib.getValue args defList);
check = args.lib.checkFlag args;
reqsList = [
(assert false) - correct it; List element is of form ["name" "requirement-name" ... ]
];
buildInputsNames = args.lib.filter (x: (null!=getVal x)&&
(! args.lib.isInList (notForBuildInputs ++
["stdenv" "fetchurl" "lib"] ++
(map builtins.head reqsList)) x))
/*["libX11" "glib" "gtk" "pkgconfig" "libXpm" "libXext"
"libXau" "libXt" "libXaw" "ncurses"];*/
(builtins.attrNames args);
in
assert args.lib.checkReqs args defList reqsList;
with args;
args.stdenv.mkDerivation {
name = "
#!!! Fill me //
" ;
src = args.
#Put fetcher here
buildInputs = args.lib.filter (x: x!=null) (map getVal buildInputsNames);
meta = {
description = "
#Fill description here
";
};
}