On minimal iso:
loadkeys de-latin1
On X-Server iso:
setxkbmap de
Creating new gpt partition table
parted /dev/sda -- mklabel gpt
Setting up partition layout with cfdisk
cfdisk /dev/sda
Partition layout:
Device | Size | Type |
---|---|---|
/dev/sda1 | 512M | EFI System |
/dev/sda2 | 8G (size of your RAM) | Linux Swap |
/dev/sda3 | 457G (free space left) | Linux Filesystem |
Format the partitions
mkfs.fat -F 32 -n boot /dev/sda1
mkswap -L swap /dev/sda2
mkfs.ext4 -L nixos /dev/sda3
mount /dev/disk/by-label/nixos /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/boot /mnt/boot
swapon /dev/sda2
nixos-generate-config --root /mnt
Generates /etc/nixos/configuration.nix and /etc/nixos/hardware-configuration.nix in /mnt
nixos-install
For example: git
sudo nix-env -iA nixos.git
Showing all packages installed via nix-env
sudo nix-env -q
Uninstall a package
sudo nix-env --uninstall git
nix-channel --update
nixos-rebuild switch --upgrade
List all generations
nix-env --list-generations
nix-env --delete-generations 1
nix-env --delete-older-than 7d
nix-collect-garbage
sudo nix-collect-garbage -d
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
sudo nix-channel --update
In /etc/nixos/configuration.nix
imports = [<home-manager/nixos>];
home-manager.users.user = { pkgs, ... }: {
home.packages = [ pkgs.sl ];
home.stateVersion = "23.11";
};
nix-shell '<home-manager>' -A install
Apply changes on homemanager (standalone)
home-manager switch
Remove a channel
sudo nix-channel --remove home-manager
Add following to /etc/nixos/configuration.nix
nix = {
package = pkgs.nixFlakes;
extraOptions = "experimental-features = nix-command flakes";
};
cd ~
mkdir flake
cd flake
nix flake init
sudo nixos-rebuild switch --flake .#