-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
75 lines (60 loc) · 1.78 KB
/
Makefile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
GIT_REPO := $(shell git rev-parse --show-toplevel)
.PHONY: update history hm-history repl clean hm-clean gc fmt check laplace pi
# Nix commands
update:
nix flake update
history:
nix profile history --profile /nix/var/nix/profiles/system
hm-history:
nix profile history --profile ~/.local/state/nix/profiles/home-manager
repl:
nix repl -f flake:nixpkgs
clean:
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
hm-clean:
nix profile wipe-history --profile ~/.local/state/nix/profiles/home-manager
gc:
sudo nix-collect-garbage --delete-old
fmt:
nix fmt
check:
ifdef DEBUG
nix flake check --show-trace --verbose
else
nix flake check
endif
# Darwin systems
laplace:
ifdef DEBUG
sudo -u laplace sudo chown -R laplace:staff $(GIT_REPO) && \
(sudo -Hu laplace darwin-rebuild switch --flake $(GIT_REPO)\#laplace --show-trace --verbose || true) && \
sudo -u laplace sudo chown -R $$(whoami):staff $(GIT_REPO)
else
sudo -u laplace sudo chown -R laplace:staff $(GIT_REPO) && \
(sudo -Hu laplace darwin-rebuild switch --flake $(GIT_REPO)\#laplace || true) && \
sudo -u laplace sudo chown -R $$(whoami):staff $(GIT_REPO)
endif
pi-image:
ifdef DEBUG
nix build $(GIT_REPO)\#images.pi --show-trace --verbose
else
nix build $(GIT_REPO)\#images.pi
endif
bpi-image:
ifdef DEBUG
nix build $(GIT_REPO)\#images.bpi --show-trace --verbose
else
nix build $(GIT_REPO)\#images.bpi
endif
pi:
ifdef DEBUG
sudo nixos-rebuild switch --flake $(GIT_REPO)\#pi --show-trace --verbose
else
sudo nixos-rebuild switch --flake $(GIT_REPO)\#pi
endif
bpi:
ifdef DEBUG
sudo nixos-rebuild switch --flake $(GIT_REPO)\#bpi --show-trace --verbose
else
sudo nixos-rebuild switch --flake $(GIT_REPO)\#bpi
endif