Skip to content

Latest commit

 

History

296 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❄️ nix-config

A highly modular NixOS configuration, managed with Nix Flakes and Home Manager.


Structure

nix-config/
├── flake.nix          # Flake entrypoint — inputs, outputs, and host definitions
├── flake.lock         # Pinned dependency versions
├── hosts/             # Per-host NixOS configurations
├── nixos/
│   └── modules/       # Reusable NixOS modules
└── home/              # Home Manager configuration (user environment, dotfiles, etc.)

Hosts

Hosts are defined in the hosts/ directory. Each host has its own configuration that imports shared NixOS modules and hardware-specific settings.

Home Manager

User-level configuration lives in home/, including shell setup, editor config, and any other dotfiles managed declaratively through Home Manager.

NixOS Modules

Reusable, composable NixOS modules are stored under nixos/modules/. These can be shared across multiple hosts to keep configuration DRY.


Usage

Prerequisites

  • NixOS with flakes enabled, or any Linux distro with Nix installed
  • Flakes and the new nix CLI enabled in your Nix config:
# /etc/nix/nix.conf  (or nix.settings in your NixOS config)
experimental-features = nix-command flakes

Rebuild a NixOS system

sudo nixos-rebuild switch --flake .#<hostname>

Apply Home Manager configuration

home-manager switch --flake .#<username>@<hostname>

Update flake inputs

nix flake update

Installation (fresh NixOS)

  1. Boot a NixOS installer and partition/format your disks.
  2. Mount the target filesystem at /mnt.
  3. Generate hardware config:
    nixos-generate-config --root /mnt
  4. Clone this repo:
    nix-shell -p git
    git clone https://github.com/samuelskovbakke/nix-config /mnt/etc/nixos
  5. Copy or symlink the generated hardware config into the appropriate host directory.
  6. Install:
    nixos-install --flake /mnt/etc/nixos#<hostname>
  7. Reboot, then apply Home Manager:
    home-manager switch --flake ~/.config/nixos#<username>@<hostname>

Key Technologies

Tool Purpose
NixOS Declarative OS configuration
Nix Flakes Reproducible, pinned dependency management
Home Manager User environment and dotfiles

License

This project is licensed under the GNU General Public License v3.0. You are free to use, modify, and distribute this configuration, but any derivative work must also be distributed under the same GPL v3.0 license.

Contributors

Languages