-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjustfile
More file actions
82 lines (70 loc) · 3.38 KB
/
Copy pathjustfile
File metadata and controls
82 lines (70 loc) · 3.38 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
73
74
75
76
77
78
79
80
81
82
set shell := ["zsh", "-c"]
_default:
@just -l
@printf "\n"
@printf "╭──────────────────────────────────────────────╮\n"
@printf "│ machines │\n"
@printf "├──────────────────────────────────────────────┤\n"
@printf "│ darlene macOS (Mac Mini) │\n"
@printf "│ whiterose macOS (MacBook M4) │\n"
@printf "│ elliot Linux (Pop OS) │\n"
@printf "│ fsoc Linux (ThinkCenter x86_64) │\n"
@printf "│ fsoc-aarch64 Linux (ThinkCenter aarch64) │\n"
@printf "│ dom NixOS (Precision 7740) │\n"
@printf "╰──────────────────────────────────────────────╯\n"
@printf "\n usage: just r <machine>\n\n"
alias g := gens
alias f := format
alias s := statix
alias c := clean
alias r := rebuild
alias u := flake-update
# --- helpers -------------------------------------------------
# Pretty header (private helper)
_banner os flake:
@host="$$(hostname -s 2>/dev/null || hostname)"; \
printf "\n"; \
printf "╭──────────────────────────────────────────────╮\n"; \
printf "│ %-44s│\n" "$$host :: {{os}}"; \
printf "│ %-44s│\n" "flake: {{flake}}"; \
printf "╰──────────────────────────────────────────────╯\n\n"
# --- tasks ---------------------------------------------------
gens:
@echo "🏠🏠🏠 Listing home-manager generations 🏠🏠🏠"
@nix-env --list-generations
clean:
@echo "Cleaning up unused Nix store items"
@nix-collect-garbage -d
format:
@nixfmt $(find ./ -type f -name '*.nix')
statix:
@statix check .
flake-update:
@echo "Syncing latest git rev"
@nix flake update
# Rebuild a machine: just rebuild <darlene|whiterose|elliot|fsoc>
rebuild machine *args:
@case "{{machine}}" in \
darlene) \
just _banner "macOS" ".#darlene"; \
sudo -H nix run nix-darwin -- switch --flake ".#darlene" --show-trace {{args}} ;; \
whiterose) \
just _banner "macOS" ".#whiterose"; \
sudo -H nix run nix-darwin -- switch --flake ".#whiterose" --show-trace {{args}} ;; \
elliot) \
just _banner "Linux" ".#elliot"; \
nix run home-manager/master -- switch --flake ".#elliot" {{args}} ;; \
fsoc) \
just _banner "Linux" ".#fsoc"; \
nix run home-manager/master -- switch --flake ".#fsoc" {{args}} ;; \
fsoc-aarch64) \
just _banner "Linux" ".#fsoc-aarch64"; \
nix run home-manager/master -- switch --flake ".#fsoc-aarch64" {{args}} ;; \
dom) \
just _banner "NixOS" ".#dom"; \
sudo nixos-rebuild switch --flake ".#dom" --show-trace {{args}} ;; \
*) \
echo "Unknown machine: {{machine}}"; \
echo "Available: darlene, whiterose, elliot, fsoc, fsoc-aarch64, dom"; \
exit 1 ;; \
esac