From 9ab64ca35f20aafc8813bf3a1ef0af8482f3c78d Mon Sep 17 00:00:00 2001 From: Jacob Bachmann Date: Sun, 31 Aug 2025 17:09:38 +0200 Subject: [PATCH] chore: bump dependencies --- .gitignore | 1 + flake.lock | 24 +++++++-------- hosts/PABU/applications.nix | 3 ++ hosts/PABU/user.nix | 56 +++++++++++++++++++++++++++++------ modules/core/applications.nix | 1 + 5 files changed, 64 insertions(+), 21 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b2be92b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result diff --git a/flake.lock b/flake.lock index 9cb91d8..2012c2b 100644 --- a/flake.lock +++ b/flake.lock @@ -52,11 +52,11 @@ ] }, "locked": { - "lastModified": 1755519972, - "narHash": "sha256-bU4nqi3IpsUZJeyS8Jk85ytlX61i4b0KCxXX9YcOgVc=", + "lastModified": 1756115622, + "narHash": "sha256-iv8xVtmLMNLWFcDM/HcAPLRGONyTRpzL9NS09RnryRM=", "owner": "nix-community", "repo": "disko", - "rev": "4073ff2f481f9ef3501678ff479ed81402caae6d", + "rev": "bafad29f89e83b2d861b493aa23034ea16595560", "type": "github" }, "original": { @@ -88,11 +88,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1755330281, - "narHash": "sha256-aJHFJWP9AuI8jUGzI77LYcSlkA9wJnOIg4ZqftwNGXA=", + "lastModified": 1756245047, + "narHash": "sha256-9bHzrVbjAudbO8q4vYFBWlEkDam31fsz0J7GB8k4AsI=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "3dac8a872557e0ca8c083cdcfc2f218d18e113b0", + "rev": "a65b650d6981e23edd1afa1f01eb942f19cdcbb7", "type": "github" }, "original": { @@ -104,11 +104,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1755471983, - "narHash": "sha256-axUoWcm4cNQ36jOlnkD9D40LTfSQgk8ExfHSRm3rTtg=", + "lastModified": 1756469547, + "narHash": "sha256-YvtD2E7MYsQ3r7K9K2G7nCslCKMPShoSEAtbjHLtH0k=", "owner": "nixos", "repo": "nixpkgs", - "rev": "48f4c982de68d966421d2b6f1ddbeb6227cc5ceb", + "rev": "41d292bfc37309790f70f4c120b79280ce40af16", "type": "github" }, "original": { @@ -120,11 +120,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1755186698, - "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "lastModified": 1756542300, + "narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "rev": "d7600c775f877cd87b4f5a831c28aa94137377aa", "type": "github" }, "original": { diff --git a/hosts/PABU/applications.nix b/hosts/PABU/applications.nix index f7aa030..d36642a 100644 --- a/hosts/PABU/applications.nix +++ b/hosts/PABU/applications.nix @@ -12,6 +12,7 @@ expect fzf gum + rsync # mason needs stuff gcc clang-tools @@ -30,6 +31,8 @@ nixd nixfmt-rfc-style inputs.agenix.packages.x86_64-linux.default + nix-output-monitor + nvd ]; } diff --git a/hosts/PABU/user.nix b/hosts/PABU/user.nix index f72828f..7feb0ec 100644 --- a/hosts/PABU/user.nix +++ b/hosts/PABU/user.nix @@ -30,39 +30,77 @@ "${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la --tree"; llt = "${pkgs.expect}/bin/unbuffer ${pkgs.eza}/bin/eza --group-directories-first --hyperlink --icons -la --tree | ${pkgs.less}/bin/less -r"; + sa = '' + if ps -p $SSH_AGENT_PID > /dev/null 2>&1; then ${pkgs.gum}/bin/gum log -l info "ssh-agent is already running: pid: $SSH_AGENT_PID"; else eval $(ssh-agent); ssh-add ~/.ssh/id_ed25519; ${pkgs.gum}/bin/gum log -l info "ssh-agent started"; fi''; }; }; environment.systemPackages = [ (pkgs.writeShellScriptBin "n" '' set -euo pipefail - action=$(${pkgs.gum}/bin/gum choose switch test clean) - target=$(${pkgs.gum}/bin/gum choose PABU APPA MOMO) + + action=$(${pkgs.gum}/bin/gum choose --header "Choose action:" build clean) + target=$(${pkgs.gum}/bin/gum choose --header "Choose target:" PABU APPA MOMO) + + case "$target" in + "PABU") + ;; + *) + if ! ps -p $SSH_AGENT_PID > /dev/null; then + ${pkgs.gum}/bin/gum log -t kitchen -l error "ssh-agent is not running! Please run \"sa\". Exiting ..." + exit 1 + fi + ${pkgs.rsync}/bin/rsync -r . $target:/root/nix/ + ;; + esac + case "$action" in "clean") case "$target" in "PABU") - gum log -t kitchen -l info "Running: sudo nix-collect-garbage -d && nix store gc && nix-store --optimise" + ${pkgs.gum}/bin/gum log -t kitchen -l info "Running: sudo nix-collect-garbage -d && nix store gc && nix-store --optimise" sudo nix-collect-garbage -d && nix store gc && nix-store --optimise ;; *) - gum log -t kitchen -l info "Running: ssh $target \"nix-collect-garbage -d && nix store gc && nix-store --optimise\"" + ${pkgs.gum}/bin/gum log -t kitchen -l info "Running: ssh $target \"nix-collect-garbage -d && nix store gc && nix-store --optimise\"" ssh $target "nix-collect-garbage -d && nix store gc && nix-store --optimise" ;; esac ;; - *) + "build") case "$target" in "PABU") - gum log -t kitchen -l info "Running: sudo nixos-rebuild $action --option sandbox false --flake .#PABU" - sudo nixos-rebuild $action --option sandbox false --flake .#PABU + sudo nixos-rebuild build --option sandbox false --log-format internal-json -v --flake .#PABU |& ${pkgs.nix-output-monitor}/bin/nom --json + ${pkgs.nvd}/bin/nvd --color=always diff /run/current-system result + postBuildAction=$(${pkgs.gum}/bin/gum choose --header "Choose post-build-action" skip switch boot test ) + case "$postBuildAction" in + "skip") + ${pkgs.gum}/bin/gum log -t kitchen -l info "Skipping ..." + ;; + *) + sudo ./result/bin/switch-to-configuration $postBuildAction + ;; + esac ;; *) - gum log -t kitchen -l info "Running: nixos-rebuild $action --build-host $target --target-host $target --flake .#$target" - nixos-rebuild $action --build-host $target --target-host $target --flake .#$target + ssh $target "cd /root/nix; nixos-rebuild build --log-format internal-json -v --flake .#$target" |& ${pkgs.nix-output-monitor}/bin/nom --json + ssh $target "cd /root/nix; nix run nixpkgs#nvd -- --color=always diff /run/current-system result" + postBuildAction=$(${pkgs.gum}/bin/gum choose --header "Choose post-build-action" skip switch boot test ) + case "$postBuildAction" in + "skip") + ${pkgs.gum}/bin/gum log -t kitchen -l info "Skipping ..." + ;; + *) + ssh $target "cd /root/nix; ./result/bin/switch-to-configuration $postBuildAction" + ;; + esac ;; esac ;; + *) + ${pkgs.gum}/bin/gum log -t kitchen -l error "Unkown action: $action. Exiting ..." + exit 1 + ;; esac '') ]; diff --git a/modules/core/applications.nix b/modules/core/applications.nix index 08aa333..88ea327 100644 --- a/modules/core/applications.nix +++ b/modules/core/applications.nix @@ -27,5 +27,6 @@ pkgs.hexedit pkgs.gdu # fast disk usage analyzer with console interface written in go pkgs.duf # disk usage/free utility - a better 'df' alternative + pkgs.nvd # Nix/NixOS package version diff tool ]; }