My NixOS configuration
1.PHONY: help switch boot test update clean fmt check
2
3help:
4 @echo "NixOS Configuration Management"
5 @echo ""
6 @echo "Available targets:"
7 @echo " switch - Build and activate configuration (default)"
8 @echo " boot - Build configuration for next boot"
9 @echo " test - Build and test configuration without setting default"
10 @echo " update - Update flake inputs"
11 @echo " clean - Remove old generations and run garbage collection"
12 @echo " fmt - Format Nix files"
13 @echo " check - Check flake for errors"
14
15switch:
16 sudo nixos-rebuild switch --flake .#laptop
17
18boot:
19 sudo nixos-rebuild boot --flake .#laptop
20
21test:
22 sudo nixos-rebuild test --flake .#laptop
23
24update:
25 nix flake update
26 @echo "Don't forget to run 'make switch' to apply updates"
27
28clean:
29 sudo nix-collect-garbage -d
30 nix-collect-garbage -d
31 @echo "Cleaned up old generations"
32
33fmt:
34 nix fmt
35
36check:
37 nix flake check