-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·31 lines (21 loc) · 1.02 KB
/
install.sh
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
#!/bin/sh
# format disk
curl https://raw.githubusercontent.com/ant0ncuranz/nix-config/main/disko/zroot.nix -o /tmp/disko.nix
vim /tmp/disko.nix
nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko.nix
# create snapshot for impermanence
zfs snapshot zroot/root@blank
mkdir -p /mnt/etc/nixos /mnt/persist/secrets/initrd /mnt/persist/var/lib/libvirt/images
# install git and git-crypt
nix-env -f '<nixpkgs>' -iA git
nix-env -f '<nixpkgs>' -iA git-crypt
# clone and unlock configuration
git clone https://github.com/ant0ncuranz/nix-config.git /mnt/etc/nixos
echo "Paste base64 encoded git-crypt key: "
read -r base64key
echo $base64key | base64 --decode > /tmp/git-crypt-key
(cd /mnt/etc/nixos && git-crypt unlock /tmp/git-crypt-key)
cp /tmp/disko.nix /mnt/etc/nixos/disko/zroot.nix
ssh-keygen -t ed25519 -N "" -f /mnt/persist/secrets/initrd/ssh_host_ed25519_key
ssh-keygen -t rsa -N "" -f /mnt/persist/secrets/initrd/ssh_host_rsa_key
nixos-install --flake "/mnt/etc/nixos#default"