* Moved the Bash configuration to modules/programs/bash.

svn path=/nixos/branches/modular-nixos/; revision=15759
This commit is contained in:
Eelco Dolstra 2009-05-28 12:06:54 +00:00
parent 3badebea95
commit 421dcc35c5
9 changed files with 69 additions and 66 deletions

View file

@ -35,13 +35,6 @@ in
###### implementation
let
shellInit = config.environment.shellInit;
nixEnvVars = config.nix.envVars;
modulesTree = config.system.modulesTree;
wrapperDir = config.security.wrapperDir;
systemPath = config.system.path;
binsh = config.system.build.binsh;
optional = pkgs.lib.optional;
@ -99,31 +92,6 @@ let
target = "default/useradd";
}
{ # Script executed when the shell starts as a non-login shell (system-wide version).
source = pkgs.substituteAll {
src = ./bashrc.sh;
inherit systemPath wrapperDir modulesTree;
defaultLocale = config.i18n.defaultLocale;
inherit nixEnvVars shellInit;
};
target = "bashrc";
}
{ # Script executed when the shell starts as a login shell.
source = ./profile.sh;
target = "profile";
}
{ # Configuration for readline in bash.
source = ./inputrc;
target = "inputrc";
}
{ # Script executed when the shell starts as a non-login shell (user version).
source = ./skel/bashrc;
target = "skel/.bashrc";
}
]
# A bunch of PAM configuration files for various programs.
@ -184,15 +152,16 @@ let
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
copyScript = {source, target, mode ? "644", own ? "root.root"}:
assert target != "nixos"; ''
source="${source}"
target="/etc/${target}"
mkdir -p $(dirname "$target")
test -e "$target" && rm -f "$target"
cp "$source" "$target"
chown ${own} "$target"
chmod ${mode} "$target"
'';
assert target != "nixos";
''
source="${source}"
target="/etc/${target}"
mkdir -p $(dirname "$target")
test -e "$target" && rm -f "$target"
cp "$source" "$target"
chown ${own} "$target"
chmod ${mode} "$target"
'';
makeEtc = import ../helpers/make-etc.nix {
inherit (pkgs) stdenv;

View file

@ -155,24 +155,22 @@ let
in
{
require = [
options
];
require = [options];
system = {
build = {
inherit x11Fonts;
};
};
system.build.x11Fonts = x11Fonts;
environment = {
# Configuration file for fontconfig used to locate
# (X11) client-rendered fonts.
etc = mkIf config.fonts.enableFontConfig [{
source = pkgs.makeFontsConf {
fontDirectories = config.fonts.fonts;
};
target = "fonts/fonts.conf";
}];
};
environment.etc = mkIf config.fonts.enableFontConfig
[ { # Configuration file for fontconfig used to locate
# (X11) client-rendered fonts.
source = pkgs.makeFontsConf {
fontDirectories = config.fonts.fonts;
};
target = "fonts/fonts.conf";
}
];
environment.shellInit =
''
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
'';
}

View file

@ -8,6 +8,7 @@
./config/users-groups.nix
./installer/grub/grub.nix
./legacy.nix
./programs/bash/bash.nix
./programs/ssh.nix
./programs/ssmtp.nix
./security/setuid-wrappers.nix

View file

@ -0,0 +1,42 @@
# This module defines global configuration for the Bash shell, in
# particular /etc/bashrc and /etc/profile.
{config, pkgs, ...}:
{
environment.etc =
[ { # /etc/bashrc: script executed when the shell starts as a
# non-login shell. /etc/profile also sources this file, so
# most global configuration (such as environment variables)
# should go into this script.
source = pkgs.substituteAll {
src = ./bashrc.sh;
systemPath = config.system.path;
wrapperDir = config.security.wrapperDir;
modulesTree = config.system.modulesTree;
defaultLocale = config.i18n.defaultLocale;
nixEnvVars = config.nix.envVars;
shellInit = config.environment.shellInit;
};
target = "bashrc";
}
{ # Script executed when the shell starts as a login shell.
source = ./profile.sh;
target = "profile";
}
{ # Template for ~/.bashrc: script executed when the shell
# starts as a non-login shell.
source = ./bashrc-user.sh;
target = "skel/.bashrc";
}
{ # Configuration for readline in bash.
source = ./inputrc;
target = "inputrc";
}
];
system.build.binsh = pkgs.bashInteractive;
}

View file

@ -5,7 +5,6 @@ export MODULE_DIR=@modulesTree@/lib/modules
export NIXPKGS_CONFIG=/nix/etc/config.nix
export NIXPKGS_ALL=/etc/nixos/nixpkgs
export PAGER="less -R"
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export LANG=@defaultLocale@
export EDITOR=nano
export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info

View file

@ -39,10 +39,4 @@ in
# config.system.activationScripts
# ../system/activate-configuration.nix
];
system = {
build = {
binsh = pkgs.bashInteractive;
};
};
}