2023-05-16 10:40:34 +02:00
|
|
|
{ pkgs, config, ... }:
|
2023-04-21 20:03:23 +02:00
|
|
|
{
|
|
|
|
programs.command-not-found.enable = false;
|
2023-04-21 20:13:57 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
fzf
|
|
|
|
bat
|
|
|
|
exa
|
2023-04-24 10:57:32 +02:00
|
|
|
trash-cli
|
2023-04-21 20:13:57 +02:00
|
|
|
];
|
2023-04-21 20:03:23 +02:00
|
|
|
users.defaultUserShell = pkgs.zsh;
|
|
|
|
programs.zsh = {
|
|
|
|
enable = true;
|
|
|
|
shellAliases = {
|
|
|
|
rm = "trash";
|
|
|
|
ls = "exa --icons";
|
|
|
|
l = "ls -l";
|
|
|
|
ll = "ls -la";
|
|
|
|
la = "ls -a";
|
2023-04-21 20:13:57 +02:00
|
|
|
less = "bat";
|
2023-04-21 20:03:23 +02:00
|
|
|
update = "cd /etc/nixos && nix flake update && cat ${../images/another-cat.sixel}";
|
|
|
|
garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}";
|
|
|
|
};
|
|
|
|
histSize = 100000;
|
|
|
|
histFile = "~/.local/share/zsh/history";
|
|
|
|
autosuggestions = {
|
|
|
|
enable = true;
|
|
|
|
highlightStyle = "fg=#00bbbb,bold";
|
|
|
|
};
|
|
|
|
|
|
|
|
ohMyZsh = {
|
|
|
|
enable = true;
|
|
|
|
plugins = [ "gh" ];
|
|
|
|
theme = "agnoster";
|
|
|
|
};
|
|
|
|
|
2023-04-21 20:32:30 +02:00
|
|
|
shellInit =
|
2023-04-21 20:03:23 +02:00
|
|
|
''
|
|
|
|
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
|
|
|
|
function svpn() {
|
|
|
|
unit=$(systemctl list-unit-files | grep "openconnect\|wg-quick\|wireguard\|openvpn" | cut -d "." -f1 | fzf --preview 'systemctl status {}')
|
|
|
|
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
|
|
|
|
|
|
|
zsh-newuser-install () {}
|
|
|
|
|
2023-05-16 10:40:34 +02:00
|
|
|
switch() {
|
|
|
|
OUT_PATH=/tmp/nixos-rebuild-nom-$(date +%s)
|
|
|
|
${pkgs.nix-output-monitor}/bin/nom build /etc/nixos#nixosConfigurations.${config.networking.hostName}.config.system.build.toplevel -o $OUT_PATH
|
|
|
|
sudo $OUT_PATH/bin/switch-to-configuration switch
|
|
|
|
unlink $OUT_PATH
|
|
|
|
}
|
|
|
|
|
2023-04-21 20:03:23 +02:00
|
|
|
'';
|
2023-04-21 20:32:30 +02:00
|
|
|
|
|
|
|
# Hacky way to bind Ctrl+R to fzf. Otherwise it will be overridden
|
|
|
|
promptInit =
|
|
|
|
''
|
|
|
|
source ${pkgs.fzf}/share/fzf/completion.zsh
|
|
|
|
source ${pkgs.fzf}/share/fzf/key-bindings.zsh
|
2023-05-16 10:40:34 +02:00
|
|
|
if [[ "$(hostname)" == "thinkpad" ]]
|
|
|
|
then
|
|
|
|
cat ${../images/cat.sixel}
|
|
|
|
fi
|
2023-04-21 20:32:30 +02:00
|
|
|
'';
|
2023-04-21 20:03:23 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|