-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjustfile
118 lines (91 loc) · 2.79 KB
/
justfile
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
default:
@just --list
# -----------------------------------------------
# home-manager specific
# -----------------------------------------------
# Define a task to install Home Manager
install:
echo "Installing Home Manager..."
nix-shell '<home-manager>' -p home-manager --run "home-manager switch"
# Define a task to update Home Manager
# update:
# echo "Updating Home Manager..."
# nix-channel --update
# nix-shell '<home-manager>' -p home-manager --run "home-manager switch"
# Define a task to apply Home Manager configuration
apply:
echo "Applying Home Manager configuration..."
nix-shell '<home-manager>' -p home-manager --run "home-manager switch"
# Define a task that runs install, update, and apply
# all: install update apply
# echo "Home Manager setup complete!"
# Define a task to clean up old generations
clean:
echo "Cleaning up old generations..."
nix-collect-garbage --delete-older-than 7d
# Rebuild the home config
home:
home-manager switch -b backup --flake .#jokyv switch --show-trace
# Rebuild the home config using nh
nhh:
nh home switch -c jokyv .
# -----------------------------------------------
# NixOS specific
# -----------------------------------------------
# Rebuild the system
switch:
sudo nixos-rebuild switch --fast --impure --flake .#nixos --show-trace
# Rebuild the system using nh
nhs:
nh os switch .
# Build a new configuration
boot:
sudo nixos-rebuild boot --fast --impure --flake .#nixos --show-trace
# Dry-build a new configuration
dry:
sudo nixos-rebuild dry-activate --fast --flake .#nixos --show-trace
# Format code
fmt:
nix fmt
# Run tests
test:
nix flake check --show-trace --print-build-logs --verbose
# Update all inputs
up:
nix flake update --refresh --commit-lock-file
# Update specific input. Usage: just upp nixpkgs
upp input:
nix flake update {{input}}
# Show what has yet to be persisted in a folder. Usage: just ephemeral $HOME | $PAGER
ephemeral dir="$HOME":
list-ephemeral {{dir}}
# Open a Nix REPL - run manually to load flake: `:lf .`
repl:
nix repl
# Clean up with the help of nh
nhclean:
nh clean all --keep 5
# Clean up with the help of nh but dry run
nhcleandry:
nh clean all --keep 5 --dry
# Remove all generations older than 7 days
cleanup:
sudo nix profile wipe-history --profile /nix/var/nix/profiles/system --older-than 7d
# Garbage collect all unused nix store entries
gc:
# sudo nix store gc --debug
sudo nix store gc
nix-collect-garbage --delete-old
sudo nix-collect-garbage --delete-old
# Encode secrets
encode:
sops -e secrets.yaml > secrets.enc.yaml
# Decode secrets
decode:
sops -d secrets.enc.yaml > secrets.yaml
# Check when inputs were last updated
age:
check-age
# -----------------------------------------------
# Old commands
# -----------------------------------------------