features: i3, neovim
# to enable internet using networkmanager (because KDE gui is buggy)
nmtui
# OR to enable internet using wpa_supplicant
ip address show # to show <IFNAME>, e.g. wlp3s0
iwlist scanning # to show SSID of network you want to connect to
wpa_passphrase <MYSSID> <MYPASS> > /tmp/wifi.conf
wpa_supplicant -Dwext -i<IFNAME> -C/tmp/wifi.conf
# INSTALL SOFTWARE
mkdir -p ~/.config/nixpkgs
echo '{ allowUnfree = true; }' > ~/.config/nixpkgs/config.nix
nix-env -i git git-crypt vscode ranger google-chrome pcmanfm
code --user-data-dir=/tmp/code --install-extension bbenoist.Nix
export EDITOR=vim
# MAKE PARTITIONS
lsblk
gdisk /dev/sda # ssd for 1TB
# make 3 partitions (gpt table, n for new partition, w for write, q for exit): efi (code - ef00, last sector - +100M), swap (code - 8200, last sector - +8G), nixos (code - default, last sector - default)
gdisk /dev/sdb # ssd for 126GB
mkfs.vfat -n NIXOS_BOOT /dev/sda1
mkswap -L NIXOS_SWAP /dev/sda2
mkfs.ext4 -L NIXOS_ROOT /dev/sda3
mkfs.ext4 -L NIXOS_ADJUNCT /dev/sdb1
# MOUNT
swapon /dev/disk/by-label/NIXOS_SWAP
mount /dev/disk/by-label/NIXOS_ROOT /mnt
mkdir -p /mnt/boot
mount /dev/disk/by-label/NIXOS_BOOT /mnt/boot
mkdir -p /mnt/home/srghma/Documents
mount /dev/disk/by-label/NIXOS_ADJUNCT /mnt/home/srghma/Documents
# GENERATE CONFIGURATION
nixos-generate-config --root /mnt
# CLONE DOTFILES
mkdir -p /mnt/home/srghma/.config
git clone --recursive https://github.com/srghma/dotfiles /mnt/home/srghma/.dotfiles
# BACKUP AUTOGENERATED CONFIGURATIONS
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
# COPY hardware-configuration.nix to dotfiles to be able to modify it without sudo
cp /mnt/etc/nixos/hardware-configuration.nix.old /mnt/home/srghma/.dotfiles/nixos/root/hardware-configuration.nix
# LINK CONFIGS TO CONFIGS IN DOTFILES
# this configuration is used only during installation
printf "import /mnt/home/srghma/.dotfiles/nixos/root/default.nix" > /mnt/etc/nixos/configuration.nix
# MODIFY HARDWARE CONFIGURATION IF YOU WANT
code --user-data-dir=/tmp/code /mnt/home/srghma/.dotfiles /mnt/etc/nixos
# INSTALL
nixos-install
# or validate (only if nixos-install throws errors)
nixos-rebuild dry-build -I nixos-config=/mnt/etc/nixos/configuration.nix
# or just rebuild configuration
nixos-install --no-bootloader --no-root-passwd --no-channel-copy
# or enter using chroot
nixos-enter
# this configuration system will use after reboot
printf "import /home/srghma/.dotfiles/nixos/root/default.nix" > /mnt/etc/nixos/configuration.nix
mkdir -p /mnt/home/srghma/.config/nixpkgs/
printf "import /home/srghma/.dotfiles/nixos/home/config.nix" > /mnt/home/srghma/.config/nixpkgs/config.nix
# reboot
# execute each file in INSTALL directory
./INSTALL/link_files.rb
./INSTALL/neovim_apply_lanugageclient.sh
./INSTALL/install_ruby_packages.sh
./INSTALL/install_haskell_packages.sh
./INSTALL/copy_npmrc.rb
# ./INSTALL/backup-to-encfs.rb
./INSTALL/install_node_packages.sh
./INSTALL/install_vscode_extensions.rb
nix-env -i keepassxc gnupg
sudo nix-channel --list
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable
sudo nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs
sudo nix-channel --add https://github.com/NixOS/nixpkgs/archive/master.tar.gz nixpkgs-master
sudo nix-channel --update
git-crypt unlock ~/.git-crypt/dotfiles.key
net-mgr-restore
ssh-restore
gpg-restore
sudo nixos-rebuild boot