2020-01-13 14:57:52 -08:00
|
|
|
# 1. Create three (3) disk images:
|
|
|
|
# - Installer: 1024mb
|
|
|
|
# - Swap: 512mb
|
|
|
|
# - NixOS: rest
|
|
|
|
#
|
|
|
|
# 2. Boot in rescue mode with:
|
|
|
|
# - /dev/sda -> Installer
|
|
|
|
# - /dev/sdb -> Swap
|
|
|
|
# - /dev/sdc -> NixOS
|
|
|
|
#
|
|
|
|
# 3. Once booted into Finnix (step 2) pipe this script to sh:
|
2020-12-31 14:34:39 -08:00
|
|
|
# iso=https://channels.nixos.org/nixos-20.09/latest-nixos-minimal-x86_64-linux.iso
|
2020-01-13 14:57:52 -08:00
|
|
|
# update-ca-certificates
|
2020-12-30 22:59:04 -08:00
|
|
|
# curl -k $iso | dd bs=1M of=/dev/sda
|
2020-01-13 14:57:52 -08:00
|
|
|
#
|
2020-11-17 12:27:50 -08:00
|
|
|
# 4. Create two configuration profiles:
|
|
|
|
# - Installer
|
|
|
|
# - Kernel: Direct Disk
|
|
|
|
# - /dev/sda -> NixOS
|
|
|
|
# - /dev/sdb -> Swap
|
|
|
|
# - /dev/sdc -> Installer
|
|
|
|
# - Helpers: distro and auto network helpers = off
|
|
|
|
# - Boot
|
|
|
|
# - Kernel: GRUB 2
|
|
|
|
# - /dev/sda -> NixOS
|
|
|
|
# - /dev/sdb -> Swap
|
|
|
|
# - Helpers: distro and auto network helpers = off
|
2020-01-13 14:57:52 -08:00
|
|
|
#
|
2020-11-17 12:27:50 -08:00
|
|
|
# 5. Boot into installer profile.
|
|
|
|
#
|
2020-12-31 14:34:39 -08:00
|
|
|
# 6. Generate hardware-configuration.nix
|
|
|
|
# e2label /dev/sda nixos
|
|
|
|
# swaplabel -L swap /dev/sdb
|
|
|
|
# mount /dev/disk/by-label/nixos /mnt
|
|
|
|
# swapon /dev/disk/by-label/swap
|
|
|
|
# nixos-generate-config --root /mnt
|
|
|
|
# vim /mnt/etc/nixos/hardware-configuration.nix # change uuids to labels
|
|
|
|
#
|
|
|
|
# 7. Install dotfiles:
|
2020-12-30 22:59:04 -08:00
|
|
|
# nix-env -iA nixos.git nixos.nixFlakes
|
|
|
|
# mkdir -p /mnt/home/hlissner/.config
|
|
|
|
# cd /mnt/home/hlissner/.config
|
|
|
|
# git clone https://github.com/hlissner/dotfiles
|
|
|
|
# nixos-install --root /mnt --flake .#linode --impure
|
2020-12-31 14:34:39 -08:00
|
|
|
# OR (on older versions of nixos)
|
|
|
|
# nixos-install --root /mnt --flake .#linode --option pure-eval false
|
2020-01-13 14:57:52 -08:00
|
|
|
#
|
2020-12-31 14:34:39 -08:00
|
|
|
# 8. Reboot into "Boot" profile.
|
2020-01-13 14:57:52 -08:00
|
|
|
|
2020-12-31 14:34:39 -08:00
|
|
|
{ modulesPath, config, lib, pkgs, ... }:
|
2020-10-01 15:46:04 -07:00
|
|
|
|
2020-10-26 02:48:12 -07:00
|
|
|
with lib;
|
2020-01-13 14:57:52 -08:00
|
|
|
{
|
2020-12-31 14:34:39 -08:00
|
|
|
imports = [
|
|
|
|
"${modulesPath}/profiles/qemu-guest.nix"
|
2021-02-20 19:50:43 -08:00
|
|
|
./server.nix
|
2020-12-30 22:59:04 -08:00
|
|
|
];
|
|
|
|
|
2020-01-13 14:57:52 -08:00
|
|
|
environment.systemPackages =
|
|
|
|
with pkgs; [ inetutils mtr sysstat git ];
|
|
|
|
|
2020-10-01 15:46:04 -07:00
|
|
|
modules = {
|
2020-10-29 22:39:45 -07:00
|
|
|
editors = {
|
|
|
|
default = "nvim";
|
|
|
|
vim.enable = true;
|
|
|
|
};
|
2020-10-01 15:46:04 -07:00
|
|
|
shell = {
|
2020-10-29 22:39:45 -07:00
|
|
|
git.enable = true;
|
2020-10-01 15:46:04 -07:00
|
|
|
zsh.enable = true;
|
|
|
|
};
|
|
|
|
services.ssh.enable = true;
|
|
|
|
};
|
2020-01-13 14:57:52 -08:00
|
|
|
|
|
|
|
# GRUB
|
|
|
|
boot = {
|
2020-12-31 14:34:39 -08:00
|
|
|
kernelModules = [];
|
|
|
|
# Needed for LISH (part 1)
|
2020-01-13 14:57:52 -08:00
|
|
|
kernelParams = [ "console=ttyS0" ];
|
2020-12-31 14:34:39 -08:00
|
|
|
extraModulePackages = [];
|
|
|
|
initrd = {
|
|
|
|
availableKernelModules = [ "virtio_pci" "ahci" "sd_mod" ];
|
|
|
|
kernelModules = [];
|
|
|
|
};
|
2020-01-13 14:57:52 -08:00
|
|
|
loader = {
|
|
|
|
timeout = 10;
|
|
|
|
grub = {
|
|
|
|
enable = true;
|
|
|
|
version = 2;
|
2020-12-31 14:34:39 -08:00
|
|
|
device = "/dev/sda";
|
2020-01-13 14:57:52 -08:00
|
|
|
copyKernels = true;
|
2020-12-31 14:34:39 -08:00
|
|
|
fsIdentifier = "provided";
|
|
|
|
# Needed for LISH (part 2)
|
2020-01-13 14:57:52 -08:00
|
|
|
extraConfig = "serial; terminal_input serial; terminal_output serial";
|
2020-12-31 14:34:39 -08:00
|
|
|
# GRUB will complain about blocklists when trying to install grub on a
|
|
|
|
# partition-less disk. This tells it to ignore the warning and carry on.
|
|
|
|
forceInstall = true;
|
2020-01-13 14:57:52 -08:00
|
|
|
};
|
|
|
|
# Disable globals
|
|
|
|
systemd-boot.enable = false;
|
|
|
|
efi.canTouchEfiVariables = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2020-10-01 15:46:04 -07:00
|
|
|
networking = {
|
|
|
|
useDHCP = false;
|
|
|
|
usePredictableInterfaceNames = false;
|
2020-12-30 22:59:04 -08:00
|
|
|
interfaces.eth0 = {
|
|
|
|
useDHCP = true;
|
|
|
|
};
|
2020-10-01 15:46:04 -07:00
|
|
|
};
|
2020-12-31 14:34:39 -08:00
|
|
|
|
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/sda";
|
|
|
|
fsType = "ext4";
|
|
|
|
};
|
|
|
|
swapDevices = [ { device = "/dev/sdb"; } ];
|
2020-01-13 14:57:52 -08:00
|
|
|
}
|