diff --git a/pkgs/applications/misc/qgis/1.0.1-2.nix b/pkgs/applications/misc/qgis/1.0.1-2.nix index d17f3ec7502..142e3b65013 100644 --- a/pkgs/applications/misc/qgis/1.0.1-2.nix +++ b/pkgs/applications/misc/qgis/1.0.1-2.nix @@ -1,7 +1,8 @@ args: with args; -let edf = composableDerivation.edf; - optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/incclude" - + " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64? +let inherit (builtins) getAttr; + edf = composableDerivation.edf; + optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${getAttr attr args}/incclude" + + " -D${name}_LIBRARY=${getAttr attr args}/lib "; # lib 64? in composableDerivation.composableDerivation {} { diff --git a/pkgs/build-support/builder-defs/builder-defs.nix b/pkgs/build-support/builder-defs/builder-defs.nix index 2956fa478bf..17a49b69413 100644 --- a/pkgs/build-support/builder-defs/builder-defs.nix +++ b/pkgs/build-support/builder-defs/builder-defs.nix @@ -1,4 +1,5 @@ args: with args; with stringsWithDeps; with lib; +let inherit (builtins) head tail trace; in (rec { inherit writeScript; @@ -316,8 +317,8 @@ args: with args; with stringsWithDeps; with lib; envAdder = envAdderInner ""; envAdderList = l: if l==[] then "" else - "echo export ${__head l}='\"'\"\\\$${__head l}:${__head (__tail l)}\"'\"';\n" + - envAdderList (__tail (__tail l)); + "echo export ${head l}='\"'\"\\\$${head l}:${head (tail l)}\"'\"';\n" + + envAdderList (tail (tail l)); wrapEnv = cmd: env: " 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 ") ["minInit" "defEnsureDir"]; - /*debug = x:(__trace x x); - debugX = x:(__trace (__toXML x) x);*/ + /*debug = x:(trace x x); + debugX = x:(trace (toXML x) x);*/ replaceScriptVar = file: name: value: "sed -e 's`^${name}=.*`${name}='\\''${value}'\\''`' -i ${file}"; replaceInScript = file: l: concatStringsSep "\n" ((pairMap (replaceScriptVar file) l)); diff --git a/pkgs/build-support/checker/default.nix b/pkgs/build-support/checker/default.nix index 33321907125..4f95c3b95ee 100644 --- a/pkgs/build-support/checker/default.nix +++ b/pkgs/build-support/checker/default.nix @@ -22,7 +22,7 @@ let then "" else checkAttrInclusion (s + "." + x) - (__getAttr x a) + (builtins.getAttr x a) (lib.attrByPath [x] null b)) (attrNames a)) "" ); diff --git a/pkgs/development/interpreters/python-new/2.5/default.nix b/pkgs/development/interpreters/python-new/2.5/default.nix index 97edf899286..1e8917cc009 100644 --- a/pkgs/development/interpreters/python-new/2.5/default.nix +++ b/pkgs/development/interpreters/python-new/2.5/default.nix @@ -12,10 +12,11 @@ p: # p = pkgs let + inherit (builtins) isAttrs hasAttr; inherit (p) lib fetchurl stdenv getConfig; inherit (p.composableDerivation) composableDerivation; # 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 withName ( lib.fix ( t : { # t = this attrs @@ -608,7 +609,7 @@ in }; all = lib.filter (x: - (__isAttrs x) + (isAttrs x) && ((lib.maybeAttr "libPython" false x) == t.version) && (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 diff --git a/pkgs/development/libraries/tk/8.4.16.nix b/pkgs/development/libraries/tk/8.4.16.nix index 1f26db83f1b..38b7ec85749 100644 --- a/pkgs/development/libraries/tk/8.4.16.nix +++ b/pkgs/development/libraries/tk/8.4.16.nix @@ -7,7 +7,7 @@ stdenv.mkDerivation { sha256 = "0cciavzd05bpm5yfppid0s0vsf8kabwia9620vgvi26sv1gjgwhb"; }; 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 ''; configureFlags="--with-tcl=${tcl}/lib"; diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix index a58539ee3c4..18b5e1db9d4 100644 --- a/pkgs/lib/debug.nix +++ b/pkgs/lib/debug.nix @@ -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 { @@ -20,20 +24,20 @@ rec { # this can help debug your code as well - designed to not produce thousands of lines - traceShowVal = x : __trace (showVal x) x; - traceShowValMarked = str: x: __trace (str + showVal x) x; - attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (__attrNames a)); + traceShowVal = x : trace (showVal x) x; + traceShowValMarked = str: x: trace (str + showVal x) x; + attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (attrNames a)); 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 ""}, { ${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 __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 == false then "x is boolean false" 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 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)); diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix index d515158c00a..a8f37ec277b 100644 --- a/pkgs/lib/misc.nix +++ b/pkgs/lib/misc.nix @@ -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 ./attrsets.nix; @@ -53,7 +56,7 @@ rec { f : # the function applied to the arguments initial : # you pass attrs, the functions below are passing a function taking the fix argument 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 : let # apply all functions given in "applyPreTidy" in sequence applyPreTidyFun = fold ( n : a : x : n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args); @@ -61,9 +64,9 @@ rec { fun = n : x : let newArgs = fixed : let args = takeFixed fixed; - mergeFun = __getAttr n args; - in if __isAttrs x then (mergeFun args x) - else assert __isFunction x; + mergeFun = getAttr n args; + in if isAttrs x then (mergeFun args x) + else assert isFunction x; mergeFun args (x ( args // { inherit fixed; })); in overridableDelayableArgs f newArgs; in @@ -302,15 +305,15 @@ rec { fold lib.mergeAttrs {} [ x y (mapAttrs ( a : v : # merge special names using given functions - if (__hasAttr a x) - then if (__hasAttr a y) - 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 y) # only y has attr) + if (hasAttr a x) + then if (hasAttr a y) + 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 y) # only y has attr) ) (removeAttrs mergeAttrBy2 # don't merge attrs which are neither in x nor y - (filter (a : (! __hasAttr a x) && (! __hasAttr a y) ) - (__attrNames mergeAttrBy2)) + (filter (a : (! hasAttr a x) && (! hasAttr a y) ) + (attrNames mergeAttrBy2)) ) ) ]; @@ -326,8 +329,8 @@ rec { # pick attrs subset_attr_names and apply f subsetmap = f : attrs : subset_attr_names : - listToAttrs (fold ( attr : r : if __hasAttr attr attrs - then r ++ [ ( nameValuePair attr ( f (__getAttr attr attrs) ) ) ] else r ) [] + listToAttrs (fold ( attr : r : if hasAttr attr attrs + then r ++ [ ( nameValuePair attr ( f (getAttr attr attrs) ) ) ] else r ) [] subset_attr_names ); # prepareDerivationArgs tries to make writing configurable derivations easier @@ -371,7 +374,7 @@ rec { // args2.cfg; opts = flattenAttrs (mapAttrs (a : 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 if (maybeAttr "assertion" true attr) then attr @@ -387,11 +390,11 @@ rec { let eqListStrict = a : b : if (a == []) != (b == []) then false 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 - if __isList a && __isList b then eqListStrict a b - else if __isAttrs a && isAttrs b then - (eqListStrict (__attrNames a) (__attrNames b)) + if isList a && isList b then eqListStrict a b + else if isAttrs a && isAttrs b then + (eqListStrict (attrNames a) (attrNames b)) && (eqListStrict (lib.attrValues a) (lib.attrValues b)) else a == b; # FIXME ! } diff --git a/pkgs/lib/strings.nix b/pkgs/lib/strings.nix index 9c045e9ae53..c1ce5d09757 100644 --- a/pkgs/lib/strings.nix +++ b/pkgs/lib/strings.nix @@ -1,6 +1,10 @@ /* String manipulation functions. */ -let lib = import ./default.nix; in +let lib = import ./default.nix; + +inherit (builtins) substring add sub stringLength; + +in rec { inherit (builtins) stringLength substring head tail lessThan sub; @@ -86,10 +90,10 @@ rec { if s == "" then "" else let takeTillSlash = left : c : s : if left == 0 then s - else if (__substring left 1 s == "/") then - (__substring (__add left 1) (__sub c 1) s) - else takeTillSlash (__sub left 1) (__add c 1) s; in - takeTillSlash (__sub (__stringLength s) 1) 1 s; + else if (substring left 1 s == "/") then + (substring (add left 1) (sub c 1) s) + else takeTillSlash (sub left 1) (add c 1) s; in + takeTillSlash (sub (stringLength s) 1) 1 s; # Compares strings not requiring context equality # Obviously, a workaround but works on all Nix versions diff --git a/pkgs/lib/tests.nix b/pkgs/lib/tests.nix index 395b4b3e17b..95933cbe4b7 100644 --- a/pkgs/lib/tests.nix +++ b/pkgs/lib/tests.nix @@ -1,3 +1,4 @@ +let inherit (builtins) add; in with import ./default.nix; runTests { @@ -69,14 +70,14 @@ runTests { res4 = let x = defaultOverridableDelayableArgs id { a = 7; }; in (x.merge) ( x: { b = 10; }); res5 = let x = defaultOverridableDelayableArgs id { a = 7; }; - in (x.merge) ( x: { a = __add x.a 3; }); - res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = __add; }; }; + in (x.merge) ( x: { a = add x.a 3; }); + res6 = let x = defaultOverridableDelayableArgs id { a = 7; mergeAttrBy = { a = add; }; }; y = x.merge {}; in (y.merge) { a = 10; }; 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 in (x2.replace) { a = 10; }; # and override the value by 10 diff --git a/pkgs/misc/ghc68executables/nix-repository-manager.nix b/pkgs/misc/ghc68executables/nix-repository-manager.nix index f72222bb3c3..63dfb12a5c0 100644 --- a/pkgs/misc/ghc68executables/nix-repository-manager.nix +++ b/pkgs/misc/ghc68executables/nix-repository-manager.nix @@ -12,8 +12,9 @@ args: with args; with args.lib; let + inherit (builtins) getAttr attrNames; 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" (bleedingEdgeRepos.managedRepoDir+"\n" + concatStringsSep "\n" (mapRecordFlatten toConfigLine (bleedingEdgeRepos.repos))); diff --git a/pkgs/misc/tex/nix/default.nix b/pkgs/misc/tex/nix/default.nix index 5252e7a11eb..2fb50bf7023 100644 --- a/pkgs/misc/tex/nix/default.nix +++ b/pkgs/misc/tex/nix/default.nix @@ -47,7 +47,7 @@ rec { inherit searchRelativeTo; # Forces rebuilds. - hack = __currentTime; + hack = builtins.currentTime; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index be4cf5bc07f..c6678e3f78d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1794,11 +1794,11 @@ let libraries = # core_libs distributed with this ghc version (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 ++ (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; };