mirror of
https://github.com/nix-community/home-manager
synced 2024-11-23 03:29:45 +01:00
bash: add logoutExtra option
This commit is contained in:
parent
1499b85ac6
commit
8b759c24e6
4 changed files with 44 additions and 0 deletions
|
@ -123,6 +123,15 @@ in
|
|||
interactive shell.
|
||||
'';
|
||||
};
|
||||
|
||||
logoutExtra = mkOption {
|
||||
default = "";
|
||||
type = types.lines;
|
||||
description = ''
|
||||
Extra commands that should be run when logging out of an
|
||||
interactive shell.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -195,6 +204,14 @@ in
|
|||
${cfg.bashrcExtra}
|
||||
'';
|
||||
|
||||
home.file.".bash_logout" = mkIf (cfg.logoutExtra != "") {
|
||||
text = ''
|
||||
# -*- mode: sh -*-
|
||||
|
||||
${cfg.logoutExtra}
|
||||
'';
|
||||
};
|
||||
|
||||
home.packages =
|
||||
optional (cfg.enableAutojump) pkgs.autojump;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{
|
||||
bash-logout = ./logout.nix;
|
||||
bash-session-variables = ./session-variables.nix;
|
||||
}
|
||||
|
|
4
tests/modules/programs/bash/logout-expected.txt
Normal file
4
tests/modules/programs/bash/logout-expected.txt
Normal file
|
@ -0,0 +1,4 @@
|
|||
# -*- mode: sh -*-
|
||||
|
||||
clear-console
|
||||
|
22
tests/modules/programs/bash/logout.nix
Normal file
22
tests/modules/programs/bash/logout.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.bash = {
|
||||
enable = true;
|
||||
|
||||
logoutExtra = ''
|
||||
clear-console
|
||||
'';
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
assertFileExists home-files/.bash_logout
|
||||
assertFileContent \
|
||||
home-files/.bash_logout \
|
||||
${./logout-expected.txt}
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue