task | add justfile
This commit is contained in:
parent
ed6d81e5f8
commit
7a2ad1e7c0
1 changed files with 93 additions and 0 deletions
93
justfile
Normal file
93
justfile
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
HOSTNAME := `hostname -s`
|
||||
|
||||
# Do as test build without installing
|
||||
test:
|
||||
alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false)
|
||||
colmena build --on {{HOSTNAME}}
|
||||
|
||||
# Apply config on hostname
|
||||
switch hostname=(HOSTNAME):
|
||||
set -x
|
||||
set +x
|
||||
colmena exec --on {{hostname}} "locate home-manager-backup | sort -u | xargs rm -f"
|
||||
colmena apply --on {{HOSTNAME}}
|
||||
|
||||
# Build and install the world!
|
||||
world:
|
||||
colmena exec "locate home-manager-backup | sort -u | xargs rm -f"
|
||||
colmena apply
|
||||
|
||||
# Build and install the workstations
|
||||
workstation:
|
||||
colmena exec --on @workstation "locate home-manager-backup | sort -u | xargs rm -f"
|
||||
colmena apply --on @workstation
|
||||
|
||||
# Build and install the servers
|
||||
server:
|
||||
colmena exec --on @server "locate home-manager-backup | sort -u | xargs rm -f"
|
||||
colmena apply --on @server
|
||||
|
||||
# Build and install the webhosts
|
||||
web:
|
||||
colmena exec --on @web "locate home-manager-backup | sort -u | xargs rm -f"
|
||||
colmena apply --on @web
|
||||
|
||||
# Build and run a vm FIXME
|
||||
vm:
|
||||
alejandra . &> nixos-switch.log || ( cat nixos-switch.log && false)
|
||||
rm -f nixos-switch.log
|
||||
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)
|
||||
|
||||
# Stuff to do weekly
|
||||
weekly: pull clean update world ci push clean-world
|
||||
|
||||
# Update flake.lock
|
||||
update:
|
||||
echo "Updating flake.lock"
|
||||
nix flake update &> nixos-switch.log || ( cat nixos-switch.log && false)
|
||||
rm -f nixos-switch.log
|
||||
|
||||
# Clean up
|
||||
clean hostname=(HOSTNAME):
|
||||
echo "Cleaning old entries and store"
|
||||
home-manager expire-generations "-5 days"
|
||||
echo "Garbage Collection"
|
||||
colmena exec --on {{hostname}} nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old
|
||||
echo "Store optimise"
|
||||
colmena exec --on {{hostname}} nix store optimise
|
||||
|
||||
# Clean up the world
|
||||
clean-world:
|
||||
echo "Cleaning old entries and store"
|
||||
colmena exec 'home-manager expire-generations "-5 days"'
|
||||
echo "Garbage Collection"
|
||||
colmena exec 'nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old'
|
||||
echo "Store optimise"
|
||||
colmena exec 'nix store optimise'
|
||||
|
||||
# Push local changes to git
|
||||
push:
|
||||
echo pushing to git
|
||||
git push
|
||||
|
||||
# Pull changes from git
|
||||
pull:
|
||||
echo Updating from git repo
|
||||
git pull &> nixos-switch.log || ( cat nixos-switch.log && false)
|
||||
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)
|
||||
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)
|
||||
# rm -f nixos-switch.log
|
||||
|
||||
# Add everything to git
|
||||
ci:
|
||||
echo "git commit all"
|
||||
git commit -m"updates from makefile" --all &> nixos-switch.log || ( cat nixos-switch.log && false)
|
||||
rm -f nixos-switch.log
|
||||
|
||||
|
||||
# Reboot this host
|
||||
reboot:
|
||||
doas reboot
|
||||
Loading…
Add table
Add a link
Reference in a new issue