···
27
-
(lib.mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
35
-
enable = lib.mkOption {
38
-
Whenever to configure Bash as an interactive shell.
39
-
Note that this tries to make Bash the default
40
-
{option}`users.defaultUserShell`,
41
-
which in turn means that you might need to explicitly
42
-
set this variable if you have another shell configured
45
-
type = lib.types.bool;
31
+
enable = lib.mkOption {
34
+
Whenever to configure Bash as an interactive shell.
35
+
Note that this tries to make Bash the default
36
+
{option}`users.defaultUserShell`,
37
+
which in turn means that you might need to explicitly
38
+
set this variable if you have another shell configured
41
+
type = lib.types.bool;
shellAliases = lib.mkOption {
···
132
-
config = # lib.mkIf cfg.enable
127
+
config = lib.mkIf cfg.enable {
137
-
shellAliases = builtins.mapAttrs (name: lib.mkDefault) cfge.shellAliases;
131
+
shellAliases = builtins.mapAttrs (name: lib.mkDefault) cfge.shellAliases;
140
-
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
141
-
. ${config.system.build.setEnvironment}
134
+
if [ -z "$__NIXOS_SET_ENVIRONMENT_DONE" ]; then
135
+
. ${config.system.build.setEnvironment}
147
-
loginShellInit = cfge.loginShellInit;
141
+
loginShellInit = cfge.loginShellInit;
149
-
interactiveShellInit = ''
150
-
# Check the window size after every command.
151
-
shopt -s checkwinsize
143
+
interactiveShellInit = ''
144
+
# Check the window size after every command.
145
+
shopt -s checkwinsize
153
-
# Disable hashing (i.e. caching) of command lookups.
147
+
# Disable hashing (i.e. caching) of command lookups.
157
-
${cfg.promptPluginInit}
151
+
${cfg.promptPluginInit}
160
-
${cfge.interactiveShellInit}
154
+
${cfge.interactiveShellInit}
165
-
environment.etc.profile.text = ''
166
-
# /etc/profile: DO NOT EDIT -- this file has been generated automatically.
167
-
# This file is read for login shells.
159
+
environment.etc.profile.text = ''
160
+
# /etc/profile: DO NOT EDIT -- this file has been generated automatically.
161
+
# This file is read for login shells.
169
-
# Only execute this file once per shell.
170
-
if [ -n "$__ETC_PROFILE_SOURCED" ]; then return; fi
171
-
__ETC_PROFILE_SOURCED=1
163
+
# Only execute this file once per shell.
164
+
if [ -n "$__ETC_PROFILE_SOURCED" ]; then return; fi
165
+
__ETC_PROFILE_SOURCED=1
173
-
# Prevent this file from being sourced by interactive non-login child shells.
174
-
export __ETC_PROFILE_DONE=1
167
+
# Prevent this file from being sourced by interactive non-login child shells.
168
+
export __ETC_PROFILE_DONE=1
177
-
${cfg.loginShellInit}
171
+
${cfg.loginShellInit}
179
-
# Read system-wide modifications.
180
-
if test -f /etc/profile.local; then
181
-
. /etc/profile.local
173
+
# Read system-wide modifications.
174
+
if test -f /etc/profile.local; then
175
+
. /etc/profile.local
184
-
if [ -n "''${BASH_VERSION:-}" ]; then
178
+
if [ -n "''${BASH_VERSION:-}" ]; then
189
-
environment.etc.bashrc.text = ''
190
-
# /etc/bashrc: DO NOT EDIT -- this file has been generated automatically.
183
+
environment.etc.bashrc.text = ''
184
+
# /etc/bashrc: DO NOT EDIT -- this file has been generated automatically.
192
-
# Only execute this file once per shell.
193
-
if [ -n "$__ETC_BASHRC_SOURCED" ] || [ -n "$NOSYSBASHRC" ]; then return; fi
194
-
__ETC_BASHRC_SOURCED=1
186
+
# Only execute this file once per shell.
187
+
if [ -n "$__ETC_BASHRC_SOURCED" ] || [ -n "$NOSYSBASHRC" ]; then return; fi
188
+
__ETC_BASHRC_SOURCED=1
196
-
# If the profile was not loaded in a parent process, source
197
-
# it. But otherwise don't do it because we don't want to
198
-
# clobber overridden values of $PATH, etc.
199
-
if [ -z "$__ETC_PROFILE_DONE" ]; then
190
+
# If the profile was not loaded in a parent process, source
191
+
# it. But otherwise don't do it because we don't want to
192
+
# clobber overridden values of $PATH, etc.
193
+
if [ -z "$__ETC_PROFILE_DONE" ]; then
203
-
# We are not always an interactive shell.
204
-
if [ -n "$PS1" ]; then
205
-
${cfg.interactiveShellInit}
197
+
# We are not always an interactive shell.
198
+
if [ -n "$PS1" ]; then
199
+
${cfg.interactiveShellInit}
208
-
# Read system-wide modifications.
209
-
if test -f /etc/bashrc.local; then
210
-
. /etc/bashrc.local
202
+
# Read system-wide modifications.
203
+
if test -f /etc/bashrc.local; then
204
+
. /etc/bashrc.local
214
-
environment.etc.bash_logout.text = ''
215
-
# /etc/bash_logout: DO NOT EDIT -- this file has been generated automatically.
208
+
environment.etc.bash_logout.text = ''
209
+
# /etc/bash_logout: DO NOT EDIT -- this file has been generated automatically.
217
-
# Only execute this file once per shell.
218
-
if [ -n "$__ETC_BASHLOGOUT_SOURCED" ] || [ -n "$NOSYSBASHLOGOUT" ]; then return; fi
219
-
__ETC_BASHLOGOUT_SOURCED=1
211
+
# Only execute this file once per shell.
212
+
if [ -n "$__ETC_BASHLOGOUT_SOURCED" ] || [ -n "$NOSYSBASHLOGOUT" ]; then return; fi
213
+
__ETC_BASHLOGOUT_SOURCED=1
223
-
# Read system-wide modifications.
224
-
if test -f /etc/bash_logout.local; then
225
-
. /etc/bash_logout.local
217
+
# Read system-wide modifications.
218
+
if test -f /etc/bash_logout.local; then
219
+
. /etc/bash_logout.local
229
-
# Configuration for readline in bash. We use "option default"
230
-
# priority to allow user override using both .text and .source.
231
-
environment.etc.inputrc.source = lib.mkOptionDefault ./inputrc;
223
+
# Configuration for readline in bash. We use "option default"
224
+
# priority to allow user override using both .text and .source.
225
+
environment.etc.inputrc.source = lib.mkOptionDefault ./inputrc;
233
-
users.defaultUserShell = lib.mkDefault pkgs.bashInteractive;
227
+
users.defaultUserShell = lib.mkDefault pkgs.bashInteractive;
235
-
environment.pathsToLink = lib.optionals cfg.completion.enable [
236
-
"/etc/bash_completion.d"
237
-
"/share/bash-completion"
229
+
environment.pathsToLink = lib.optionals cfg.completion.enable [
230
+
"/etc/bash_completion.d"
231
+
"/share/bash-completion"
240
-
environment.shells = [
241
-
"/run/current-system/sw/bin/bash"
242
-
"/run/current-system/sw/bin/sh"
243
-
"${pkgs.bashInteractive}/bin/bash"
244
-
"${pkgs.bashInteractive}/bin/sh"
234
+
environment.shells = [
235
+
"/run/current-system/sw/bin/bash"
236
+
"/run/current-system/sw/bin/sh"
237
+
"${pkgs.bashInteractive}/bin/bash"
238
+
"${pkgs.bashInteractive}/bin/sh"