• Stars
    star
    430
  • Rank 97,642 (Top 2 %)
  • Language
    Nix
  • License
    MIT License
  • Created over 1 year ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ι›ͺ - Yuki | Snowflake ❄️



Rxyhn's Dotfiles

NixOS logo


NixOS / Home-Manager / Flake



❄️ Information

NixOS is a unique Linux distribution that employs an advanced package management system called Nix. With Nix, users can install and update software packages in isolated environments, enabling them to securely install multiple versions of software simultaneously.

In NixOS, dotfiles are akin to dotfiles found in other Unix-based operating systems, but they differ in that they use Nix expressions to organize system and application configurations. Nix expressions are configuration files that are written in Nix syntax, which can be used to define, install, and configure software packages, services, and other system components in NixOS.

By utilizing Nix expressions to organize dotfiles, NixOS provides an efficient and reliable way to manage configurations, allowing for easy reproducibility, version control, and consistent setups across multiple machines. Additionally, this approach provides a modular system that enables users to share, reuse, and modify their configurations easily.

For new users, it's important to note that the learning curve for NixOS can be steep, as it requires a different approach to package management and system configuration compared to other Linux distributions. However, with the benefits it offers, many users find it worth the effort to learn.

Typically, NixOS dotfiles consist of a collection of Nix expressions and scripts used to configure the system and applications.

There are several advantages to using NixOS as an operating system:

  1. Reproducibility: Every package and dependency in NixOS is installed in an isolated environment, ensuring the right version is installed for the user's needs. Additionally, installations can be easily reproduced on other machines.

  2. Consistent configuration: NixOS stores the operating system configuration in a centralized Nix configuration file, ensuring consistent setup on other machines.

  3. Rollback: NixOS keeps a copy of every configuration change, making it easy to rollback to the previous configuration if a problem occurs.

  4. Modularity: The Nix package manager and flake feature allow users to organize and prepare configurations as reusable packages or modules, making it easy to install new applications or change system configurations.

  5. Easy application management: Applications and dependencies are installed in isolated environments, making it easy to install and remove applications without disrupting other system components.

  6. Active community: The NixOS community is friendly and active, providing support and solutions for troubleshooting.

In summary, NixOS is a highly modular and consistent operating system that offers users complete control over their system configuration. It's an excellent choice for users who want to ensure reproducibility, consistency, and easy management of their software installations, but it does require a learning curve. However, many users find it worth the effort due to its benefits.



πŸ”§ Installation

I highly recommend creating your own configurations based on these dotfiles. Use this repository as a reference to customize your setup according to your preferences and requirements. Please note that these dotfiles were created for my specific hardware configuration, so use them at your own risk.

But anyway… let's move on to the installation process!

  1. Download iso

    # Yoink nixos-unstable
    wget -O nixos.iso https://channels.nixos.org/nixos-unstable/latest-nixos-minimal-x86_64-linux.iso
    
    # Write it to a flash drive
    cp nixos.iso /dev/sdX
  2. Boot into the installer.

  3. Switch to root user: sudo -i

  4. Partitioning

    We create a 512MB EFI boot partition (/dev/nvme0n1p1) and the rest will be our LUKS encrypted physical volume for LVM (/dev/nvme0n1p2).

    $ gdisk /dev/nvme0n1
    • o (create new empty partition table)
    • n (add partition, 512M, type ef00 EFI)
    • n (add partition, remaining space, type 8e00 Linux LVM)
    • w (write partition table and exit)

    Setup the encrypted LUKS partition and open it:

    $ cryptsetup luksFormat /dev/nvme0n1p2
    $ cryptsetup config /dev/nvme0n1p2 --label cryptroot
    $ cryptsetup luksOpen /dev/nvme0n1p2 enc

    We create two logical volumes, a 24GB swap parition and the rest will be our root filesystem

    $ pvcreate /dev/mapper/enc
    $ vgcreate vg /dev/mapper/enc
    $ lvcreate -L 24G -n swap vg
    $ lvcreate -l '100%FREE' -n root vg

    Format partitions

    $ mkfs.fat -F 32 -n boot /dev/nvme0n1p1
    $ mkswap -L swap /dev/vg/swap
    $ swapon /dev/vg/swap
    $ mkfs.btrfs -L root /dev/vg/root

    Mount partitions

    $ mount -t btrfs /dev/vg/root /mnt
    
    # Create the subvolumes
    $ btrfs subvolume create /mnt/root
    $ btrfs subvolume create /mnt/home
    $ btrfs subvolume create /mnt/nix
    $ btrfs subvolume create /mnt/log
    $ umount /mnt
    
    # Mount the directories
    $ mount -o subvol=root,compress=zstd,noatime,ssd,space_cache=v2 /dev/vg/root /mnt
    $ mkdir -p /mnt/{home,nix,var/log}
    $ mount -o subvol=home,compress=zstd,noatime,ssd,space_cache=v2 /dev/vg/root /mnt/home
    $ mount -o subvol=nix,compress=zstd,noatime,ssd,space_cache=v2 /dev/vg/root /mnt/nix
    $ mount -o subvol=log,compress=zstd,noatime,ssd,space_cache=v2 /dev/vg/root /mnt/var/log
    
    # Mount boot partition
    $ mkdir /mnt/boot
    $ mount /dev/nvme0n1p1 /mnt/boot
  5. Enable flakes

    $ nix-shell -p nixFlakes
  6. Install nixos from flake

    $ nixos-install --flake 'github:rxyhn/yuki#lenovo'
  7. Reboot, login as root, and change the password for your user using passwd

  8. Log in as your normal user.

  9. Install the home manager configuration

    $ home-manager switch --flake 'github:rxyhn/yuki#rxyhn@lenovo'


πŸ’‘ Acknowledgements

⚠️ WARNING ⚠️
It worked perfectly on my machine, but I can't guarantee it will work on your machine
Powered by NixOS/Linux x86_64

Other dotfiles