-
-
Save mmahut/e823642d3510b0c68f0a25eaed9ad4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -eu | |
set -o pipefail | |
set -x | |
echo "[+] Wiping disks and creating partitions..." | |
partprobe | |
wipefs -a /dev/sda | |
partprobe | |
parted /dev/sda -- mklabel msdos | |
parted /dev/sda -- mkpart primary 2G 100% | |
parted /dev/sda -- set 1 boot on | |
mkfs.ext4 -L nixos /dev/sda1 | |
partprobe | |
echo "[+] Mouting filesystems..." | |
mount /dev/disk/by-label/nixos /mnt | |
echo "[+] Installing NixOS..." | |
nixos-generate-config --root /mnt | |
cat > /mnt/etc/nixos/hardware-configuration.nix <<EOF | |
{ config, lib, pkgs, modulesPath, ... }: | |
{ | |
imports = | |
[ (modulesPath + "/installer/scan/not-detected.nix") | |
]; | |
boot.initrd.availableKernelModules = [ "xhci_pci" "mpt3sas" "ahci" "nvme" "sd_mod" ]; | |
boot.initrd.kernelModules = [ ]; | |
boot.kernelModules = [ "kvm-amd" ]; | |
boot.extraModulePackages = [ ]; | |
swapDevices = [ ]; | |
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; | |
} | |
EOF | |
cat > /mnt/etc/nixos/configuration.nix <<EOF | |
{ config, pkgs, ... }: | |
{ | |
imports = | |
[ | |
./hardware-configuration.nix | |
]; | |
boot.loader.grub.enable = true; | |
boot.loader.grub.version = 2; | |
boot.loader.grub.device = "/dev/sda"; | |
networking.useDHCP = true; | |
services.openssh.enable = true; | |
services.openssh.permitRootLogin = "prohibit-password"; | |
users.users.root.openssh.authorizedKeys.keys = [ | |
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDURpVgnmt/F7esJz6P7rR5DPhyG3GUoTKgWmYZ561Q/y6Rbg6Hmyai0aXIXB1SaViLAu+7y/g2e7HpeBE2ktFdjUZN01FZ/PT0Dh/ylYRNlVnnYLfuvILM9D10UxLrjgsrP8IEYm0xpznb03Bi9AwWVFT4D/pI/e7mXk+Ts6j+8VvbbnIawg5a7olQZ/fb+ebMk7q9IuFKTtk/713dXrKuCTKid6ekPxWJaesOpoplM8CdR6fXDI+woYd4pn6TcijYoL1OjudN98WW9CTC91VgTO0qL/boPU/YZkxVWoRTzliSaUvmo5THsBY8GxTXnvgN73Hnuje1mde/xyn7l9vhSfUNxi/L4NypQX57xkrIGuwM96C/BHtS84z1GZ9YlyZL5hot00hHke6Xt+lyMkp6MBYs6xFXgY9zfGi8URzgDlu5iGVI5mubO2ffLYAQwST0VeFgLEXzC+6gwzzA6TkzjzspLiI0U/vwT2yJrvql0182+RK3u1WuUaJNQ1YAu4s= admin@bf.io" | |
]; | |
system.stateVersion = "21.11"; # Did you read the comment? | |
fileSystems = { | |
"/" = { | |
device = "/dev/disk/by-label/nixos"; | |
fsType = "ext4"; | |
}; | |
}; | |
} | |
EOF | |
nixos-install --no-root-passwd --root /mnt --max-jobs 40 | |
umount /mnt | |
reboot |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment