1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 11:39:46 +01:00

bash: add logoutExtra option

This commit is contained in:
Tobias Happ 2019-07-23 23:55:41 +02:00 committed by Matthieu Coudron
parent 1499b85ac6
commit 8b759c24e6
4 changed files with 44 additions and 0 deletions

View file

@ -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;
}

View file

@ -1,3 +1,4 @@
{
bash-logout = ./logout.nix;
bash-session-variables = ./session-variables.nix;
}

View file

@ -0,0 +1,4 @@
# -*- mode: sh -*-
clear-console

View 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}
'';
};
}