Merge pull request #6968 from oxij/unquestionably-good

Easy to check to be unquestionably good changes
This commit is contained in:
Arseniy Seroka 2015-03-28 13:16:13 +03:00
commit a639c710ae
6 changed files with 39 additions and 37 deletions

View File

@ -29,8 +29,8 @@ rec {
For another application, see build-support/vm, where this For another application, see build-support/vm, where this
function is used to build arbitrary derivations inside a QEMU function is used to build arbitrary derivations inside a QEMU
virtual machine. */ virtual machine.
*/
overrideDerivation = drv: f: overrideDerivation = drv: f:
let let
newDrv = derivation (drv.drvAttrs // (f drv)); newDrv = derivation (drv.drvAttrs // (f drv));
@ -56,18 +56,17 @@ rec {
makeOverridable = f: origArgs: makeOverridable = f: origArgs:
let let
ff = f origArgs; ff = f origArgs;
overrideWith = newArgs: origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs);
in in
if builtins.isAttrs ff then (ff // if builtins.isAttrs ff then (ff //
{ override = newArgs: { override = newArgs: makeOverridable f (overrideWith newArgs);
makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
deepOverride = newArgs: deepOverride = newArgs:
makeOverridable f (lib.overrideExisting (lib.mapAttrs (deepOverrider newArgs) origArgs) newArgs); makeOverridable f (lib.overrideExisting (lib.mapAttrs (deepOverrider newArgs) origArgs) newArgs);
overrideDerivation = fdrv: overrideDerivation = fdrv:
makeOverridable (args: overrideDerivation (f args) fdrv) origArgs; makeOverridable (args: overrideDerivation (f args) fdrv) origArgs;
}) })
else if builtins.isFunction ff then else if builtins.isFunction ff then
{ override = newArgs: { override = newArgs: makeOverridable f (overrideWith newArgs);
makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
__functor = self: ff; __functor = self: ff;
deepOverride = throw "deepOverride not yet supported for functors"; deepOverride = throw "deepOverride not yet supported for functors";
overrideDerivation = throw "overrideDerivation not yet supported for functors"; overrideDerivation = throw "overrideDerivation not yet supported for functors";
@ -102,8 +101,10 @@ rec {
}; };
*/ */
callPackageWith = autoArgs: fn: args: callPackageWith = autoArgs: fn: args:
let f = if builtins.isFunction fn then fn else import fn; in let
makeOverridable f ((builtins.intersectAttrs (builtins.functionArgs f) autoArgs) // args); f = if builtins.isFunction fn then fn else import fn;
auto = builtins.intersectAttrs (builtins.functionArgs f) autoArgs;
in makeOverridable f (auto // args);
/* Add attributes to each output of a derivation without changing the derivation itself */ /* Add attributes to each output of a derivation without changing the derivation itself */

View File

@ -13,10 +13,11 @@ rec {
addErrorContextToAttrs = lib.mapAttrs (a: v: lib.addErrorContext "while evaluating ${a}" v); addErrorContextToAttrs = lib.mapAttrs (a: v: lib.addErrorContext "while evaluating ${a}" v);
traceIf = p: msg: x: if p then trace msg x else x;
traceVal = x: builtins.trace x x; traceVal = x: trace x x;
traceXMLVal = x: builtins.trace (builtins.toXML x) x; traceXMLVal = x: trace (builtins.toXML x) x;
traceXMLValMarked = str: x: builtins.trace (str + builtins.toXML x) x; traceXMLValMarked = str: x: trace (str + builtins.toXML x) x;
# 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;
@ -42,6 +43,7 @@ rec {
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));
traceCall3 = n : f : a : b : c : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c)); traceCall3 = n : f : a : b : c : let t = n2 : x : traceShowValMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
# FIXME: rename this?
traceValIfNot = c: x: traceValIfNot = c: x:
if c x then true else trace (showVal x) false; if c x then true else trace (showVal x) false;
@ -106,6 +108,6 @@ rec {
) )
else else
let r = strict expr; let r = strict expr;
in builtins.trace "${str}\n result:\n${builtins.toXML r}" r in trace "${str}\n result:\n${builtins.toXML r}" r
); );
} }

