Skip to content

My first dive into Linux territory. Yep, straight into one of the hardest ones.

Notifications You must be signed in to change notification settings

Eryoneta/nixos-config

Repository files navigation

NixOS Stable

My NixOS Configuration

Based on Linux, NixOS is quite a unique distro! It allows for a almost complete control over the entire system with the use of a single configuration file (That get a bit too big, so you inevitably end up breaking it into parts, of course) and that brings a unique possibility: Recreating an entire OS with only a configuration file (And Internet access).

My NixOS configuration is my first take on Linux. Not a conventional way to get familiar with the ecosystem, but the idea it proposes was way too tempting! An entire OS, in the palm of my configured exactly how I want it to!

Highlights

  • Flakes: A way to declare the system's inputs and outputs. It allows my system to have many different repositories as inputs and many different hosts as outputs. Also, it pins the exact commit for each input, allowing for a precise recreation of the system, which is nice.
  • Home-Manager, both as standalone and as a NixOS module: It allows for quick edits on dotfiles (home-manager switch) without recreating the system, but it also allows the newly recreated system (sudo nixos-rebuild switch) to manage my home folder.
    • Plasma-Manager: A module which allows to declare many of the options of KDE Plasma.
    • Stylix: Declares colors, themes, and wallpapers for a bunch of programs. Its perfect to theme the environment without unholy hours of work.
  • Agenix: Stores secrets as encripted files, and decripts them at runtime. Nor Git or Nix knows the content, only NixOS does, when its running.

Special Stuff

  • My flake might be clean, but a lot of the mess is hidden within configurationBuilder.nix.
  • My entire configuration is basically divided between ./public-config and ./private-config, which is a Git submodule. Privacy and all that.
    • The directory ./programs inside contains all programs which require configuration. Its giant and messy. Its Perfect.
      • They are all automatically imported based on the file names.
  • Both ./hosts and ./users contains a ./default configuration, and specific configuration for each one.
  • Anything inside ./modules is made to be portable.
    • ./modules/flake-modules contains a lot of utilities that abstracts contents of flake.nix.
      • Starting from nixos-system.nix, they can be strung together to "modify" a basic configuration into a more complete one.
      • For example, home-manager-module.nix can be used by nixos-system.nix to generate a NixOS with Home-Manager module installed.
      • There is a bunch more.
    • ./modules/nix-modules are "simple" nix functions. Useful utilities and stuff.
    • ./modules/nixos-modules can be imported by a configuration. They add new options and functionalities.
  • System upgrades uses this nixos-config(main) repository, but all my development happens at nixos-config-dev(develop), which is a Git worktree.
    • Only working builds are merged into main. This avoids a surprise upgrade that uses an half-done configuration.