mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-15 17:25:11 +00:00
f729f12e4e
* Moved some scriptlets to the appropriate modules. * Put the scriptlet that sets the default path at the start, since it never makes sense not to have it there. It no longer needs to be declared as a dependency. * If a scriptlet has no dependencies, it can be denoted as a plain string (i.e., `noDepEntry' is not needed anymore). svn path=/nixos/trunk/; revision=23762
72 lines
1.8 KiB
Nix
72 lines
1.8 KiB
Nix
# This module defines global configuration for the Bash shell, in
|
|
# particular /etc/bashrc and /etc/profile.
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
with pkgs.lib;
|
|
|
|
let
|
|
|
|
options = {
|
|
|
|
environment.shellInit = mkOption {
|
|
default = "";
|
|
example = ''export PATH=/godi/bin/:$PATH'';
|
|
description = "
|
|
Script used to initialized user shell environments.
|
|
";
|
|
merge = mergeStringOption;
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
require = [options];
|
|
|
|
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;
|
|
|
|
bash = pkgs.bash;
|
|
wrapperDir = config.security.wrapperDir;
|
|
modulesTree = config.system.modulesTree;
|
|
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;
|
|
|
|
system.activationScripts.binsh = stringAfter [ "stdio" ]
|
|
''
|
|
# Create the required /bin/sh symlink; otherwise lots of things
|
|
# (notably the system() function) won't work.
|
|
mkdir -m 0755 -p /bin
|
|
ln -sfn ${config.system.build.binsh}/bin/sh /bin/sh
|
|
'';
|
|
|
|
}
|