added nom to the nixos switch function

This commit is contained in:
Rouven Seifert 2023-05-16 10:40:34 +02:00
parent e57560d0b5
commit db5f67d529
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, config, ... }:
{ {
programs.command-not-found.enable = false; programs.command-not-found.enable = false;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -17,7 +17,6 @@
ll = "ls -la"; ll = "ls -la";
la = "ls -a"; la = "ls -a";
less = "bat"; less = "bat";
switch = "sudo nixos-rebuild switch && cat ${../images/another-cat-2.sixel}";
update = "cd /etc/nixos && nix flake update && cat ${../images/another-cat.sixel}"; update = "cd /etc/nixos && nix flake update && cat ${../images/another-cat.sixel}";
garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}"; garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}";
}; };
@ -49,13 +48,16 @@
prompt_dir() { prompt_dir() {
prompt_segment blue $CURRENT_FG '%c' prompt_segment blue $CURRENT_FG '%c'
} }
if [[ "$(hostname)" == "thinkpad" ]]
then
cat ${../images/cat.sixel}
fi
zsh-newuser-install () {} zsh-newuser-install () {}
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
}
''; '';
# Hacky way to bind Ctrl+R to fzf. Otherwise it will be overridden # Hacky way to bind Ctrl+R to fzf. Otherwise it will be overridden
@ -63,6 +65,10 @@
'' ''
source ${pkgs.fzf}/share/fzf/completion.zsh source ${pkgs.fzf}/share/fzf/completion.zsh
source ${pkgs.fzf}/share/fzf/key-bindings.zsh source ${pkgs.fzf}/share/fzf/key-bindings.zsh
if [[ "$(hostname)" == "thinkpad" ]]
then
cat ${../images/cat.sixel}
fi
''; '';
}; };
} }