Skip to content

lovesegfault/nix-config

Repository files navigation

nix-config built with nix ci

This repository holds my Nix configurations. It uses the nixos-unified framework for consistent configuration across NixOS, nix-darwin, and home-manager.

For the configurations' entry points, see the individual configurations, as well as flake.nix. For adding overlays see overlays.

Hostnames are picked from my hostname list.

Structure

.
├── configurations/          # Host-specific configurations
│   ├── nixos/              # NixOS hosts
│   ├── darwin/             # nix-darwin hosts
│   └── home/               # Standalone home-manager hosts
├── modules/                 # Reusable modules
│   ├── nixos/              # NixOS-only modules
│   ├── darwin/             # Darwin-only modules
│   ├── home/               # Shared home-manager modules
│   ├── shared/             # Shared NixOS+Darwin modules
│   └── flake-parts/        # Flake-level configuration
├── overlays/               # Nixpkgs overlays
└── secrets/                # Encrypted secrets (agenix-rekey)

Usage

Deploying

The unified activate command works for all configuration types:

$ nix run .#activate

This auto-detects your hostname and activates the appropriate configuration.

Alternative methods

NixOS:

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

Darwin:

$ darwin-rebuild --flake .#<hostname> switch

Home Manager:

$ home-manager --flake .#<hostname> switch

Updating inputs

To update the primary flake inputs (nixpkgs, home-manager, nix-darwin):

$ nix run .#update

Adding overlays

Overlays should be added as individual nix files to ./overlays/ with format:

final: prev: {
  hello = prev.hello.overrideAttrs (oldAttrs: { doCheck = false; });
}

For more examples see overlays.

Module conventions

  • nixosModules.* - NixOS-only modules from modules/nixos/
  • darwinModules.* - Darwin-only modules from modules/darwin/
  • homeModules.* - Shared home-manager modules from modules/home/

Modules are imported via flake outputs:

{ flake, ... }:
let
  inherit (flake) inputs self;
in
{
  imports = [
    self.nixosModules.default
    self.nixosModules.hardware-thinkpad-z13
  ];
}

About

My personal NixOS config

Topics

Resources

License

Stars

Watchers

Forks

Contributors 8