NixOS-Configs/makefile
2024-04-19 07:05:41 -05:00

50 lines
1.3 KiB
Makefile

HOSTNAME := $(shell hostname -s)
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
all:
@locate home-manager-backup | sort -u | xargs rm -f
doas nixos-rebuild build --flake .#${HOSTNAME}
switch:
doas nixos-rebuild switch --flake .#${HOSTNAME}
weekly: pull clean update ci switch push
cweekly: clean pull switch
update:
nix flake update
clean:
home-manager expire-generations "-5 days"
doas nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old
doas nix store optimise
push:
@. ~/.bash_ssh
git push
pull:
@. ~/.bash_ssh
git pull
doas nix-prefetch-url file://$$PWD/$$(ls -1 src/linuxx64* | tail -n1)
# doas nix-prefetch-url file://$$PWD/$$(ls -1 src/linuxarm64* | tail -n1)
# pocket2 does not really have enough space to do this locally
pocket2:
@ssh pocket2 "locate home-manager-backup | sort -u | xargs rm -f"
@ssh pocket2 "doas nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old"
@nixos-rebuild switch --flake .#pocket2 --target-host root@pocket2
@ssh pocket2 "doas nix-collect-garbage --quiet --log-format bar --no-build-output --delete-old"
@ssh pocket2 "doas nix store optimise"
ci:
git commit -m"updates from makefile" --all
check:
@nix flake check --show-trace $(ARGS)
test: check
doas nixos-rebuild dry-build --flake ./#$(HOSTNAME)