Skip to content

Repository files navigation

Sewer's Personal NixOS Configuration

Note

I'm new to Nix, so this is my personal learning repository and might not follow best practices everywhere.

My personal NixOS configuration using flakes with modular architecture and separated system/user concerns.

Reproduces my laptop setup and installs to /home/sewer/nixos as usual.

Directory Structure & Architecture

System-Level Configuration

/home/sewer/nixos/
├── flake.nix                   # Main flake definition with system configurations
├── flake.lock                  # Locked dependency versions
├── hosts/                      # Machine-specific configurations
└── modules/nixos/              # System-level modules
    ├── core/                   # Essential NixOS modules (audio, networking, locale)
    ├── desktop/                # Desktop environment modules (e.g. window-managers, display-managers)
    └── hardware/               # Hardware-specific modules (e.g. AMD/Intel/Nvidia GPU)

User-Level Configuration

└── users/sewer/                # User configuration
    ├── nixos/                  # NixOS-specific user settings
    └── home-manager/           # Portable user configuration
        ├── packages.nix        # User packages
        ├── shell.nix           # Shell configuration
        └── desktop/            # User desktop configuration

Daily Usage

Note

Secrets live in a separate private repo, vendored as a submodule at users/sewer/secrets. Editing one requires bumping both the submodule pointer and flake.lock — see users/sewer/secrets/README.md.

Applying Changes

Test changes before applying:

sudo nixos-rebuild test --flake .  # Temporary activation
sudo nixos-rebuild boot --flake .  # Apply on next reboot

Apply (commit) update:

sudo nixos-rebuild switch --flake .

Installing a Program (User)

Edit users/sewer/home-manager/packages.nix

  • Move to users/sewer/home-manager/programs/ if the program has custom configuration
  • Move to users/sewer/home-manager/desktop/ if the program is part of the core desktop environment

Updating System Packages

All software versions are fixed/locked until the flake is updated,

sudo nix flake update

Or can be done as part of updating:

sudo nixos-rebuild switch --flake . --upgrade

System Maintenance

Rollback

sudo nixos-rebuild rollback --flake .

Garbage Collection

# Delete ALL old generations and unreferenced packages
sudo nix-collect-garbage -d
# Delete everything older than 7 days
sudo nix-collect-garbage --delete-older-than 7d

Setting Up for New Machines

For hardware setup, configuration, and debugging, see HARDWARE.md. For SSH key and secrets-repo access, which must be in place before the first rebuild, see SECRETS.md.

Git Pre-commit Hook

A pre-commit hook automatically updates and stages matching flake.lock entries when submodules move. This prevents NAR hash mismatch build failures. To activate it in your local clone:

git config core.hooksPath hooks

⚠️ Non-NixOS Usage (NOT TESTED)

See HARDWARE.md for information about using this configuration on non-NixOS systems.

About

Personal Computer Setup with NixOS, Flakes and home-manager (just getting started!)

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages