No description
  • Nix 97.5%
  • Shell 2.5%
Find a file
preprocessor 0204f69ba5
Some checks failed
Dead code analysis / Deadnix (push) Waiting to run
Build and Cache Specific Nix Packages / Check Cache (push) Has been cancelled
Build and Cache Specific Nix Packages / Notify Discord (push) Has been cancelled
sops: ramiel specific secrets
2026-11-16 10:43:43 -05:00
.github/workflows workflow consistency 2026-11-14 13:49:32 -05:00
.secrets sops: ramiel specific secrets 2026-11-16 10:43:43 -05:00
.tack migration to multi-host 2026-11-16 09:53:28 -05:00
aspects sops: ramiel specific secrets 2026-11-16 10:43:43 -05:00
.gitignore .gitignore 2026-11-08 15:53:21 -05:00
.sops.yaml added sops 2026-04-25 23:30:31 -04:00
AGENTS.md flake: clean artwork 2026-10-01 22:40:37 -04:00
flake.nix migration to multi-host 2026-11-16 09:53:28 -05:00
justfile justfile: update neovim 2026-09-21 18:06:49 -04:00
README.md migration to multi-host 2026-11-16 09:53:28 -05:00

My NixOS Config

This is my personal NixOS setup, and it's kind of grown into its own little flake framework. Instead of pulling in flake-parts, flake-file, wrapper-modules, stylix, base16.nix, and a pile of other helpers, it reimplements the pieces I actually use with lib and nixpkgs.

I did this to:

  1. Learn more about NixOS and the Nix expression language.
  2. Have exactly the features I desire and nothing more.
  3. Make each abstraction (hopefully) small enough to read in one sitting.

Design Philosophy

Self-reliance

The interesting machinery is built from lib and nixpkgs — no flake-parts, no flake-utils, no stylix, no base16.nix. Fewer moving parts means fewer inputs to pin, fewer upgrade cliffs, and fewer uncontrolled abstractions.

Every abstraction is small enough to audit

The perSystem layer is a couple hundred lines. mkScheme is ~100. The package wrapper is one runCommand. Each one replaces a third-party tool with a deliberately narrow reimplementation, so understanding the repo doesn't require understanding a framework first.

Everything is a module

The flake top level, every perSystem fragment, every wrapped package, and each host config are all evaluated as modules with typed options. The schemas document themselves, and composition happens through deferred modules instead of hand-rolled merging.

Pins are data, not flake inputs

Tack replaces inputs with a declarative, signed, patchable pins.toml. tack.nix exposes that file as top-level nix options and generates it, ala flake-file. Dependencies show up in a reviewable diff instead of hiding in a flake.lock.

Compose hosts from modules, not one giant config

A host declares its user, state version, colorscheme, hardware profile, and which modules it wants. Modules organize themselves into core, host, hardware, or a named module within modules, and configurations.nix assembles the final nixosSystemMinimal.

Areas of interest

If you're here to get ideas, these are worth reading:

# Area What it is
1 A hand-rolled perSystem flake-parts' per-system abstraction, rebuilt from scratch
2 Tack inputs, not flake inputs a flake-file-style interface that generates pins.toml
3 The package wrapper an option-driven wrapPackage on top of makeWrapper
4 Lib-only colorschemes a base16/24 engine with zero nixpkgs imports
5 Composable host configurations bucket-based module composition for hosts

A hand-rolled perSystem

file: flake.nix

This is the part that replaces flake-parts perSystem. It runs two evalModules passes: the first evaluates the top-level ./aspects tree (flake-level options, tack pins, schemes), and the second re-runs one perSystem module once per system with extra arguments.

The glue is a handful of small helpers:

  • systemInput narrows a flake-shaped input to a single system, dropping the system layer so inputs'.foo.packages.bar means inputs.foo.packages.${system}.bar.
  • withSystem builds the per-system argument bundle: pkgs, inputs', self', packages', meta, system, rootPath.
  • packages' is a convenience layer that picks packages.default, falls back to a package named after the input, then merges everything into one set.
  • output transposition flips system -> category -> derivation into the category -> system -> derivation shape flake outputs expect.

The result is a flake that still looks normal from the outside (packages.x86_64-linux.*, nixosConfigurations.*) but gives every module the same ergonomic arguments flake-parts users get, then extends those further.

Composable host configurations

file: aspects/hosts/configurations.nix

