- Download NixOS to
$ISO_PATH - insert drive
lsblk-> find out drive name (e.g./dev/sdb)$DRIVE- run (as sudo)
dd bs=4M if=$ISO_PATH of=$DRIVE conv=fdatasync status=progress && sync
Roughly this https://qfpl.io/posts/installing-nixos/
- lsblk -> find out disk name (e.g.
/dev/sda)$DISK gdisk $DISKp(print)d(delete)n(new)- number=1, begin=default, end=
+1G, hex code=ef00(not needed if dual boot) ($BOOTfrom now on, or/dev/sda1etc) - number=2, begin=default, end=default, hex code=
8e00($MAINfrom now on)
- number=1, begin=default, end=
w(write)
- encryption
cryptsetup luksFormat $MAINcryptsetup luksOpen $MAIN nixos-encpvcreate /dev/mapper/nixos-encvgcreate nixos-vg /dev/mapper/nixos-enclvcreate -L <swap size, e.g. 8G> -n swap nixos-vglvcreate -l 100%FREE -n root nixos-vg
- create fs
mkfs.vfat -n boot $BOOT(not needed if dual boot)mkfs.ext4 -L nixos /dev/nixos-vg/rootmkswap -L swap /dev/nixos-vg/swapswapon /dev/nixos-vg/swap
- mount
mount /dev/nixos-vg/root /mntmkdir /mnt/bootmount $BOOT /mnt/boot
- generate config
nixos-generate-config --root /mnt
- add stuff to config
- if dual boot check out https://nixos.wiki/wiki/Dual_Booting_NixOS_and_Windows
dual boot:
boot.loader.grub.enable = true;
boot.loader.grub.version = 2;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;required:
boot.initrd.luks.devices = {
root = {
device = "$MAIN";
preLVM = true;
};
};
# If not dual-booting with GRUB
boot.loader.systemd-boot.enable = true;
networking.networkmanager.enable = true;
users.users.farlion = {
extraGroups = ["wheel" "video" "audio" "disk" "networkmanager"];
};- nixos go brrrr
nixos-installreboot
to have a DM after first boot:
services.xserver = {
enable = true;
displayManager = {
gdm = {
enable = true;
wayland = false;
};
};
desktopManager.plasma5.enable = true; # or xfce or whatever
# or
# windowManager.xmonad.enable = true;
# to be able to mount an external drive to get secrets etc. for cloning from gh
boot.supportedFilesystems = [ "ntfs" ];
};- connect to internet from nmcli
- find out interface:
nmcli d($IF) - enable interface:
nmcli r wifi on - search networks:
nmcli d wifi list - connect:
nmcli d wifi connect $(B)SSID password $PASSWORD
- find out interface:
($CONFIG is the location of this repo)
- change your name to
farlionbecause it's hardcoded in the configurations passwd farlionand thensugit clone https://github.com/workflow/nixos-config.git $CONFIG- Add
$CONFIG/configuration.nixto the imports in/etc/nixos/configuration.nix(sample configuration is inassets) - Add
$CONFIG/nixos-config/hardware-configuration.nixto the same list - From
$CONFIG/assets/root-configuration-*.nixas a template, set required settings like thenetworking.hostnameand the correct networking interfaces to enable DHCP sudo nix-channel --add https://github.com/NixOS/nixos-hardware/archive/master.tar.gz nixos-hardwaresudo nix-channel --updatesudo mkdir -m 0755 -p /nix/var/nix/{profiles,gcroots}/per-user/farlion(forhome-manager)sudo nixos-rebuild switch- Reboot
- On an existing syncthing device, mutually add the new device
- Push addition of new syncthing device on old device
- On new device, Accept new folders as "Receive only" (check the path is correct!) on new device and let it sync
- Push any local
$CONFIGconfig changes to github - Remove local
$CONFIGand symlink it to~/code/nixos-config - Copy and symlink
/etc/nixos/configurationto a new asset file underassets/ - Change
rootpasswd - Login to mega (
mega-cmdfor interactive mode) - Manually set up Duplicati backups (config under ~/.backup)
- Rerun
n
A lot of this was looted from https://github.com/alexpeits/nixos-config. Thank you!
