Nothing fancy, just using automation as an excuse to play around with nushell scripting.
HINOSPQOA75CMI27YWJOFB5ICZYR7WZS576BFUFH57R75W6LNPQQC #!/usr/bin/env nu# Learning nushell by writing a simple updater script# Mostly just testing out all the different language featuresuse std assert;const required_paths = [".pijul" "flake.nix"];# Helper function to make sure all necessary paths are presentdef assert_path_exists [candidate] {assert ($candidate | path exists) $"(ansi red) Failed to find required file: (ansi red_bold)($candidate)(ansi reset)"}# If not root, need to elevate permissionslet script_location = $env.CURRENT_FILE;let parent_dir = $script_location | path dirname;echo $"(ansi purple)Attempting update in (ansi green_bold)($parent_dir)(ansi reset)";cd $parent_dir;# Check all the required paths are here$required_paths | each {|required_path| assert_path_exists $required_path}# Make sure to record changes, even if trivialpijul recordnix flake update;sudo nixos-rebuild switch --upgrade-all --impure;# Upgrade all the other package managerstopgrade --disable nix --disable system --yes --no-retry