removed all __primops from nixos

svn path=/nixos/trunk/; revision=15696
This commit is contained in:
Marc Weber 2009-05-24 10:58:28 +00:00
parent 6b2f1a0ce9
commit dafb4b8c5d
2 changed files with 11 additions and 9 deletions

View file

@ -24,7 +24,7 @@ let
(
let
inherit (pkgs.lib) attrByPath;
inherit (builtins) attrNames pathExists map;
inherit (builtins) attrNames pathExists map hasAttr getAttr;
services = attrByPath [ "servicesProposal" ] {} config;
nameToJobs = name : (
(
@ -54,10 +54,10 @@ let
else abort "service ${name} requested but there is no ${p}.nix or ${p}/default.nix file!";
options = (jobFunc (args (abort "you can't use configV within options!"))).options;
errorWhere = name : "${name} of service ${builtins.toString path}";
configV = name : if (__hasAttr name options ) then
let opt = (__getAttr name options ); # this config option description
in if (__hasAttr name thisConfig )
then let v = (__getAttr name thisConfig); in if opt ? apply then opt.apply v else v
configV = name : if (hasAttr name options ) then
let opt = (getAttr name options ); # this config option description
in if (hasAttr name thisConfig )
then let v = (getAttr name thisConfig); in if opt ? apply then opt.apply v else v
else if opt ? default then opt.default else abort "you need to specify the configuration option ${errorWhere name}"
else abort "unkown option ${errorWhere name}";
checkConfig = (attrByPath ["environment" "checkConfigurationOptions"]

View file

@ -1,4 +1,6 @@
{ path, thisConfig, config, lib, pkgs, upstartHelpers } : with upstartHelpers; rec {
{ path, thisConfig, config, lib, pkgs, upstartHelpers } : with upstartHelpers;
let inherit (builtins) lessThan pathExists attrNames; in
rec {
options = {
description = "tightvnc vnc server (share virtual desktop over network";
@ -18,7 +20,7 @@
value must be something between 8 and 32
'';
apply = x: "-depth '${x}'";
check = x: (__lessThan x 33) && (7 __lessThan x); # not yet used
check = x: (lessThan x 33) && (7 lessThan x); # not yet used
};
display = mkOption {
default = ":8";
@ -33,7 +35,7 @@
Can be created using vncpasswd
'';
apply = x: "-auth '${x}'";
check = __pathExists;
check = pathExists;
};
httpPort = mkOption {
default = "-httpport 5900";
@ -82,7 +84,7 @@ description \"${name}\"
start on network-interfaces/started and xserver/started
stop on network-interfaces/stop or xserver/stop
exec ${pkgs.tightvnc}/bin/Xvnc -fp unix/:7100 ${lib.concatStringsSep " " (lib.mapIf (x : x != "description") configV (__attrNames options ) ) }
exec ${pkgs.tightvnc}/bin/Xvnc -fp unix/:7100 ${lib.concatStringsSep " " (lib.mapIf (x : x != "description") configV (attrNames options ) ) }
";
} ) ];
}