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

View File

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