-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
72 lines (48 loc) · 1.88 KB
/
Makefile
File metadata and controls
72 lines (48 loc) · 1.88 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
62
63
64
65
66
67
68
69
70
71
72
IMPURE ?= false
UNAME := $(shell uname)
UNAME_P := $(shell uname -p)
HOSTNAME := $(shell hostname)
ifeq ($(UNAME_P),arm)
BOOTSTRAP := bootstrap-arm
else
BOOTSTRAP := bootstrap-x86
endif
# Channels
NIX_CHANNELS := nixpkgs-master nixpkgs-stable nixpkgs-unstable nixos-stable flake-utils
HOME_CHANNELS := home-manager
OSX_CHANNELS := nix-darwin
EMACS_CHANNELS := emacs-overlay nix-doom-emacs
MISC_CHANNELS := flake-utils flake-compat
NIX_FILES := $(shell find . -type f -name '*.nix')
impure := $(if $(filter $(IMPURE),true),--impure,)
ifeq ($(UNAME), Darwin) # darwin rules
all: switch
switch: result/sw/bin/darwin-rebuild
TERM=xterm ./result/sw/bin/darwin-rebuild switch ${impure} --verbose --flake ".#$(HOSTNAME)" --fallback --option sandbox false
switch.bootstrap: result/sw/bin/darwin-rebuild
./result/sw/bin/darwin-rebuild switch ${impure} --verbose --flake ".#$(BOOTSTRAP)"
TERM=xterm ./result/sw/bin/darwin-rebuild switch ${impure} --verbose --flake .#mbp-albttx
result/sw/bin/darwin-rebuild:
nix --experimental-features 'flakes nix-command' build ".#darwinConfigurations.$(BOOTSTRAP).system" --option sandbox false
endif # end osx
ifeq ($(UNAME), Linux) # linux rules
all:
@echo "switch.cloud"
switch.cloud:
nix build .#homeConfigurations.cloud.activationPackage
./result/activate switch ${impure} --verbose; ./result/activate
endif # end linux
fmt:
nix-shell -p nixfmt --command "nixfmt $(NIX_FILES)"
clean:
./result/sw/bin/nix-collect-garbage
fclean:
@echo "/!\ require to be root"
sudo ./result/sw/bin/nix-env -p /nix/var/nix/profiles/system --delete-generations old
./result/sw/bin/nix-collect-garbage -d
# Remove entries from /boot/loader/entries:
update: update.nix update.osx update.home
update.nix:; nix flake update $(NIX_CHANNELS)
update.osx:; nix flake update $(OSX_CHANNELS)
update.home:; nix flake update $(HOME_CHANNELS)
update.emacs:; nix flake update $(EMACS_CHANNELS)