task | make justfile less chatty

This commit is contained in:
Don Harper 2024-11-13 15:51:32 -06:00
parent 7d5294b0ff
commit 76b1292896

View file

@ -2,92 +2,91 @@ HOSTNAME := `hostname -s`
# Do as test build without installing # Do as test build without installing
test: test:
alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false) @alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false)
colmena build --on {{HOSTNAME}} @rm -f nixos-switch.log
@colmena build --on {{HOSTNAME}}
# Apply config on hostname # Apply config on hostname
switch hostname=(HOSTNAME): switch hostname=(HOSTNAME):
set -x @colmena exec --on {{hostname}} "locate home-manager-backup | sort -u | xargs rm -f"
set +x @colmena apply --on {{HOSTNAME}}
colmena exec --on {{hostname}} "locate home-manager-backup | sort -u | xargs rm -f"
colmena apply --on {{HOSTNAME}}
# Build and install the world! # Build and install the world!
world: world:
colmena exec "locate home-manager-backup | sort -u | xargs rm -f" @colmena exec "locate home-manager-backup | sort -u | xargs rm -f"
colmena apply @colmena apply
# Build and install the workstations # Build and install the workstations
workstation: workstation:
colmena exec --on @workstation "locate home-manager-backup | sort -u | xargs rm -f" @colmena exec --on @workstation "locate home-manager-backup | sort -u | xargs rm -f"
colmena apply --on @workstation @colmena apply --on @workstation
# Build and install the servers # Build and install the servers
server: server:
colmena exec --on @server "locate home-manager-backup | sort -u | xargs rm -f" @colmena exec --on @server "locate home-manager-backup | sort -u | xargs rm -f"
colmena apply --on @server @colmena apply --on @server
# Build and install the webhosts # Build and install the webhosts
web: web:
colmena exec --on @web "locate home-manager-backup | sort -u | xargs rm -f" @colmena exec --on @web "locate home-manager-backup | sort -u | xargs rm -f"
colmena apply --on @web @colmena apply --on @web
# Build and run a vm FIXME # Build and run a vm FIXME
vm: vm:
alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false) @alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false)
rm -f nixos-switch.log @rm -f nixos-switch.log
echo Running iso build @echo Running iso build
nix build --impure ./#nixosConfigurations.vm.config.system.build.isoImage &> nixos-switch.log || ( grep -E --color '(error|For full logs)' nixos-switch.log && false) @nix build --impure ./#nixosConfigurations.vm.config.system.build.isoImage &> nixos-switch.log || ( grep -E --color '(error|For full logs)' nixos-switch.log && false)
# Stuff to do weekly # Stuff to do weekly
weekly: pull clean update world ci push clean-world weekly: pull clean update world ci push clean-world
# Update flake.lock # Update flake.lock
update: update:
echo "Updating flake.lock" @echo "Updating flake.lock"
nix flake update &> nixos-switch.log || ( cat nixos-switch.log && false) @nix flake update &> nixos-switch.log || ( cat nixos-switch.log && false)
rm -f nixos-switch.log @rm -f nixos-switch.log
# Clean up # Clean up
clean hostname=(HOSTNAME): clean hostname=(HOSTNAME):
echo "Cleaning old entries and store" @echo "Cleaning old entries and store"
home-manager expire-generations "-5 days" @home-manager expire-generations "-5 days"
echo "Garbage Collection" @echo "Garbage Collection"
colmena exec --on {{hostname}} nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old @colmena exec --on {{hostname}} nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old
echo "Store optimise" @echo "Store optimise"
colmena exec --on {{hostname}} nix store optimise @colmena exec --on {{hostname}} nix store optimise
# Clean up the world # Clean up the world
clean-world: clean-world:
echo "Cleaning old entries and store" @echo "Cleaning old entries and store"
colmena exec 'home-manager expire-generations "-5 days"' @colmena exec 'home-manager expire-generations "-5 days"'
echo "Garbage Collection" @echo "Garbage Collection"
colmena exec 'nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old' @colmena exec 'nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old'
echo "Store optimise" @echo "Store optimise"
colmena exec 'nix store optimise' @colmena exec 'nix store optimise'
# Push local changes to git # Push local changes to git
push: push:
echo pushing to git @echo pushing to git
git push @git push
# Pull changes from git # Pull changes from git
pull: pull:
echo Updating from git repo @echo Updating from git repo
git pull &> nixos-switch.log || ( cat nixos-switch.log && false) @git pull &> nixos-switch.log || ( cat nixos-switch.log && false)
rm -f nixos-switch.log @rm -f nixos-switch.log
doas nix-prefetch-url file://`pwd`/`ls -1 src/linuxx64* | tail -n1` &> nixos-switch.log || ( cat nixos-switch.log && false) @doas nix-prefetch-url file://`pwd`/`ls -1 src/linuxx64* | tail -n1` &> nixos-switch.log || ( cat nixos-switch.log && false)
rm -f nixos-switch.log @rm -f nixos-switch.log
# doas nix-prefetch-url file://`pwd`/`ls -1 src/linuxarm64* | tail -n1` &> nixos-switch.log || ( cat nixos-switch.log && false) # @doas nix-prefetch-url file://`pwd`/`ls -1 src/linuxarm64* | tail -n1` &> nixos-switch.log || ( cat nixos-switch.log && false)
# rm -f nixos-switch.log # @rm -f nixos-switch.log
# Add everything to git # Add everything to git
ci: ci:
echo "git commit" @echo "git commit"
git commit -m"chore | Update flake.lock" flake.lock &> nixos-switch.log || ( cat nixos-switch.log && false) @git commit -m"chore | Update flake.lock" flake.lock &> nixos-switch.log || ( cat nixos-switch.log && false)
rm -f nixos-switch.log @rm -f nixos-switch.log
# Reboot this host # Reboot this host
reboot: reboot:
doas reboot @doas reboot