blob: 6bb6aaad16c33a79d9a813b36d73b6b47ab3bb28 (
plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
{
programs ={
fish = {
enable = true;
generateCompletions = true;
interactiveShellInit = ''
set fish_greeting # disable greeting
complete -c nixos -f
# autocomplete for `nixos` command
complete -c nixos \
-n "__fish_use_subcommand" \
-a "update" \
-d "Update system using nh"
complete -c nixos \
-n "__fish_use_subcommand" \
-a "upgrade" \
-d "Upgrade system using nh"
complete -c nixos \
-n "__fish_use_subcommand" \
-a "config" \
-d "Edit nix config file"
complete -c nixos \
-n "__fish_use_subcommand" \
-a "clean" \
-d "Clean nix store"
# make `nixos config` autocomplete based on $HOME/.nix
complete -c nixos \
-n "__fish_seen_subcommand_from config" \
-a "(__fish_nixos_config_files)" \
-f
'';
shellAliases = {
ls = "eza --icons=always --color=always";
ll = "eza -a --long --icons=always --color=always --no-time";
lt = "eza -a --long --tree --icons=always --color=always --no-time";
cat = "bat";
grep = "grep --color=auto";
mv = "mv -i";
cp = "cp -i";
rm = "rm -i";
fetch = "nix run nixpkgs#pfetch";
};
shellInitLast = '''';
functions = {
__fish_nixos_config_files = ''
# Only show directories and files inside ~/.nix
set base "$HOME/.nix"
for f in (command find $base \
\( -type d -name .git -prune \) -o \
-type f -print 2>/dev/null)
if string match -rq '\.(otf|ttf|svg|png|jpg)$' -- $f
continue
end
echo $f
end | while read -l f
set rel (string replace -r "^$base/" "" $f)
echo $rel
end
'';
nixos = ''
set defaultResponse "Usage: nixos update | up || nixos upgrade || nixos config <path> || nixos clean"
if test (count $argv) -lt 1
echo defaultResponse
return 1
end
switch $argv[1]
case update up
if test (count $argv) -gt 1
echo "Error: 'nixos update' takes no additional arguments."
return 1
end
nh os switch $HOME/.nix
case upgrade
if test (count $argv) -gt 1
echo "Error: 'nixos upgrade' takes no additional arguments."
return 1
end
nh os switch $HOME/.nix -u --ask
case config
if test (count $argv) -lt 2
echo "Error: 'nixos config' requires a <path> argument (relative to $HOME/.nix)"
return 1
end
hx ~/.nix/$argv[2]
case clean
if test (count $argv) -gt 1
echo "Error: 'nixos clean' takes no additional arguments."
return 1
end
nh clean all --verbose
case '*'
echo defaultResponse
return 1
end
'';
nix = ''
if test $argv[1] = develop
set -l flake
if test (count $argv) -lt 2
echo "Usage: nix develop <python|nim|js|flake> [..]"
return 1
end
switch $argv[2]
case python
set flake $HOME/.nix#python
set argv $argv[3..-1]
case js
set flake $HOME/.nix#js
set argv $argv[3..-1]
case python
set flake $HOME/.nix#nim
set argv $argv[3..-1]
case '*'
set flake $argv[2]
set argv $argv[3..-1]
end
command nix develop $flake -c fish
else
command nix $argv
end
'';
};
};
starship = {
enable = true;
};
atuin = {
enable = true;
enableFishIntegration = true;
};
};
}
|
; all rights regarding Text and Data Mining (TDM) are reserved.