Code Monkey home page Code Monkey logo

nixos-install-scripts's Introduction

Nix OS Installation Cheatsheet

My personal cheatsheet for Nix OS Installation.

Boot to ISO and check Networking

I usually set bigger font with setfont ter-v32n :

  • sudo -i (can use nixos-help for manual)
  • TODO!! update for networking

connecting with Ethernet or mobile USB tethering is enabled by default

Partition the disk(s)

I install Nix on my ~233G SSD.

  • i prefer gdisk
  • ef00 for fat32 fstype
nvme0n1 fstype size mount point Label
nvme0n1p1 fat32 550M /boot/efi EFI
nvme0n1p2 btrfs 232G /
/home
/var/log
/.snapshots
/var/cache/pacman/pkg
BTRFS
  • nvme0n1p2 remaining size. ~232G

    later set up zram

Format and Mount the partitions

install git, neovim

nix-env -f '<nixpkgs>' -iA neovim
nix-env -f '<nixpkgs>' -iA git
git clone https://github.com/alokshandilya/nixos-install-scripts.git

all scripts are executable but still have a glance on the commands and modify accordingly

./1-format_mount.sh
  • run ๐Ÿƒ./1-format_mount.sh
    • formats the partitions
    • makes btrfs subvolumes
    • mounts the partitions
    • generates fstab based on UUIDs (remove subvolid later from /etc/fstab)

Install NIX-OS

  • nixos-generate-config --root /mnt

  • nvim /mnt/etc/nixos/configuration.nix, manually add mount options

  • nixos-install

  • nixos-generate-config --show-hardware-config doesn't detect mount options automatically, so to enable compression, you must specify it and other mount options in a persistent configuration:

fileSystems = {
  "/".options = [ "defaults,noatime,compress=zstd,discard=async,space_cache=v2,autodefrag" ];
  "/home".options = [ "defaults,noatime,compress=zstd,discard=async,space_cache=v2,autodefrag" ];
  "/nix".options = [ "defaults,noatime,compress=zstd,discard=async,space_cache=v2,autodefrag" ];
  "/.snapshots".options = [ "defaults,noatime,compress=zstd,discard=async,space_cache=v2,autodefrag" ];
};
  • TODO!!! update it with your nix configuration file
  • update the configuration file
  • If you want to use GRUB, set boot.loader.grub.device to nodev and boot.loader.grub.efiSupport to true. With systemd-boot, you should not need any special configuration to detect other installed systems. With GRUB, set boot.loader.grub.useOSProber to true, but this will only detect windows partitions, not other Linux distributions. If you dual boot another Linux distribution, use systemd-boot instead.

TODO!!! later

./2-base-install.sh
  • edit /etc/default/grub
    • blkid > blkit.txt :vs :bp :bn in vim /etc/default/grub
      • note nvme0n1p2 (partition with subvolumes) UUID
    • GRUB_CMDLINE_LINUX=cryptdevice=UUID=xxxxx:cryptroot rootfstype=btrfs
    • grub-mkconfig -o /boot/grub/grub.cfg

run ๐Ÿƒ 3-touchpad.sh if to use Window Manager (on laptop) to enable trackpad reverse scrolling etc.

  • edit /etc/mkinitcpio.conf
    • MODULES=(btrfs crc32c-intel intel_agp i915 nvidia)
    • HOOKS=(.... encrypt filesystems fsck)
  • mkinitcpio -P
  • do exit , umount -a , reboot

Post Installation

  • connect to wifi with nmtui

Install DWM ๐Ÿค–

./4-dwm-install.sh
  • reboot
  • run ๐Ÿƒ5-packages-AUR.sh
    • AURs are commented
  • install rest of the packages
cd ~/arch-install-scripts
paru -S stow
paru -S --needed - < pkglist.txt

Dotfiles ๐ŸŒŸ

  • 4-dwm-install script also installs paru
git clone https://github.com/alokshandilya/dotfiles.git
git clone https://github.com/alokshandilya/nvim.git ~/.config/nvim
cd dotfiles
mkdir -p ~/.local/share/applications
mkdir -p ~/.local/bin/scripts
mkdir -p ~/.local/bin/dwmblocks
stow .

Reduce Swappiness

su -
touch /etc/sysctl.d/99-swappiness.conf
echo "vm.swappiness=1" >> /etc/sysctl.d/99-swappiness.conf
  • reboot

Development Environment ๐Ÿ’ป

  • fish
  • fnm
    • fnm ls-remote
    • install node, npm
npm i -g prettier typescript typescript-language-server live-server
  • git
git config --global core.editor nvim
git config --global user.name "your_name"
git config --global user.email "[email protected]"
ssh-keygen -t ed25519 -C "[email protected]"
bash
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
exit
cat ~/.ssh/id_ed25519.pub
# Then select and copy the contents of the id_ed25519.pub file
# displayed in the terminal to your clipboard

Github $\to$ SSH and GPG keys $\to$ Add new $\to$ Title (Personal Arch Linux) $\to$ Key (paste)

  • setup nvim

  • setup sdkman for fish

curl -s "https://get.sdkman.io" | bash
# path already set in my fish config
# install omf
curl https://raw.githubusercontent.com/oh-my-fish/oh-my-fish/master/bin/install | fish
omf install sdk
sdk ls java
sdk install java #version
  • nvim jdtls from :LspInstallInfo
pip install pynvim
git clone [email protected]:alokshandilya/nvim.git ~/.config/nvim
mkdir -p ~/.local/share/fonts/nvim-fonts
cp -r ~/.config/nvim/fonts ~/.local/share/fonts/nvim-fonts
paru -S --needed google-java-format
git clone [email protected]:microsoft/java-debug.git ~/.config/nvim/java-debug
cd ~/.config/nvim/java-debug
./mvnw clean install
git clone [email protected]:microsoft/vscode-java-test.git ~/.config/nvim/vscode-java-test
cd ~/.config/nvim/vscode-java-test
npm i
npm run build-plugin

nixos-install-scripts's People

Contributors

alokshandilya avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.