Skip to content

Instantly share code, notes, and snippets.

@jessestricker
Last active September 19, 2022 01:02
Show Gist options
  • Save jessestricker/d3db724a1554d19bffe4e6c6ecded54d to your computer and use it in GitHub Desktop.
Save jessestricker/d3db724a1554d19bffe4e6c6ecded54d to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
set -e
sgdisk -d 1 /dev/sda
sgdisk -N 1 /dev/sda
partprobe /dev/sda
mkfs.ext4 -F /dev/sda1
mount /dev/sda1 /mnt
nixos-generate-config --root /mnt
sed -i -E 's:^\}\s*$::g' /mnt/etc/nixos/configuration.nix
echo '
boot.loader.grub.device = "/dev/sda" ;
services.openssh.enable = true;
services.openssh.passwordAuthentication = false;
services.openssh.permitRootLogin = "no";
users.users.jesse = {
isNormalUser = true;
extraGroups = ["wheel"];
initialPassword = "p4ssw0rd";
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIiJ+Zwyy5QtCvD7QbRnaFkiOGQI1ilf0iej71sK2PD8 copper/windows"
];
};
}
' >> /mnt/etc/nixos/configuration.nix
nixos-install --no-root-passwd
poweroff
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment