-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile.dev
More file actions
39 lines (33 loc) · 1.91 KB
/
Copy pathMakefile.dev
File metadata and controls
39 lines (33 loc) · 1.91 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
nix/develop/local:
nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
nix/develop/remote:
nix develop --extra-experimental-features nix-command --extra-experimental-features flakes --refresh github:ottowhite/nix-dev#default --command echo "Configuration synchronized"
update:
nix flake update
# Which homeConfiguration to build. Override on the CLI for other machines, e.g.
# make -f Makefile.dev cold-build CONFIG='otto@nixos'
CONFIG ?= ow20@server
NIXFLAGS := --extra-experimental-features 'nix-command flakes'
# Measure a true cold bootstrap: build the config into a fresh, empty chroot
# store so nothing already on this machine counts as cached. --refresh also
# forces a cold flake eval. Everything is re-fetched from cache.nixos.org (or
# built locally), timed, then the throwaway store is removed on exit. Your real
# /nix/store and active generation are left untouched.
.PHONY: cold-build
cold-build:
@STORE=$$(mktemp -d); \
echo ">>> Cold build of .#$(CONFIG) into throwaway store $$STORE"; \
trap 'chmod -R u+w "$$STORE" 2>/dev/null; rm -rf "$$STORE"' EXIT INT TERM; \
start=$$(date +%s); \
nix build $(NIXFLAGS) --refresh --store "$$STORE" \
".#homeConfigurations.\"$(CONFIG)\".activationPackage"; \
end=$$(date +%s); \
echo ">>> Cold build wall-clock: $$((end - start))s"
# Timed breakdown of the cold build: attributes wall-clock to eval / download /
# local-build phases and lists the slowest downloads and derivations, using
# nix's internal-json log. Same throwaway-store approach as cold-build, so it
# leaves your real store untouched.
.PHONY: cold-build-breakdown
cold-build-breakdown:
@python3 $(dir $(lastword $(MAKEFILE_LIST)))cold-build-profile.py '$(CONFIG)'
# test -n "$NIX_GCROOT" || nix develop --extra-experimental-features nix-command --extra-experimental-features flakes --refresh github:ottowhite/nix-dev#default --command echo "Configuration synchronized"