nixpkgs/modules/programs/bash/bash.nix
Florian Friesdorf eb755d4692 switched all mergeOptionString to pkgs.lib.types.string
pierron recommended the use of types.string over mergeOptionString, as
it is superior but might break things.

For my system the change evaluated to the exactly same.

svn path=/nixos/trunk/; revision=31138
2011-12-29 00:51:35 +00:00

63 lines
1.5 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.
";
type = with pkgs.lib.types; string;
};
};
in
{
require = [options];
environment.etc =
[ { # Script executed when the shell starts as a login shell.
source = pkgs.substituteAll {
src = ./profile.sh;
wrapperDir = config.security.wrapperDir;
modulesTree = config.system.modulesTree;
shellInit = config.environment.shellInit;
};
target = "profile";
}
{ # /etc/bashrc: executed every time a bash starts. Sources
# /etc/profile to ensure that the system environment is
# configured properly.
source = ./bashrc.sh;
target = "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
'';
}