-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbash.nix
More file actions
44 lines (39 loc) · 1.04 KB
/
Copy pathbash.nix
File metadata and controls
44 lines (39 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{
delib,
homeconfig,
lib,
constants,
...
}:
delib.module {
name = "programs.bash";
options.programs.bash = with delib; {
enable = boolOption true;
historyFile = strOption (homeconfig.home.homeDirectory + "/.bash_history");
historySize = intOption 10000;
};
myconfig.ifEnabled = {cfg, ...}: {
persist = let
cond = lib.hasPrefix homeconfig.home.homeDirectory cfg.historyFile;
val = path: {
file = path;
# FIXME: https://github.com/nix-community/impermanence/issues/273
# mode = "u=rw,g=,o=";
};
in {
user.files = lib.mkIf cond [(val (lib.removePrefix homeconfig.home.homeDirectory cfg.historyFile))];
files = lib.mkIf (!cond) [(val cfg.historyFile)];
};
};
home.ifEnabled = {cfg, ...}: {
programs.bash = {
enable = true;
historyControl = ["erasedups" "ignorespace"];
inherit (cfg) historyFile historySize;
initExtra = ''
bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'
'';
};
};
}