* 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 ###### implementation
let 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; optional = pkgs.lib.optional;
@ -99,31 +92,6 @@ let
target = "default/useradd"; 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. # A bunch of PAM configuration files for various programs.
@ -184,15 +152,16 @@ let
inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry; inherit (pkgs.stringsWithDeps) noDepEntry fullDepEntry packEntry;
copyScript = {source, target, mode ? "644", own ? "root.root"}: copyScript = {source, target, mode ? "644", own ? "root.root"}:
assert target != "nixos"; '' assert target != "nixos";
source="${source}" ''
target="/etc/${target}" source="${source}"
mkdir -p $(dirname "$target") target="/etc/${target}"
test -e "$target" && rm -f "$target" mkdir -p $(dirname "$target")
cp "$source" "$target" test -e "$target" && rm -f "$target"
chown ${own} "$target" cp "$source" "$target"
chmod ${mode} "$target" chown ${own} "$target"
''; chmod ${mode} "$target"
'';
makeEtc = import ../helpers/make-etc.nix { makeEtc = import ../helpers/make-etc.nix {
inherit (pkgs) stdenv; inherit (pkgs) stdenv;

View File

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

View File

@ -8,6 +8,7 @@
./config/users-groups.nix ./config/users-groups.nix
./installer/grub/grub.nix ./installer/grub/grub.nix
./legacy.nix ./legacy.nix
./programs/bash/bash.nix
./programs/ssh.nix ./programs/ssh.nix
./programs/ssmtp.nix ./programs/ssmtp.nix
./security/setuid-wrappers.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_CONFIG=/nix/etc/config.nix
export NIXPKGS_ALL=/etc/nixos/nixpkgs export NIXPKGS_ALL=/etc/nixos/nixpkgs
export PAGER="less -R" export PAGER="less -R"
export FONTCONFIG_FILE=/etc/fonts/fonts.conf
export LANG=@defaultLocale@ export LANG=@defaultLocale@
export EDITOR=nano export EDITOR=nano
export INFOPATH=/var/run/current-system/sw/info:/var/run/current-system/sw/share/info 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 # config.system.activationScripts
# ../system/activate-configuration.nix # ../system/activate-configuration.nix
]; ];
system = {
build = {
binsh = pkgs.bashInteractive;
};
};
} }