blob: 72b078d0b42941dcf36f7c19b3ffdc914e32fe12 (
plain)
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
|
#!/bin/sh
if [ $# != 1 ]; then
echo "Usage: $0 <host>" >&2
echo "Availabel hosts:" >&2
grep '= mkHomeConfiguration' flake.nix | cut -d '=' -f 1 | sed -e 's/^ */ * /' >&2
exit 1
fi
(
source .zshenv
for dir in \
"$XDG_CONFIG_HOME" \
"$XDG_CACHE_HOME" \
"$XDG_DATA_HOME" \
"$XDG_STATE_HOME" \
; \
do
if [ ! -d "$dir" ]; then
mkdir -p "$dir"
fi
done
)
if [ ! -d .bootstrap ]; then
mkdir .bootstrap
fi
if [ ! -f .bootstrap/nix-install ]; then
curl -o .bootstrap/nix-install -L https://nixos.org/nix/install
fi
if [ ! -d /nix ]; then
sh .bootstrap/nix-install --daemon
fi
if grep -q "nix-command flakes" /etc/nix/nix.conf; then
:
else
echo "experimental-features = nix-command flakes" | sudo tee -a /etc/nix/nix.conf > /dev/null
fi
if [ ! -d "$HOME/.local/state/nix/profiles" ]; then
mkdir -p "$HOME/.local/state/nix/profiles"
fi
if type home-manager > /dev/null 2>&1; then
:
else
nix run "nixpkgs#home-manager" -- switch --flake ".#$1"
fi
|