blob: bd32a1361df0c8ac218d419eb855e38cade85454 (
plain) (
blame)
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
|
#! /usr/bin/env dash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
. %SHELL_LIBRARY_PATH
msg "Select a host-config:"
hosts=$(mktmp);
host="";
awk -F "." '/pkgs.lib.nixosSystem/{print $1}' "$(tmp 'curl https://codeberg.org/ene/nixos-config/raw/branch/prime/flake/nixosConfigurations/default.nix 2> /dev/null')" | awk '{print $1}' > $hosts;
while ! grep "$host" "$hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; do
i=1;
while read -r ho ; do
printf "%4s) %s \n" "$i" "$ho";
i=$((i+1));
done < "$hosts"
printf "%4s) Exit\n" "q"
readp "Enter a option: " host
[ "$host" = "q" ] && exit 1
host=$(awk -v i="$host" '{if (NR==i) {print $0}}' "$hosts");
if ! grep "$host" "$hosts" > /dev/null || [ "$(printf "%s" "$host" | wc -c)" -eq 0 ]; then
warning "No host selected. Select a host to continue.\n"
fi
done
nixos-install --flake git+https://codeberg.org/ene/nixos-config#${host} --no-root-passwd
# clone the git config
git clone https://codeberg.org/ene/nixos-config.git /mnt/srv/etc/nixos
# setup persistent home dir
mkdir --parents /mnt/srv/home
chown 1000:100 --recursive /mnt/srv/home
chmod 700 /mnt/srv/home
readp "Do you want to continue with the user configuration setup?[N/y]: " result;
case "$result" in
[yY])
nix run "git+https://codeberg.org/ene/nixos-config#config_setup" --experimental-features 'nix-command flakes';
;;
*)
msg "Well, if you want to do everything yourself..."
exit 1
;;
esac
|