Skip to content

admiral-shlork/nixos-ono-sendai

Repository files navigation

New system installation

Prerequisites

See fileSystems config for the host and create necessary partitions. For existing partitions, make sure to update fileSystems to reflect how storage is set up.

Installation

  1. Boot NixOS from a Live USB

  2. Enter shell with git and vscodium:

nix --extra-experimental-features "nix-command flakes" shell nixpkgs#git nixpkgs#vscodium
  1. Mount all required partitions under /mnt.
  • On new hardware, consider running nixos-generate-config and examine the configuration.nix and hardware-configuration.nix to see if any declarations are required to be added to the configuration.
  1. Clone the repo with the configuration:
git clone git@github.com:admiral-shlork/nixos-ono-sendai.git
git clone https://github.com/admiral-shlork/nixos-ono-sendai.git
  1. To install the OS run the following command from the root folder of the cloned repository:
sudo nixos-install --root /mnt  --flake .#ono-sendai
  1. Set a password for the user:
nixos-enter --root /mnt -c 'passwd whatever'

Some useful Nix commands:

  • Apply configuration from a Flake and rebuild the OS
sudo nixos-rebuild switch --flake .#ono-sendai
  • Remove older generations from the bootloader
nix-collect-garbage --delete-older-than 1d
sudo nixos-rebuild boot --flake .#ono-sendai
nh clean all --keep 2
sudo nixos-rebuild boot --flake .#ono-sendai
  • Update the flake.lock file and rebuild the system
nix flake update
sudo nixos-rebuild switch --flake .#ono-sendai

Appendix

Partitioning cheat sheet

  • create and open a LUKS container
cryptsetup luksFormat /dev/sda1
cryptsetup luksOpen /dev/sda1 some_luks_container
  • create an LVM Physical Volume and add a Volume Group to it
pvcreate /dev/mapper/some_luks_container
vgcreate some_volume_group /dev/mapper/some_luks_container
  • create LVM Logical Volume
lvcreate -n some_logical_volume -L 42G some_volume_group
lvcreate -n some_logical_volume -l 100%FREE some_volume_group
  • create a filesystem
mkfs.ext4 /dev/mapper/some_logical_volume
mkfs.vfat /dev/mapper/some_partition

Assorted useful commands

  • create a key file and attach it to a LUKS container
dd if=/dev/urandom of=/root/some_luks_container.key bs=1024 count=4
chmod 0400 /root/some_luks_container.key
cryptsetup luksAddKey /dev/sda1 /root/some_luks_container.key

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages