-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·61 lines (46 loc) · 1.34 KB
/
Makefile
File metadata and controls
executable file
·61 lines (46 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
expiration ?= 30 days
version ?= 25.11
nixos-channel := https://nixos.org/channels/nixos-$(version)
home-manager-channel := https://github.com/nix-community/home-manager/archive/release-$(version).tar.gz
HOME-MANAGER := home-manager
NIXOS := sudo nixos-rebuild
nixos-config := /etc/nixos/configuration.nix
.PHONY: apply
apply: update
$(HOME-MANAGER) switch
.PHONY: all
all: upgrade apply gc
.PHONY: $(nixos-config)
$(nixos-config):
sudo cp --backup --interactive --link machines/$$(hostname)/configuration.nix $@
.PHONY: switch
switch: $(nixos-config)
$(NIXOS) switch
.PHONY: update
update:
sudo sudo nix-channel --remove nixos
sudo sudo nix-channel --remove home-manager
sudo nix-channel --add $(nixos-channel) nixos
sudo nix-channel --add $(home-manager-channel) home-manager
sudo nix-channel --update
.PHONY: upgrade
upgrade: update $(nixos-config)
$(NIXOS) switch --upgrade
.PHONY: install
install: update
nix-shell '<home-manager>' -A install
.PHONY: repair-store
repair-store:
sudo nix-store --verify --check-contents --repair
.PHONY: gc
gc: repair-store
$(HOME-MANAGER) expire-generations "-$(expiration)"
nix-collect-garbage --delete-older-than "$(shell echo "$(expiration)" | sed 's/ days/d/')"
nix-store --optimise
.PHONY: gens
gens:
$(HOME-MANAGER) generations
$(NIXOS) list-generations
.PHONY: news
news:
$(HOME-MANAGER) news