2023-06-19 13:22:15 +02:00
|
|
|
|
{ pkgs, config, lib, ... }:
|
2023-04-21 20:03:23 +02:00
|
|
|
|
{
|
|
|
|
|
programs.command-not-found.enable = false;
|
2023-09-24 21:32:28 +02:00
|
|
|
|
programs.nix-index-database.comma.enable = true;
|
2023-04-21 20:13:57 +02:00
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
bat
|
2023-09-12 11:09:32 +02:00
|
|
|
|
eza
|
2023-05-21 13:50:49 +02:00
|
|
|
|
duf
|
2023-04-24 10:57:32 +02:00
|
|
|
|
trash-cli
|
2023-05-21 13:50:49 +02:00
|
|
|
|
nix-output-monitor
|
2023-11-07 19:56:10 +01:00
|
|
|
|
iperf
|
2023-04-21 20:13:57 +02:00
|
|
|
|
];
|
2023-04-21 20:03:23 +02:00
|
|
|
|
users.defaultUserShell = pkgs.zsh;
|
2024-04-17 16:13:17 +02:00
|
|
|
|
programs.fzf = {
|
|
|
|
|
keybindings = true;
|
|
|
|
|
};
|
2023-04-21 20:03:23 +02:00
|
|
|
|
programs.zsh = {
|
|
|
|
|
enable = true;
|
|
|
|
|
shellAliases = {
|
|
|
|
|
rm = "trash";
|
2023-09-12 11:09:32 +02:00
|
|
|
|
ls = "eza --icons";
|
2023-04-21 20:03:23 +02:00
|
|
|
|
l = "ls -l";
|
|
|
|
|
ll = "ls -la";
|
|
|
|
|
la = "ls -a";
|
2023-04-21 20:13:57 +02:00
|
|
|
|
less = "bat";
|
2023-05-16 11:49:31 +02:00
|
|
|
|
update = "cd /etc/nixos && nix flake update";
|
2023-11-16 13:29:18 +01:00
|
|
|
|
msh = "f() {mosh $1 zsh};f";
|
2023-04-21 20:03:23 +02:00
|
|
|
|
};
|
|
|
|
|
histSize = 100000;
|
|
|
|
|
histFile = "~/.local/share/zsh/history";
|
2023-07-30 19:41:51 +02:00
|
|
|
|
syntaxHighlighting.enable = true;
|
2023-04-21 20:03:23 +02:00
|
|
|
|
autosuggestions = {
|
|
|
|
|
enable = true;
|
|
|
|
|
highlightStyle = "fg=#00bbbb,bold";
|
|
|
|
|
};
|
2023-09-19 15:34:29 +02:00
|
|
|
|
shellInit = ''
|
|
|
|
|
zsh-newuser-install () {}
|
|
|
|
|
'';
|
2023-04-21 20:03:23 +02:00
|
|
|
|
|
2023-09-19 15:34:29 +02:00
|
|
|
|
interactiveShellInit =
|
2023-04-21 20:03:23 +02:00
|
|
|
|
''
|
2023-07-30 19:41:51 +02:00
|
|
|
|
export MCFLY_KEY_SCHEME=vim
|
|
|
|
|
export MCFLY_FUZZY=2
|
|
|
|
|
export MCFLY_DISABLE_MENU=TRUE
|
|
|
|
|
export MCFLY_RESULTS=30
|
|
|
|
|
export MCFLY_INTERFACE_VIEW=BOTTOM
|
|
|
|
|
export MCFLY_PROMPT="❯"
|
2024-04-26 10:36:09 +02:00
|
|
|
|
# fix for networkctl
|
|
|
|
|
zstyle ':completion:*:complete:networkctl:*' list-grouped true
|
2023-09-19 15:34:29 +02:00
|
|
|
|
source ${pkgs.agdsn-zsh-config}/etc/zsh/zshrc
|
2024-04-12 11:01:18 +02:00
|
|
|
|
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
|
2024-01-11 14:09:56 +01:00
|
|
|
|
unsetopt extendedglob
|
|
|
|
|
|
2023-09-19 15:34:29 +02:00
|
|
|
|
|
2023-04-21 20:03:23 +02:00
|
|
|
|
function svpn() {
|
2024-04-11 11:58:00 +02:00
|
|
|
|
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn\|openfortivpn" | cut -d "." -f1 | ${pkgs.fzf}/bin/fzf --preview 'systemctl status {}')
|
2023-04-21 20:03:23 +02:00
|
|
|
|
if [ $(systemctl is-active $unit) = "inactive" ]; then
|
|
|
|
|
systemctl start $unit
|
|
|
|
|
else
|
|
|
|
|
systemctl stop $unit
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
prompt_dir() {
|
|
|
|
|
prompt_segment blue $CURRENT_FG '%c'
|
|
|
|
|
}
|
2023-05-01 19:59:25 +02:00
|
|
|
|
|
2023-05-16 10:40:34 +02:00
|
|
|
|
switch() {
|
2023-05-18 12:49:06 +02:00
|
|
|
|
sudo true # ask the password so we can leave during the (sometimes quite long) build process
|
2023-05-16 10:40:34 +02:00
|
|
|
|
OUT_PATH=/tmp/nixos-rebuild-nom-$(date +%s)
|
2023-09-19 15:34:29 +02:00
|
|
|
|
${lib.getExe pkgs.nix-output-monitor} build /etc/nixos\#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel -o $OUT_PATH
|
2023-05-16 11:49:31 +02:00
|
|
|
|
sudo ${pkgs.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set $OUT_PATH
|
|
|
|
|
sudo $OUT_PATH/bin/switch-to-configuration switch
|
2023-05-16 10:40:34 +02:00
|
|
|
|
unlink $OUT_PATH
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-19 14:12:51 +02:00
|
|
|
|
garbage() {
|
|
|
|
|
${pkgs.home-manager}/bin/home-manager expire-generations "-0 days"
|
|
|
|
|
sudo nix-collect-garbage -d
|
|
|
|
|
echo Cleaning up boot entries...
|
|
|
|
|
sudo /run/current-system/bin/switch-to-configuration boot
|
|
|
|
|
echo Done
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-12 18:34:29 +02:00
|
|
|
|
sysdiff() {
|
|
|
|
|
echo System package diff:
|
|
|
|
|
${config.nix.package}/bin/nix store diff-closures $(command ls -d /nix/var/nix/profiles/system-* | tail -2)
|
|
|
|
|
}
|
2023-04-21 20:03:23 +02:00
|
|
|
|
'';
|
2023-04-21 20:32:30 +02:00
|
|
|
|
promptInit =
|
|
|
|
|
''
|
2024-04-11 11:58:00 +02:00
|
|
|
|
# if [[ "$(hostname)" == "thinkpad" ]]
|
|
|
|
|
# then
|
|
|
|
|
# cat ${../images/cat.sixel}
|
|
|
|
|
# fi
|
2023-08-03 13:30:40 +02:00
|
|
|
|
eval "$(${pkgs.mcfly}/bin/mcfly init zsh)"
|
2023-10-26 12:12:45 +02:00
|
|
|
|
eval "$(${pkgs.zoxide}/bin/zoxide init zsh)"
|
2023-04-21 20:32:30 +02:00
|
|
|
|
'';
|
2023-04-21 20:03:23 +02:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|