From 67ea1f0f39a9fedbb40634ca9908eb4ca8caacb1 Mon Sep 17 00:00:00 2001 From: Sebastian Fischer Date: Thu, 16 Apr 2026 07:10:36 +0200 Subject: [PATCH] [TASK] Add build in current dir --- Makefile | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index ae050cc..da3d1b6 100644 --- a/Makefile +++ b/Makefile @@ -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"