View File

@ -28,6 +28,7 @@ let
# Perform substitutions in all udev rules files. # Perform substitutions in all udev rules files.
udevRules = stdenv.mkDerivation { udevRules = stdenv.mkDerivation {
name = "udev-rules"; name = "udev-rules";
preferLocalBuild = true;
buildCommand = '' buildCommand = ''
mkdir -p $out mkdir -p $out
shopt -s nullglob shopt -s nullglob

View File

@ -9,12 +9,6 @@ let
nssModulesPath = config.system.nssModules.path; nssModulesPath = config.system.nssModules.path;
permitRootLoginCheck = v:
v == "yes" ||
v == "without-password" ||
v == "forced-commands-only" ||
v == "no";
knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts); knownHosts = map (h: getAttr h cfg.knownHosts) (attrNames cfg.knownHosts);
knownHostsText = flip (concatMapStringsSep "\n") knownHosts knownHostsText = flip (concatMapStringsSep "\n") knownHosts
@ -116,12 +110,9 @@ in
permitRootLogin = mkOption { permitRootLogin = mkOption {
default = "without-password"; default = "without-password";
type = types.addCheck types.str permitRootLoginCheck; type = types.enum ["yes" "without-password" "forced-commands-only" "no"];
description = '' description = ''
Whether the root user can login using ssh. Valid values are Whether the root user can login using ssh.
<literal>yes</literal>, <literal>without-password</literal>,
<literal>forced-commands-only</literal> or
<literal>no</literal>.
''; '';
}; };

View File

@ -1,3 +1,21 @@
/*
WARNING/NOTE: whenever you want to add an option here you need to
either
* mark it as an optional one with `?` suffix,
* or make sure it works for all the versions in nixpkgs,
* or check for which kernel versions it will work (using kernel
changelog, google or whatever) and mark it with `versionOlder` or
`versionAtLeast`.
Then do test your change by building all the kernels (or at least
their configs) in nixpkgs or else you will guarantee lots and lots
of pain to users trying to switch to an older kernel because of some
hardware problems with a new one.
*/
{ stdenv, version, kernelPlatform, extraConfig, features }: { stdenv, version, kernelPlatform, extraConfig, features }:
with stdenv.lib; with stdenv.lib;

View File

@ -4262,7 +4262,7 @@ let
}; };
opam = callPackage ../development/tools/ocaml/opam { }; opam = callPackage ../development/tools/ocaml/opam { };
ocamlnat = let callPackage = newScope pkgs.ocamlPackages_3_12_1; in callPackage ../development/ocaml-modules/ocamlnat { }; ocamlnat = newScope pkgs.ocamlPackages_3_12_1 ../development/ocaml-modules/ocamlnat { };
qcmm = callPackage ../development/compilers/qcmm { qcmm = callPackage ../development/compilers/qcmm {
lua = lua4; lua = lua4;
@ -8699,16 +8699,7 @@ let
cifs_utils = callPackage ../os-specific/linux/cifs-utils { }; cifs_utils = callPackage ../os-specific/linux/cifs-utils { };
conky = callPackage ../os-specific/linux/conky { conky = callPackage ../os-specific/linux/conky (config.conky or {});
mpdSupport = config.conky.mpdSupport or true;
x11Support = config.conky.x11Support or false;
xdamage = config.conky.xdamage or false;
wireless = config.conky.wireless or false;
luaSupport = config.conky.luaSupport or false;
rss = config.conky.rss or false;
weatherMetar = config.conky.weatherMetar or false;
weatherXoap = config.conky.weatherXoap or false;
};
conntrack_tools = callPackage ../os-specific/linux/conntrack-tools { }; conntrack_tools = callPackage ../os-specific/linux/conntrack-tools { };
@ -10423,9 +10414,7 @@ let
fbreader = callPackage ../applications/misc/fbreader { }; fbreader = callPackage ../applications/misc/fbreader { };
fetchmail = import ../applications/misc/fetchmail { fetchmail = callPackage ../applications/misc/fetchmail { };
inherit stdenv fetchurl openssl;
};
fldigi = callPackage ../applications/audio/fldigi { }; fldigi = callPackage ../applications/audio/fldigi { };