Skip to content

kclejeune/system

Repository files navigation

Nix System Configuration

Build Status

This repository manages system configurations for all of my macOS, NixOS, and Linux machines.

Structure

The flake follows the dendritic pattern: flake.nix is a tiny entry point that hands a flake-parts orchestrator the recursively-discovered tree under ./modules via vic/import-tree. Every .nix file under ./modules is a flake-parts module that self-registers a piece of the flake output: a reusable module, a host configuration, an overlay, a devShell, etc. There is no central file that imports everything.

modules/
├── imports.nix, systems.nix, options.nix    # flake-parts plumbing
├── nixpkgs.nix, overlays.nix, packages.nix  # per-system package wiring
├── devshell.nix, treefmt.nix, pre-commit.nix
├── hosts/      # one file per concrete config output (phil, wally, gateway, …)
├── shared/     # cross-class option modules (primary-user, nixpkgs-wiring)
├── nixos/      # flake.nixosModules.<name>
├── darwin/     # flake.darwinModules.<name>
├── home/       # flake.homeModules.<name>
└── profiles/   # personal/work profiles, declared across all three classes

Each module file inlines its body directly — a file like modules/nixos/hyprland.nix both registers flake.nixosModules.hyprland and contains the full compositor configuration. Cross-module references go through config.flake.<class>Modules.<name> so hm.imports = [ config.flake.homeModules.hyprland ] in the NixOS module is how the home-manager side of Hyprland is pulled in when Hyprland is enabled.

Non-Nix assets that aren't flake-parts modules live in secrets/, pkgs/{cb,fnox,weave}/ (custom package sources), and modules/home/assets/{dotfiles,nvim,yazi}/ (source-path references for the corresponding home modules).

Overlapping nix-darwin and NixOS

nix-darwin and NixOS share identical shell/user/fonts/packages setup via modules/nixos/default.nix and modules/darwin/default.nix, with shared option declarations (user, hm) and nixpkgs wiring factored into modules/shared/.

Decoupled home-manager configuration

The home-manager configuration is entirely decoupled from NixOS and nix-darwin. All modules live in modules/home/. For each NixOS/darwin host they are pulled in via the flake-parts hm alias (see modules/shared/primary-user.nix), which forwards config.hm.* to home-manager.users.${config.user.name}.*. The same module tree is also exposed as homeConfigurations so it is fully usable as a standalone configuration on any Linux system via the home-manager CLI.

User profiles

User "profiles" live in modules/profiles; these modules configure contextual, identity-specific settings such as SSL certificates or work-vs-personal email addresses. Each profile is declared across all three module classes in a single file (personal.nix, work.nix).

Installing a configuration

Non-NixOS prerequisite: install the Nix package manager

curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install --determinate

Skip this step on NixOS, where nix is the package manager by default.

System bootstrapping

NixOS

Follow the installation instructions, then run:

sudo nixos-install --flake "github:kclejeune/system#phil"

Replace phil with wally or gateway for the other hosts.

Darwin / Linux

Clone this repository into ~/.nixpkgs:

git clone https://github.com/kclejeune/system ~/.nixpkgs

Bootstrap a new system by using nh to activate the config:

nix run .#nh -- darwin switch .#kclejeune@aarch64-darwin

nh auto-detects the host and installs nix-darwin or home-manager; override with --darwin or --home-manager if needed.

About

Declarative system configurations using nixOS, nix-darwin, and home-manager

Topics

Resources

License

Stars

Watchers

Forks

Contributors