From db5f67d5292eaddf891bcfc3691749d1fcffa1a4 Mon Sep 17 00:00:00 2001 From: Rouven Seifert Date: Tue, 16 May 2023 10:40:34 +0200 Subject: [PATCH] added nom to the nixos switch function --- shared/zsh.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/shared/zsh.nix b/shared/zsh.nix index ea3c14f..317ad96 100644 --- a/shared/zsh.nix +++ b/shared/zsh.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, config, ... }: { programs.command-not-found.enable = false; environment.systemPackages = with pkgs; [ @@ -17,7 +17,6 @@ ll = "ls -la"; la = "ls -a"; 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}"; garbage = "sudo nix-collect-garbage -d && cat ${../images/cat-garbage.sixel}"; }; @@ -49,13 +48,16 @@ prompt_dir() { prompt_segment blue $CURRENT_FG '%c' } - if [[ "$(hostname)" == "thinkpad" ]] - then - cat ${../images/cat.sixel} - fi 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 @@ -63,6 +65,10 @@ '' source ${pkgs.fzf}/share/fzf/completion.zsh source ${pkgs.fzf}/share/fzf/key-bindings.zsh + if [[ "$(hostname)" == "thinkpad" ]] + then + cat ${../images/cat.sixel} + fi ''; }; }