Skip to content
alexthvestPublic

About

Dotfiles

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

nixos-config

Flake-based, multi-host NixOS configuration.

Layout

flake.nix                                   -- defines nixosConfigurations per machine
machines/<name>/default.nix                 -- machine-specific: hostname, imports, stateVersion
machines/<name>/system/hardware.nix         -- machine-generated (nixos-generate-config), never hand-written
machines/<name>/system/*.nix                -- config specific to this one host only (CPU microcode, etc.)
machines/<name>/users/<user>/default.nix    -- per-user account + home-manager config for that machine
modules/nixos/system/                       -- base config applied to every machine unconditionally
                                                (bootloader, audio, networking, locale, nix settings,
                                                packages, home-manager wiring)
modules/nixos/<category>/*.nix              -- shared but opt-in modules (e.g. hardware/nvidia.nix,
                                                desktop/niri.nix) that a machine pulls in by importing
                                                the file directly, only if it needs it

Adding a new machine later (laptop, homelab, vps) means adding machines/<name>/ and one line in flake.nix. A module every machine should get goes in modules/nixos/system; a module only some machines want (a GPU driver, a desktop session, a server-only service) goes in its own modules/nixos/<category>/ file and gets imported explicitly by the machines that need it; anything specific to one physical machine and not meant to be reused stays in that machine's own tree.

Bringing up desktop for the first time

  1. Boot the target machine from a NixOS installer ISO.
  2. Partition/format the disk and mount it at /mnt (UEFI + systemd-boot expects an ESP mounted at /mnt/boot).
  3. Generate the real hardware config:
    nixos-generate-config --root /mnt
    
  4. Copy /mnt/etc/nixos/hardware-configuration.nix over machines/desktop/system/hardware.nix in this repo, replacing the placeholder.
  5. Adjust modules/nixos/system/locale.nix (timezone) and machines/desktop/users/alexthvest/default.nix (username/description) if needed.
  6. Install:
    nixos-install --root /mnt --flake .#desktop
    
  7. Reboot, log in with the initialPassword set in users.nix, then immediately run passwd and remove/replace that line.

Day-to-day

sudo nixos-rebuild switch --flake .#desktop

Desktop session is niri (Wayland compositor), greeted by ReGreet via greetd.

About

Dotfiles

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages