-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
85 lines (68 loc) · 2.22 KB
/
justfile
File metadata and controls
85 lines (68 loc) · 2.22 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
83
84
85
default: update global emacs
global:
#!/usr/bin/env bash
set -euxo pipefail
nix-env --no-build-output -if nix/global.nix -A $(hostname)
# symlink MacOS Applications
if [[ -d ~/.nix-profile/Applications ]]; then
for path in ~/.nix-profile/Applications/*; do
app=$(basename "$path")
if [[ ! -e /Applications/"$app" ]]
then ln -s "$path" /Applications/"$app"
fi
done
fi
show-trace:
nix-env --no-build-output -if nix/global.nix -A $(hostname) --show-trace
update:
@nix/update.sh
# TODO only checkout newer commit of nixpkgs git repo & commit here if global rule built successfully
nixpkgs-git:
#!/usr/bin/env bash
set -euxo pipefail
REV=$(jq -r .rev < nixpkgs-snapshot.json)
[ ! -d ~/code ] && mkdir ~/code
[ ! -d ~/code/nixpkgs ] && git clone git@github.com:NixOS/nixpkgs.git
cd ~/code/nixpkgs
git fetch -a --quiet
git checkout $REV
bootstrap:
nix-build nix/bootstrap.nix
rm result*
prandtl: os-update global emacs nixpkgs-git
os:
sudo nixos-rebuild switch
os-update:
sudo nixos-rebuild switch --upgrade
OLD := "7d"
dots := quote('
NL == 1 { lines=0; };
{ print $0 >> "prune.log"; dots+=1 };
dots < 100 { printf "." };
dots >= 100 { printf ".\n%s ", lines; dots=0; lines += 100 }
')
prune:
date > prune.log
sudo nix-collect-garbage --delete-older-than {{OLD}} 2>&1 | awk {{dots}}
tail -n1 prune.log
roots:
for r in $(nix-store --gc --print-roots | awk '$1 ~ /^{{escaped_home}}/ {print $1;}'); do \
du -shc $(nix-store -qR $r 2>/dev/null) | awk -v r="$r" '$2 ~ /total/ {print $1, r;}' ; done \
| sort -h
iso:
nix-build '<nixpkgs/nixos>' -A config.system.build.isoImage -I nixos-config=iso.nix
stow:
mkdir -p ~/.local ~/.config ~/.stack ~/code/active
for d in $(ls stow); do stow -t ~ -d stow $d; done
ln -s $(pwd)/emacs ~/.emacs.d
[ -d private/stow ] && for d in $(ls private/stow); do stow -t ~ -d private/stow $d; done
unstow:
for package in $(ls stow); do stow --target ~ --dir stow --delete $package; done
rm ~/.emacs.d
emacs:
nix-env -if emacs/emacs.nix --no-build-output
mr:
- mr -d {{home}} update
- cd {{home}}/braze && mr update
home := env_var('HOME')
escaped_home := replace(home, '/', '\/')