export MYUSERNAME=yourusername
mkdir -p ~/.config/nixpkgs echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix nix-env -i git vscode code --user-data-dir=/tmp/code --install-extension bbenoist.Nix
gdisk /dev/sdb
make 3 partitions: efi (code - ef00, last sector - +100M), swap (code - 8200, last sector - +8G), nixos (code - default, last sector - default)
mkfs.vfat /dev/sdb1 mkswap -L swap /dev/sdb2 mkfs.ext4 -L nixos /dev/sdb3
swapon /dev/sdb2 mount /dev/disk/by-label/nixos /mnt mkdir /mnt/boot mount /dev/sdb1 /mnt/boot
nixos-generate-config --root /mnt
mkdir -p /mnt/home/$MYUSERNAME/.config git clone --recursive https://github.com/srghma/dotfiles /mnt/home/$MYMYUSERNAME/.config/dotfiles
mv /mnt/etc/nixos/configuration.nix /mnt/etc/nixos/configuration.nix.old mv /mnt/etc/nixos/hardware-configuration.nix /mnt/etc/nixos/hardware-configuration.nix.old
cp /mnt/etc/nixos/hardware-configuration.nix.old /mnt/home/$MYUSERNAME/.config/dotfiles/nixos/root/hardware-configuration.nix
this configuration is used only during installation, because dotfiles have import /etc/nixos/metaconfiguration.nix
hardcoded
printf "rec {\n userName="$MYUSERNAME";\n dotfilesDir=/mnt/home/$MYUSERNAME/.config/dotfiles;\n}" > /etc/nixos/metaconfiguration.nix
printf "rec {\n userName="$MYUSERNAME";\n dotfilesDir=/home/$MYUSERNAME/.config/dotfiles;\n}" > /mnt/etc/nixos/metaconfiguration.nix
printf "with (import /etc/nixos/metaconfiguration.nix);\nimport "${dotfilesDir}/nixos/root/default.nix"" > /mnt/etc/nixos/configuration.nix
mkdir -p /mnt/home/$MYUSERNAME/.config/nixpkgs printf "with (import /etc/nixos/metaconfiguration.nix);\nimport "${dotfilesDir}/nixos/home/config.nix"" > /mnt/home/$MYUSERNAME/.config/nixpkgs/config.nix
code --user-data-dir=/tmp/code /mnt/home/$MYUSERNAME/.config/dotfiles /mnt/etc/nixos/
nixos-install