No description
  • Nix 97%
  • Shell 3%
Find a file
forgejo-actions[bot] 00d0d71a27 chore: update packages
2026-08-25 04:03:24 +00:00
.forgejo/workflows fix: replace actions/checkout with manual git clone to avoid node dependency 2026-05-29 23:21:50 -06:00
configurations sync up 2026-07-08 14:16:16 -06:00
home manage plasma declaratively with plasma-manager 2026-07-14 19:53:59 -06:00
modules manage plasma declaratively with plasma-manager 2026-07-14 19:53:59 -06:00
pkgs chore: update packages 2026-08-25 04:03:24 +00:00
secrets push up 2026-06-12 23:42:42 -06:00
.envrc add devShell and direnv .envrc 2026-06-24 13:31:56 -06:00
.gitignore add devShell and direnv .envrc 2026-06-24 13:31:56 -06:00
.sops.yaml push up 2026-06-12 23:42:42 -06:00
config.nix migrate to flake-parts with custom autowiring of configurations/ 2026-06-24 16:31:14 -06:00
flake.lock manage plasma declaratively with plasma-manager 2026-07-14 19:53:59 -06:00
flake.nix manage plasma declaratively with plasma-manager 2026-07-14 19:53:59 -06:00
README.md migrate to flake-parts with custom autowiring of configurations/ 2026-06-24 16:31:14 -06:00
tylercritchlow.keys update keys 2026-07-14 13:51:40 -06:00

Tyler Critchlow's nix-darwin and nixos System Flake

A single Nix flake that configures all my machines — macOS (via nix-darwin) and NixOS — with home-manager handling my user environment on both.

Hosts

Host System Builder Flake attribute
darwin aarch64-darwin nix-darwin darwinConfigurations.darwin
desktop x86_64-linux NixOS nixosConfigurations.desktop

Layout

flake.nix              Inputs + flake-parts entrypoint. Auto-imports every
                       module in modules/flake/. Hosts and modules are
                       autowired — no flake.nix edit needed to add one.
config.nix             User metadata (username, fullname, email), consumed
                       by flake.nix and threaded through every module.
configurations/        Per-host top-level configs, autowired into
                       nixosConfigurations / darwinConfigurations.
  nixos/               Drop <name>.nix → nixosConfigurations.<name>.
  darwin/              Drop <name>.nix → darwinConfigurations.<name>.
  Files prefixed with `_` are skipped by the autowirer (internal helpers,
  e.g. _hardware-configuration.nix imported by a host file).
modules/
  common/              Shared by darwin + nixos (e.g. nix-settings.nix).
  darwin/              macOS-only modules (homebrew, ladybird).
  nixos/               NixOS-only modules (desktop, locale, nvidia, gaming, …).
  home/                home-manager modules (packages, shell, terminal, git,
                       editors, ai-tools, gaming) + tmux.conf.
  flake/               flake-parts modules (autowire, devshell, packages).
home/                  home-manager entry point, imported by every host.
pkgs/                  Custom package definitions + nvfetcher sources.
secrets/               sops-encrypted secrets (see Secrets below).

Hosts are assembled by the autowirer in modules/flake/autowire.nix, which scans configurations/{nixos,darwin}/ and applies the shared overlay stack and home-manager wiring. The username is defined once (config.nix) and threaded through every module via specialArgs.

Rebuilding

Run from the config root:

# macOS
sudo darwin-rebuild switch --flake .#darwin

# NixOS (or whatever host you create)
sudo nixos-rebuild switch --flake .#desktop

To check a config evaluates without switching:

nix eval .#darwinConfigurations.darwin.config.system.build.toplevel.drvPath
nix eval .#nixosConfigurations.desktop.config.system.build.toplevel.drvPath

Format the tree with nix fmt (nixfmt).

Updating

# Update all flake inputs (nixpkgs, home-manager, taps, SSH keys, …)
nix flake update

# Update a single input
nix flake update nixpkgs

Custom packages

Custom packages (e.g. Helium) are tracked via nvfetcher and exposed through the overlay in flake.nix. To update them to the latest upstream releases:

nix run .#update-packages

This checks upstream for new release tags, fetches the assets, and rewrites pkgs/_sources/generated.nix with updated versions and hashes. Commit the result alongside any rebuild.

Custom packages currently include helium, drop-app, tdarr-node, and steamless-controller. New ones go in pkgs/, are wired into pkgs/nvfetcher.toml if they track upstream releases, and are added to the overlay in flake.nix.

Secrets

Secrets are managed with sops-nix. Encrypted files live in secrets/, the recipients are configured in .sops.yaml, and the age key is derived from the host's SSH key. Edit a secret with:

sops secrets/samba.yaml

Create a New NixOS Host

A NixOS host should exist per machine. To add one:

  1. Create configurations/nixos/<name>.nix and copy your hardware-configuration.nix alongside it as _hardware-configuration.nix (the _ prefix keeps it out of the autowirer). Import it from your host file.
  2. Import the shared modules you want from ../../modules/nixos/, plus any flake-input modules via flake.inputs.<input>.nixosModules.<module>.
  3. Set nixpkgs.hostPlatform and system.stateVersion.
  4. Build it: sudo nixos-rebuild switch --flake .#<name>.

No flake.nix edit is required — the autowirer picks it up from the configurations/nixos/ directory. The same applies for new darwin hosts under configurations/darwin/.