2023-12-12 19:15:00 +00:00
|
|
|
{ lib, pkgs, ... }:
|
2020-09-18 13:54:09 +00:00
|
|
|
{
|
2023-04-30 06:11:27 +00:00
|
|
|
imports = [
|
2023-05-22 06:54:33 +00:00
|
|
|
./kubernetes.nix
|
2023-04-30 06:11:27 +00:00
|
|
|
./powerline.nix
|
|
|
|
];
|
2021-10-11 17:08:18 +00:00
|
|
|
|
2020-09-24 05:45:48 +00:00
|
|
|
environment.systemPackages = with pkgs; [
|
2023-09-21 04:27:15 +00:00
|
|
|
darkhttpd
|
2021-07-17 23:34:52 +00:00
|
|
|
dnsutils
|
2021-07-17 23:34:26 +00:00
|
|
|
du-dust
|
2020-09-24 05:45:48 +00:00
|
|
|
entr
|
2021-07-17 23:34:52 +00:00
|
|
|
file
|
2020-09-24 05:45:48 +00:00
|
|
|
gcc
|
2021-10-21 20:58:22 +00:00
|
|
|
iftop
|
2021-08-23 04:57:55 +00:00
|
|
|
inetutils
|
2021-10-21 20:58:22 +00:00
|
|
|
iotop
|
2020-10-24 01:50:14 +00:00
|
|
|
jq
|
2021-07-17 23:34:52 +00:00
|
|
|
lm_sensors
|
|
|
|
ncdu
|
2021-04-05 23:08:19 +00:00
|
|
|
nix-index
|
2021-11-12 19:56:01 +00:00
|
|
|
nix-prefetch-github
|
2021-05-26 17:03:14 +00:00
|
|
|
nix-top
|
2021-07-17 23:34:52 +00:00
|
|
|
nixpkgs-fmt
|
2023-08-11 17:03:47 +00:00
|
|
|
nodejs
|
2021-07-17 23:34:52 +00:00
|
|
|
openssl
|
2022-02-24 15:30:14 +00:00
|
|
|
parted
|
2022-10-05 15:51:56 +00:00
|
|
|
pciutils
|
2021-07-17 23:34:52 +00:00
|
|
|
psmisc
|
|
|
|
pv
|
|
|
|
pwgen
|
|
|
|
python3
|
|
|
|
rsync
|
|
|
|
sqlite
|
|
|
|
tcpdump
|
|
|
|
tree
|
|
|
|
unzip
|
|
|
|
usbutils
|
|
|
|
wget
|
|
|
|
whois
|
2022-11-04 16:24:09 +00:00
|
|
|
yq
|
2021-07-17 23:34:52 +00:00
|
|
|
zip
|
2020-09-18 13:54:09 +00:00
|
|
|
|
2021-03-22 19:09:30 +00:00
|
|
|
(writeShellScriptBin "dirt" "while sleep 1; do grep '^Dirty:' /proc/meminfo ; done")
|
|
|
|
|
2022-02-24 15:26:11 +00:00
|
|
|
(writeShellScriptBin "nr" "exec nix repl \"$(nix eval nixpkgs#path)\"")
|
|
|
|
|
2023-09-07 19:37:30 +00:00
|
|
|
(lib.hiPrio (writeShellScriptBin "iftop" ''
|
|
|
|
exec ${iftop}/bin/iftop -P -m100M "$@"
|
|
|
|
''))
|
|
|
|
|
2023-06-05 15:04:08 +00:00
|
|
|
(writeShellScriptBin "bat" ''
|
2023-09-11 02:14:03 +00:00
|
|
|
${bat}/bin/bat --color=always --wrap=never --terminal-width=80 "$@"
|
2023-06-05 15:04:08 +00:00
|
|
|
'')
|
|
|
|
|
2023-05-25 18:55:33 +00:00
|
|
|
(writeShellScriptBin "pip-install" ''
|
|
|
|
nix run 'nixpkgs#python3.pkgs.pip' -- install --user --upgrade --break-system-packages pip
|
|
|
|
'')
|
2021-04-30 02:21:47 +00:00
|
|
|
|
2022-06-17 15:20:15 +00:00
|
|
|
(writeShellScriptBin "nix-roots" ''
|
|
|
|
nix-store --gc --print-roots | grep -v \
|
|
|
|
-e '^/proc/' \
|
|
|
|
-e '/.cache/nix/flake-registry.json '
|
|
|
|
'')
|
|
|
|
|
2020-09-24 05:45:48 +00:00
|
|
|
(writeScriptBin "zfsram" ''
|
|
|
|
#!${pkgs.python3}/bin/python
|
|
|
|
for ln in open('/proc/spl/kstat/zfs/arcstats').readlines():
|
|
|
|
if ln.startswith('size '):
|
|
|
|
print(str(int(ln.split(' ')[-1])/(1024*1024*1024))[:5],'GB')
|
|
|
|
'')
|
2020-10-01 15:40:28 +00:00
|
|
|
|
2021-06-28 17:20:20 +00:00
|
|
|
];
|
2020-09-18 13:54:09 +00:00
|
|
|
|
2023-10-13 17:46:54 +00:00
|
|
|
system.activationScripts.editorconfig = ''
|
|
|
|
cat <<EOF >/.editorconfig
|
|
|
|
[*]
|
|
|
|
tab_width = 4
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
2022-01-22 18:35:35 +00:00
|
|
|
environment.variables.HTOPRC = "/dev/null";
|
2021-11-09 16:34:10 +00:00
|
|
|
programs.htop = {
|
|
|
|
enable = true;
|
|
|
|
settings = {
|
|
|
|
hide_userland_threads = 1;
|
|
|
|
highlight_base_name = 1;
|
|
|
|
show_program_path = 0;
|
2021-11-12 16:04:17 +00:00
|
|
|
tree_sort_direction = -1;
|
2021-11-09 16:34:10 +00:00
|
|
|
tree_view = 1;
|
2022-11-29 19:29:26 +00:00
|
|
|
update_process_names = 1;
|
2021-11-09 16:34:10 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-11-09 16:17:19 +00:00
|
|
|
programs.git = {
|
|
|
|
enable = true;
|
|
|
|
config = {
|
2023-09-04 01:55:58 +00:00
|
|
|
alias.up = "push";
|
|
|
|
alias.dn = "pull";
|
|
|
|
alias.sh = "show";
|
2022-02-10 06:46:28 +00:00
|
|
|
alias.glog = "log --all --decorate --oneline --graph";
|
2022-05-29 06:54:04 +00:00
|
|
|
alias.logl = "log --oneline -n10";
|
2023-01-08 17:30:27 +00:00
|
|
|
alias.vlog = "log --name-status";
|
2023-08-03 18:25:19 +00:00
|
|
|
core.pager = "less -x1,5";
|
2021-11-09 16:17:19 +00:00
|
|
|
pull.ff = "only";
|
|
|
|
init.defaultBranch = "main";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-12-20 05:51:18 +00:00
|
|
|
programs.tmux = {
|
|
|
|
enable = true;
|
|
|
|
terminal = "screen-256color";
|
2022-03-01 18:30:47 +00:00
|
|
|
extraConfig = ''
|
2022-08-04 14:03:51 +00:00
|
|
|
bind-key j command-prompt -p "Join pane:" "join-pane -s '%%'"
|
2023-08-31 14:23:44 +00:00
|
|
|
bind-key '"' split-window -v -c "#{pane_current_path}"
|
|
|
|
bind-key '%' split-window -h -c "#{pane_current_path}"
|
2023-08-31 05:11:34 +00:00
|
|
|
set -g base-index 1
|
|
|
|
set -g pane-base-index 1
|
|
|
|
set -g renumber-windows on
|
2023-09-19 01:24:37 +00:00
|
|
|
set -sa terminal-overrides ",*256color:Tc"
|
2023-11-12 07:29:37 +00:00
|
|
|
# escape-time reduces the time where the escape key acts as an alt key
|
|
|
|
set -s escape-time 1
|
2023-12-12 19:15:00 +00:00
|
|
|
################################################################################
|
|
|
|
# Smart pane switching with awareness of Vim splits.
|
|
|
|
# See: https://github.com/christoomey/vim-tmux-navigator
|
|
|
|
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
|
|
|
|
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
|
|
|
|
bind-key -n 'C-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
|
|
|
|
bind-key -n 'C-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
|
|
|
|
bind-key -n 'C-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
|
|
|
|
bind-key -n 'C-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
|
|
|
|
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
|
|
|
|
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
|
|
|
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
|
|
|
|
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
|
|
|
|
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
|
|
|
|
bind-key -T copy-mode-vi 'C-h' select-pane -L
|
|
|
|
bind-key -T copy-mode-vi 'C-j' select-pane -D
|
|
|
|
bind-key -T copy-mode-vi 'C-k' select-pane -U
|
|
|
|
bind-key -T copy-mode-vi 'C-l' select-pane -R
|
|
|
|
bind-key -T copy-mode-vi 'C-\' select-pane -l
|
2022-03-01 18:30:47 +00:00
|
|
|
'';
|
2020-12-20 05:51:18 +00:00
|
|
|
};
|
|
|
|
|
2020-09-24 05:45:48 +00:00
|
|
|
programs.bash.interactiveShellInit = ''
|
|
|
|
stty -ixon
|
2023-11-18 20:11:06 +00:00
|
|
|
alias jq='jq --indent 4'
|
|
|
|
alias yq='yq --indent 4'
|
2020-09-24 05:45:48 +00:00
|
|
|
alias p=python3
|
2021-11-10 01:53:49 +00:00
|
|
|
alias hd='hexdump -C'
|
2021-04-09 02:44:57 +00:00
|
|
|
alias nix-env="echo nix-env is disabled #"
|
2022-01-06 20:23:55 +00:00
|
|
|
alias nix-what-depends-on='nix-store --query --referrers'
|
2022-01-20 02:25:05 +00:00
|
|
|
alias day='date "+%Y-%m-%d"'
|
2022-05-27 21:46:51 +00:00
|
|
|
alias grep='grep --color=auto'
|
2022-08-10 03:17:54 +00:00
|
|
|
alias tmp='cd "$(mktemp -d)"'
|
2022-03-29 18:22:10 +00:00
|
|
|
'' +
|
|
|
|
# compatibility for programs that need $NIX_PATH set:
|
|
|
|
lib.concatMapStrings
|
|
|
|
(x: ''
|
|
|
|
alias ${x}='NIX_PATH="nixpkgs=$(nix eval nixpkgs#path)" ${x}'
|
|
|
|
'')
|
|
|
|
[
|
|
|
|
"nix-build"
|
|
|
|
"nix-index"
|
2022-04-24 16:08:06 +00:00
|
|
|
"nix-prefetch-github"
|
2022-03-29 18:22:10 +00:00
|
|
|
"nix-shell"
|
|
|
|
];
|
2020-09-18 13:54:09 +00:00
|
|
|
}
|