removed all __primops from nixpkgs
svn path=/nixpkgs/trunk/; revision=15693
This commit is contained in:
parent
f7f938a1d1
commit
3157bb1098
@ -1,7 +1,8 @@
|
|||||||
args: with args;
|
args: with args;
|
||||||
let edf = composableDerivation.edf;
|
let inherit (builtins) getAttr;
|
||||||
optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/incclude"
|
edf = composableDerivation.edf;
|
||||||
+ " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64?
|
optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${getAttr attr args}/incclude"
|
||||||
|
+ " -D${name}_LIBRARY=${getAttr attr args}/lib "; # lib 64?
|
||||||
in
|
in
|
||||||
composableDerivation.composableDerivation {} {
|
composableDerivation.composableDerivation {} {
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
args: with args; with stringsWithDeps; with lib;
|
args: with args; with stringsWithDeps; with lib;
|
||||||
|
let inherit (builtins) head tail trace; in
|
||||||
(rec
|
(rec
|
||||||
{
|
{
|
||||||
inherit writeScript;
|
inherit writeScript;
|
||||||
@ -316,8 +317,8 @@ args: with args; with stringsWithDeps; with lib;
|
|||||||
envAdder = envAdderInner "";
|
envAdder = envAdderInner "";
|
||||||
|
|
||||||
envAdderList = l: if l==[] then "" else
|
envAdderList = l: if l==[] then "" else
|
||||||
"echo export ${__head l}='\"'\"\\\$${__head l}:${__head (__tail l)}\"'\"';\n" +
|
"echo export ${head l}='\"'\"\\\$${head l}:${head (tail l)}\"'\"';\n" +
|
||||||
envAdderList (__tail (__tail l));
|
envAdderList (tail (tail l));
|
||||||
|
|
||||||
wrapEnv = cmd: env: "
|
wrapEnv = cmd: env: "
|
||||||
mv \"${cmd}\" \"${cmd}-orig\";
|
mv \"${cmd}\" \"${cmd}-orig\";
|
||||||
@ -350,8 +351,8 @@ args: with args; with stringsWithDeps; with lib;
|
|||||||
echo '${toString (attrByPath ["propagatedBuildInputs"] [] args)}' >\$out/nix-support/propagated-build-inputs
|
echo '${toString (attrByPath ["propagatedBuildInputs"] [] args)}' >\$out/nix-support/propagated-build-inputs
|
||||||
") ["minInit" "defEnsureDir"];
|
") ["minInit" "defEnsureDir"];
|
||||||
|
|
||||||
/*debug = x:(__trace x x);
|
/*debug = x:(trace x x);
|
||||||
debugX = x:(__trace (__toXML x) x);*/
|
debugX = x:(trace (toXML x) x);*/
|
||||||
|
|
||||||
replaceScriptVar = file: name: value: "sed -e 's`^${name}=.*`${name}='\\''${value}'\\''`' -i ${file}";
|
replaceScriptVar = file: name: value: "sed -e 's`^${name}=.*`${name}='\\''${value}'\\''`' -i ${file}";
|
||||||
replaceInScript = file: l: concatStringsSep "\n" ((pairMap (replaceScriptVar file) l));
|
replaceInScript = file: l: concatStringsSep "\n" ((pairMap (replaceScriptVar file) l));
|
||||||
|
@ -22,7 +22,7 @@ let
|
|||||||
then ""
|
then ""
|
||||||
else checkAttrInclusion
|
else checkAttrInclusion
|
||||||
(s + "." + x)
|
(s + "." + x)
|
||||||
(__getAttr x a)
|
(builtins.getAttr x a)
|
||||||
(lib.attrByPath [x] null b))
|
(lib.attrByPath [x] null b))
|
||||||
(attrNames a)) ""
|
(attrNames a)) ""
|
||||||
);
|
);
|
||||||
|
@ -12,10 +12,11 @@
|
|||||||
|
|
||||||
p: # p = pkgs
|
p: # p = pkgs
|
||||||
let
|
let
|
||||||
|
inherit (builtins) isAttrs hasAttr;
|
||||||
inherit (p) lib fetchurl stdenv getConfig;
|
inherit (p) lib fetchurl stdenv getConfig;
|
||||||
inherit (p.composableDerivation) composableDerivation;
|
inherit (p.composableDerivation) composableDerivation;
|
||||||
# withName prevents nix-env -qa \* from aborting (pythonLibStub is a derivation but hasn't a name)
|
# withName prevents nix-env -qa \* from aborting (pythonLibStub is a derivation but hasn't a name)
|
||||||
withName = lib.mapAttrs (n : v : if (__isAttrs v && (!__hasAttr "name" v)) then null else v);
|
withName = lib.mapAttrs (n : v : if (isAttrs v && (!hasAttr "name" v)) then null else v);
|
||||||
in
|
in
|
||||||
withName ( lib.fix ( t : { # t = this attrs
|
withName ( lib.fix ( t : { # t = this attrs
|
||||||
|
|
||||||
@ -608,7 +609,7 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
all = lib.filter (x:
|
all = lib.filter (x:
|
||||||
(__isAttrs x)
|
(isAttrs x)
|
||||||
&& ((lib.maybeAttr "libPython" false x) == t.version)
|
&& ((lib.maybeAttr "libPython" false x) == t.version)
|
||||||
&& (lib.maybeAttr "name" false x != false) # don't collect pythonLibStub etc
|
&& (lib.maybeAttr "name" false x != false) # don't collect pythonLibStub etc
|
||||||
) (lib.flattenAttrs (removeAttrs t ["all"])); # nix is not yet lazy enough, so I've to remove all first
|
) (lib.flattenAttrs (removeAttrs t ["all"])); # nix is not yet lazy enough, so I've to remove all first
|
||||||
|
@ -7,7 +7,7 @@ stdenv.mkDerivation {
|
|||||||
sha256 = "0cciavzd05bpm5yfppid0s0vsf8kabwia9620vgvi26sv1gjgwhb";
|
sha256 = "0cciavzd05bpm5yfppid0s0vsf8kabwia9620vgvi26sv1gjgwhb";
|
||||||
};
|
};
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
echo -e '#! /bin/sh \n $( readlink -f $( type -tP wish${__substring 0 3 version}) ) "$@"' >$out/bin/wish
|
echo -e '#! /bin/sh \n $( readlink -f $( type -tP wish${builtins.substring 0 3 version}) ) "$@"' >$out/bin/wish
|
||||||
chmod a+x $out/bin/wish
|
chmod a+x $out/bin/wish
|
||||||
'';
|
'';
|
||||||
configureFlags="--with-tcl=${tcl}/lib";
|
configureFlags="--with-tcl=${tcl}/lib";
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
let lib = import ./default.nix; in
|
let lib = import ./default.nix;
|
||||||
|
|
||||||
|
inherit (builtins) trace attrNamesToStr isAttrs isFunction isList head substring attrNames;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
|
|
||||||
@ -20,20 +24,20 @@ rec {
|
|||||||
|
|
||||||
|
|
||||||
# this can help debug your code as well - designed to not produce thousands of lines
|
# this can help debug your code as well - designed to not produce thousands of lines
|
||||||
traceShowVal = x : __trace (showVal x) x;
|
traceShowVal = x : trace (showVal x) x;
|
||||||
traceShowValMarked = str: x: __trace (str + showVal x) x;
|
traceShowValMarked = str: x: trace (str + showVal x) x;
|
||||||
attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
|
attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (attrNames a));
|
||||||
showVal = x :
|
showVal = x :
|
||||||
if __isAttrs x then
|
if isAttrs x then
|
||||||
if x ? outPath then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
|
if x ? outPath then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
|
||||||
else "x is attr set { ${attrNamesToStr x} }"
|
else "x is attr set { ${attrNamesToStr x} }"
|
||||||
else if __isFunction x then "x is a function"
|
else if isFunction x then "x is a function"
|
||||||
else if x == [] then "x is an empty list"
|
else if x == [] then "x is an empty list"
|
||||||
else if __isList x then "x is a list, first item is : ${showVal (__head x)}"
|
else if isList x then "x is a list, first item is : ${showVal (head x)}"
|
||||||
else if x == true then "x is boolean true"
|
else if x == true then "x is boolean true"
|
||||||
else if x == false then "x is boolean false"
|
else if x == false then "x is boolean false"
|
||||||
else if x == null then "x is null"
|
else if x == null then "x is null"
|
||||||
else "x is probably a string starting, starting characters: ${__substring 0 50 x}..";
|
else "x is probably a string starting, starting characters: ${substring 0 50 x}..";
|
||||||
# trace the arguments passed to function and its result
|
# trace the arguments passed to function and its result
|
||||||
traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
traceCall = n : f : a : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
|
||||||
traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
traceCall2 = n : f : a : b : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
let lib = import ./default.nix; in
|
let lib = import ./default.nix;
|
||||||
|
inherit (builtins) isFunction hasAttr getAttr head tail isList isAttrs attrNames;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
with import ./lists.nix;
|
with import ./lists.nix;
|
||||||
with import ./attrsets.nix;
|
with import ./attrsets.nix;
|
||||||
@ -53,7 +56,7 @@ rec {
|
|||||||
f : # the function applied to the arguments
|
f : # the function applied to the arguments
|
||||||
initial : # you pass attrs, the functions below are passing a function taking the fix argument
|
initial : # you pass attrs, the functions below are passing a function taking the fix argument
|
||||||
let
|
let
|
||||||
takeFixed = if (__isFunction initial) then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
|
takeFixed = if (isFunction initial) then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
|
||||||
tidy = args :
|
tidy = args :
|
||||||
let # apply all functions given in "applyPreTidy" in sequence
|
let # apply all functions given in "applyPreTidy" in sequence
|
||||||
applyPreTidyFun = fold ( n : a : x : n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
|
applyPreTidyFun = fold ( n : a : x : n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
|
||||||
@ -61,9 +64,9 @@ rec {
|
|||||||
fun = n : x :
|
fun = n : x :
|
||||||
let newArgs = fixed :
|
let newArgs = fixed :
|
||||||
let args = takeFixed fixed;
|
let args = takeFixed fixed;
|
||||||
mergeFun = __getAttr n args;
|
mergeFun = getAttr n args;
|
||||||
in if __isAttrs x then (mergeFun args x)
|
in if isAttrs x then (mergeFun args x)
|
||||||
else assert __isFunction x;
|
else assert isFunction x;
|
||||||
mergeFun args (x ( args // { inherit fixed; }));
|
mergeFun args (x ( args // { inherit fixed; }));
|
||||||
in overridableDelayableArgs f newArgs;
|
in overridableDelayableArgs f newArgs;
|
||||||
in
|
in
|
||||||
@ -302,15 +305,15 @@ rec {
|
|||||||
fold lib.mergeAttrs {} [
|
fold lib.mergeAttrs {} [
|
||||||
x y
|
x y
|
||||||
(mapAttrs ( a : v : # merge special names using given functions
|
(mapAttrs ( a : v : # merge special names using given functions
|
||||||
if (__hasAttr a x)
|
if (hasAttr a x)
|
||||||
then if (__hasAttr a y)
|
then if (hasAttr a y)
|
||||||
then v (__getAttr a x) (__getAttr a y) # both have attr, use merge func
|
then v (getAttr a x) (getAttr a y) # both have attr, use merge func
|
||||||
else (__getAttr a x) # only x has attr
|
else (getAttr a x) # only x has attr
|
||||||
else (__getAttr a y) # only y has attr)
|
else (getAttr a y) # only y has attr)
|
||||||
) (removeAttrs mergeAttrBy2
|
) (removeAttrs mergeAttrBy2
|
||||||
# don't merge attrs which are neither in x nor y
|
# don't merge attrs which are neither in x nor y
|
||||||
(filter (a : (! __hasAttr a x) && (! __hasAttr a y) )
|
(filter (a : (! hasAttr a x) && (! hasAttr a y) )
|
||||||
(__attrNames mergeAttrBy2))
|
(attrNames mergeAttrBy2))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
];
|
];
|
||||||
@ -326,8 +329,8 @@ rec {
|
|||||||
|
|
||||||
# pick attrs subset_attr_names and apply f
|
# pick attrs subset_attr_names and apply f
|
||||||
subsetmap = f : attrs : subset_attr_names :
|
subsetmap = f : attrs : subset_attr_names :
|
||||||
listToAttrs (fold ( attr : r : if __hasAttr attr attrs
|
listToAttrs (fold ( attr : r : if hasAttr attr attrs
|
||||||
then r ++ [ ( nameValuePair attr ( f (__getAttr attr attrs) ) ) ] else r ) []
|
then r ++ [ ( nameValuePair attr ( f (getAttr attr attrs) ) ) ] else r ) []
|
||||||
subset_attr_names );
|
subset_attr_names );
|
||||||
|
|
||||||
# prepareDerivationArgs tries to make writing configurable derivations easier
|
# prepareDerivationArgs tries to make writing configurable derivations easier
|
||||||
@ -371,7 +374,7 @@ rec {
|
|||||||
// args2.cfg;
|
// args2.cfg;
|
||||||
opts = flattenAttrs (mapAttrs (a : v :
|
opts = flattenAttrs (mapAttrs (a : v :
|
||||||
let v2 = if (v ? set || v ? unset) then v else { set = v; };
|
let v2 = if (v ? set || v ? unset) then v else { set = v; };
|
||||||
n = if (__getAttr (flagName a) cfgWithDefaults) then "set" else "unset";
|
n = if (getAttr (flagName a) cfgWithDefaults) then "set" else "unset";
|
||||||
attr = maybeAttr n {} v2; in
|
attr = maybeAttr n {} v2; in
|
||||||
if (maybeAttr "assertion" true attr)
|
if (maybeAttr "assertion" true attr)
|
||||||
then attr
|
then attr
|
||||||
@ -387,11 +390,11 @@ rec {
|
|||||||
let eqListStrict = a : b :
|
let eqListStrict = a : b :
|
||||||
if (a == []) != (b == []) then false
|
if (a == []) != (b == []) then false
|
||||||
else if a == [] then true
|
else if a == [] then true
|
||||||
else eqStrict (__head a) (__head b) && eqListStrict (__tail a) (__tail b);
|
else eqStrict (head a) (head b) && eqListStrict (tail a) (tail b);
|
||||||
in
|
in
|
||||||
if __isList a && __isList b then eqListStrict a b
|
if isList a && isList b then eqListStrict a b
|
||||||
else if __isAttrs a && isAttrs b then
|
else if isAttrs a && isAttrs b then
|
||||||
(eqListStrict (__attrNames a) (__attrNames b))
|
(eqListStrict (attrNames a) (attrNames b))
|
||||||
&& (eqListStrict (lib.attrValues a) (lib.attrValues b))
|
&& (eqListStrict (lib.attrValues a) (lib.attrValues b))
|
||||||
else a == b; # FIXME !
|
else a == b; # FIXME !
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
/* String manipulation functions. */
|
/* String manipulation functions. */
|
||||||
|
|
||||||
let lib = import ./default.nix; in
|
let lib = import ./default.nix;
|
||||||
|
|
||||||
|
inherit (builtins) substring add sub stringLength;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
inherit (builtins) stringLength substring head tail lessThan sub;
|
inherit (builtins) stringLength substring head tail lessThan sub;
|
||||||
@ -86,10 +90,10 @@ rec {
|
|||||||
if s == "" then "" else
|
if s == "" then "" else
|
||||||
let takeTillSlash = left : c : s :
|
let takeTillSlash = left : c : s :
|
||||||
if left == 0 then s
|
if left == 0 then s
|
||||||
else if (__substring left 1 s == "/") then
|
else if (substring left 1 s == "/") then
|
||||||
(__substring (__add left 1) (__sub c 1) s)
|
(substring (add left 1) (sub c 1) s)
|
||||||
else takeTillSlash (__sub left 1) (__add c 1) s; in
|
else takeTillSlash (sub left 1) (add c 1) s; in
|
||||||
takeTillSlash (__sub (__stringLength s) 1) 1 s;
|
takeTillSlash (sub (stringLength s) 1) 1 s;
|
||||||
|
|
||||||
# Compares strings not requiring context equality
|
# Compares strings not requiring context equality
|
||||||
# Obviously, a workaround but works on all Nix versions
|
# Obviously, a workaround but works on all Nix versions
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
let inherit (builtins) add; in
|
||||||
with import ./default.nix;
|
with import ./default.nix;
|
||||||
|
|
||||||
runTests {
|
runTests {
|
||||||
@ -69,14 +70,14 @@ runTests {
|
|||||||
res4 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
res4 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||||
in (x.merge) ( x: { b = 10; });
|
in (x.merge) ( x: { b = 10; });
|
||||||
res5 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
res5 = let x = defaultOverridableDelayableArgs id { a = 7; };
|
||||||
in (x.merge) ( x: { a = __add x.a 3; });
|
in (x.merge) ( x: { a = add x.a 3; });
|
||||||
res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = __add; }; };
|
res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = add; }; };
|
||||||
y = x.merge {};
|
y = x.merge {};
|
||||||
in (y.merge) { a = 10; };
|
in (y.merge) { a = 10; };
|
||||||
|
|
||||||
resRem7 = res6.replace (a : removeAttrs a ["a"]);
|
resRem7 = res6.replace (a : removeAttrs a ["a"]);
|
||||||
|
|
||||||
resReplace6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = __add; }; };
|
resReplace6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = add; }; };
|
||||||
x2 = x.merge { a = 20; }; # now we have 27
|
x2 = x.merge { a = 20; }; # now we have 27
|
||||||
in (x2.replace) { a = 10; }; # and override the value by 10
|
in (x2.replace) { a = 10; }; # and override the value by 10
|
||||||
|
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
|
|
||||||
args: with args; with args.lib;
|
args: with args; with args.lib;
|
||||||
let
|
let
|
||||||
|
inherit (builtins) getAttr attrNames;
|
||||||
toConfigLine = name : set :
|
toConfigLine = name : set :
|
||||||
"[(\"name\",\"${name}\")," + ( concatStringsSep "," (map (a: "(\"${a}\",\"${__getAttr a set}\")" ) (__attrNames set)))+"]";
|
"[(\"name\",\"${name}\")," + ( concatStringsSep "," (map (a: "(\"${a}\",\"${getAttr a set}\")" ) (attrNames set)))+"]";
|
||||||
config = pkgs.writeText "nix-repository-manager_config"
|
config = pkgs.writeText "nix-repository-manager_config"
|
||||||
(bleedingEdgeRepos.managedRepoDir+"\n" +
|
(bleedingEdgeRepos.managedRepoDir+"\n" +
|
||||||
concatStringsSep "\n" (mapRecordFlatten toConfigLine (bleedingEdgeRepos.repos)));
|
concatStringsSep "\n" (mapRecordFlatten toConfigLine (bleedingEdgeRepos.repos)));
|
||||||
|
@ -47,7 +47,7 @@ rec {
|
|||||||
inherit searchRelativeTo;
|
inherit searchRelativeTo;
|
||||||
|
|
||||||
# Forces rebuilds.
|
# Forces rebuilds.
|
||||||
hack = __currentTime;
|
hack = builtins.currentTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1794,11 +1794,11 @@ let
|
|||||||
libraries =
|
libraries =
|
||||||
# core_libs distributed with this ghc version
|
# core_libs distributed with this ghc version
|
||||||
(lib.flattenAttrs ghcsAndLibs.ghc68.core_libs)
|
(lib.flattenAttrs ghcsAndLibs.ghc68.core_libs)
|
||||||
# (map ( a : __getAttr a ghcsAndLibs.ghc68.core_libs ) [ "cabal" "mtl" "base" ]
|
# (map ( a : builtins.getAttr a ghcsAndLibs.ghc68.core_libs ) [ "cabal" "mtl" "base" ]
|
||||||
|
|
||||||
# some extra libs
|
# some extra libs
|
||||||
++ (lib.flattenAttrs (ghc68extraLibs ghcsAndLibs.ghc68) );
|
++ (lib.flattenAttrs (ghc68extraLibs ghcsAndLibs.ghc68) );
|
||||||
# ++ map ( a : __getAttr a (ghc68extraLibs ghcsAndLibs.ghc68 ) ) [ "mtl" "parsec" ... ]
|
# ++ map ( a : builtins.getAttr a (ghc68extraLibs ghcsAndLibs.ghc68 ) ) [ "mtl" "parsec" ... ]
|
||||||
inherit ghc;
|
inherit ghc;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user