Hosts are declared as submodules, so modules.configurations.ramiel only accepts the fields: system, stateVersion, user, hardware, scheme, modules, and extraConfig. From each entry, the module builds a nixosSystemMinimal with the right specialArgs (scheme, pkgs, inputs', hostname, constants, ...). It starts with no NixOS modules at all: the base modules we rely on are listed explicitly in aspects/hosts/_base-modules.nix instead of importing nixpkgs' full module list.

The composition is the important part. We merge deferred modules into sets:

  • modules.core — common configuration modules provided to every host
  • modules.hardware.<profile> — hardware-specific modules
  • modules.host.<hostname> — per host modules
  • modules.mods.<name> — opt-in feature sets like desktop, gaming, comms

A host just lists the modules it wants, and the final module list is assembled from those sets. So enabling gaming on a second machine is one word, not a copy-paste of config.

file: aspects/hosts/configurations.nix

{ config, ... }:
{
  modules.configurations.ramiel = {
    user = "wyspr";
    stateVersion = "25.11";
    scheme = "amber";
    hardware = "desktop-pc";
    modules = with config.modules.mods; [
      printing
      desktop
      gaming
      comms
    ];
  };
}

This will receive the following modules:

modules.core
modules.hardware.desktop-pc
modules.host.ramiel
modules.mods.printing
modules.mods.desktop
modules.mods.gaming
modules.mods.comms

Tack flake inputs

file: aspects/flake/tack.nix

Dependencies live in .tack/pins.toml and get imported into the flake, so there's no flake.lock and no inputs block to edit. This module gives that file a typed option schema (tack.inputs.*, tack.shorturls, tack.signers, all_follow, patches, follows, and so on) and then writes it back out with write-tack.

write-tack is a flake app that:

  1. Turns the evaluated options into TOML using a custom generator
  2. Diffs them against the current file
  3. Only runs tack update or tack patch for inputs that have changed or updated It also rewrites the file so every input starts with its url, which makes the diffs much nicer to read. Its like flake-file, for tack.

Inputs can be declared as children of the top-level tack option.

{
  tack.inputs.hjem = {
    url = "gh:feel-co/hjem";
    group = "nix";
  };

  ...
}

Then:

nix run .#write-tack

Produces:

# .tack/pins.toml
[inputs.hjem]
url = "gh:feel-co/hjem"
group = "nix"

Package wrappers

file: ./aspects/flake/wrappers.nix

wrapPackage is a module-based wrapper around makeWrapper

wrapPackage {
  package = pkgs.kitty;
  binName = "kitty";
  env.KITTY_CONFIG_DIRECTORY = files.config.dir;
  files.config = {
    path = "config/kitty.conf";
    file =
    let
    toKittyConfig = lib.concatMapAttrsStringSep "\n" (
      name: value:
      let
        mkValue = v: v |> (if lib.isBool v then lib.boolToYesNo else toString);
      in
      if lib.isList value then
        value |> lib.concatMapStringsSep "\n" (v: "${name} ${mkValue v}")
      else
        "${name} ${mkValue value}"
    );
    in
    ''
    # Settings
    ${toKittyConfig cfg.settings}

    # Keybindings
    ${toKittyConfig cfg.keybindings}

    # Theme
    ${cfg.theme}
    '';
  runtimePackages = [ pkgs.ydotool ];
  aliases = [ "term" ];
}

It supports env, args, runCommand, runtimePackages, linkedPackages, files, and aliases. Files passed as strings go through passAsFile, store paths get symlinked, and wlib gives you placeholder-aware helpers for generating JSON, TOML, YAML, or INI inside the wrapper.

Colorschemes

file: aspects/flake/16.nix

This is a stripped-down base16.nix with no dependency on pkgs. Give it a scheme and mkScheme normalizes it to base24, adds mnemonic names (red, bright-blue, ..), and exposes a few useful forms:

  • scheme.base0D — the raw hex value
  • scheme.noHashtag.base0D — hex without the #
  • scheme.asRgb8.base0D — { r, g, b; } in 0–255
  • scheme.asRgb.base0D — the same, normalized to 0–1

The schemes themselves live in schemes.nix, and hosts pick one by name. No external theming framework, just a bit of hex math in lib.

Repository layout

.
├── flake.nix                  # the perSystem / output machinery
├── aspects/
│   ├── flake/                 # flake-level modules (tack, wrappers, 16, sops, ..)
│   ├── hosts/
│   │   ├── configurations.nix # host schema and system assembly
│   │   ├── nixosSystemMinimal.nix # evalModules wrapper without module-list
│   │   ├── _base-modules.nix  # explicit list of NixOS modules we import
│   │   └── ramiel/            # one host: boot, hardware, packages
│   └── modules/
│       ├── core/              # base system modules
│       ├── extra/             # gaming, rice, xdg
│       ├── programs/          # gui and tui apps
│       └── services/          # audio, networking, disks, ..
├── .tack/                     # pins.toml and patches
└── justfile

That's the tour. If you're building something similar, the five areas above are the ones I'd start with — they're the parts that made the rest of the config pleasant to live in.