* lib.getAttr renamed.

svn path=/nixos/branches/modular-nixos/; revision=15700
This commit is contained in:
Eelco Dolstra 2009-05-24 18:28:30 +00:00
parent e563c97ceb
commit 3f03fbe278
4 changed files with 11 additions and 16 deletions

View file

@ -1,9 +1,6 @@
args : with args;
let
inherit (pkgs.lib) id all showVal escapeShellArg concatMapStrings concatMap
mapAttrs concatLists flattenAttrs filter;
inherit (builtins) getAttr hasAttr head isAttrs;
in
with pkgs.lib;
rec {
# prepareRepoAttrs adds svn defaults and preparse the repo attribute sets so that they
@ -65,12 +62,12 @@ rec {
# this file is automatically generated from nixos configuration file settings (installer.repos)
backupTimestamp=$(date "+%Y%m%d%H%M%S")
'' + concatMapStrings ( attrs :
let repoType = getAttr attrs.type config.installer.repoTypes;
let repoType = builtins.getAttr attrs.type config.installer.repoTypes;
target = escapeShellArg attrs.target; in
''
# ${attrs.type} repo ${target}
PATH=
for path in ${builtins.toString repoType.env}; do
for path in ${toString repoType.env}; do
PATH=$PATH:$path/bin:$path/sbin
done
if [ -d ${target} ] && { cd ${target} && { ${ repoType.valid}; }; }; then

View file

@ -216,7 +216,7 @@ let
getPort = cfg: if cfg.port != 0 then cfg.port else if cfg.enableSSL then 443 else 80;
extraModules = pkgs.lib.getAttr ["extraModules"] [] mainCfg;
extraModules = pkgs.lib.attrByPath ["extraModules"] [] mainCfg;
extraForeignModules = pkgs.lib.filter builtins.isAttrs extraModules;
extraApachaModules = pkgs.lib.filter (x :! (builtins.isAttrs x)) extraModules; # I'd prefer using builtins.isString here, but doesn't exist yet

View file

@ -2,7 +2,7 @@
###### interface
let
inherit (pkgs.lib) mkOption mapAttrs getAttr fold
inherit (pkgs.lib) mkOption mapAttrs fold
mergeListOption mergeTypedOption mergeAttrsWithFunc;
options = {

View file

@ -1,13 +1,13 @@
{config, pkgs, ...}:
# TODO: this file need some make-up (Nicolas Pierron)
with pkgs.lib;
let
kernelPackages = config.boot.kernelPackages;
# List of font directories.
fontDirectories = config.fonts.fonts;
inherit (pkgs.lib) mkOption;
options = {
services = {
@ -282,7 +282,6 @@ in
let
inherit (pkgs.lib) optional isInList getAttr mkIf;
# Abbreviations.
cfg = config.services.xserver;
xorg = cfg.package;
@ -305,16 +304,15 @@ let
videoDriver = cfg.videoDriver;
resolutions = map (res: ''"${toString res.x}x${toString res.y}"'') (cfg.resolutions);
videoDriverModules = getAttr [ videoDriver ] (throw "unkown video driver : `${videoDriver}'") knownVideoDrivers;
videoDriverModules = attrByPath [videoDriver] (throw "unknown video driver: `${videoDriver}'") knownVideoDrivers;
modules =
getAttr ["modulesFirst"] [] videoDriverModules
attrByPath ["modulesFirst"] [] videoDriverModules
++ [
xorg.xorgserver
xorg.xf86inputevdev
]
++ getAttr ["modules"] [] videoDriverModules
++ attrByPath ["modules"] [] videoDriverModules
++ (optional cfg.synaptics.enable ["${xorg.xf86inputsynaptics}"]);