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.
-
Boot NixOS from a Live USB
-
Enter shell with git and vscodium:
nix --extra-experimental-features "nix-command flakes" shell nixpkgs#git nixpkgs#vscodium
- Mount all required partitions under
/mnt
.
- On new hardware, consider running
nixos-generate-config
and examine theconfiguration.nix
andhardware-configuration.nix
to see if any declarations are required to be added to the configuration.
- 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
- To install the OS run the following command from the root folder of the cloned repository:
sudo nixos-install --root /mnt --flake .#ono-sendai
- Set a password for the user:
nixos-enter --root /mnt -c 'passwd whatever'
- 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
- 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
- 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