[TASK] Add build in current dir

This commit is contained in:
Sebastian Fischer 2026-04-16 07:10:36 +02:00
parent 97c029f623
commit 67ea1f0f39

View File

@ -6,34 +6,56 @@ SHELL := $(shell which bash)
.SILENT:
.PHONY: sync
sync:
sudo rsync -a --exclude='hardware-configuration.nix' nixos/ /etc/nixos/
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
.PHONY: sync-dry-run
sync-dry-run:
sudo rsync -a --dry-run --verbose --exclude='hardware-configuration.nix' nixos/ /etc/nixos/
.PHONY: add-pre-commit-hook
add-pre-commit-hook:
printf '#!/bin/sh\nmake test\n' > .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
#
# uses etc
#
.PHONY: sync-etc
sync-etc:
sudo rsync -a --exclude='hardware-configuration.nix' nixos/ /etc/nixos/
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
.PHONY: upgrade-etc
upgrade-etc:
sudo nix flake update /etc/nixos --commit-lock-file
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
.PHONY: sync-etc-dry-run
sync-etc-dry-run:
sudo rsync -a --dry-run --verbose --exclude='hardware-configuration.nix' nixos/ /etc/nixos/
#
# uses ./nixos
#
.PHONY: rebuild
rebuild:
sudo nixos-rebuild switch --flake path:$(CURDIR)/nixos
.PHONY: upgrade
upgrade:
sudo nix flake update /etc/nixos
sudo nixos-rebuild switch --flake /etc/nixos#cesium
sudo cp /etc/nixos/flake.lock nixos/flake.lock 2>/dev/null || true
sudo nix flake update $(CURDIR)/nixos --commit-lock-file
sudo nixos-rebuild switch --flake path:$(CURDIR)/nixos
#
# for both
#
.PHONY: cleanup
cleanup:
sudo nix-store --optimise && sudo nix-collect-garbage -d
.PHONY: test
test:
echo "Find nix files"