Skip to content

jacobrreed/nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nix-darwin Den Configuration

This repository contains a macOS system configuration built with Nix, nix-darwin, Home Manager, flake-parts, and the Den framework.

It is structured so the machine-specific values live in settings.nix, while the rest of the configuration is split into reusable Den aspects.

What It Includes

  • nix-darwin system configuration for macOS.
  • Home Manager configuration for the primary user.
  • Den host and user aspects for composing system and user modules.
  • Homebrew package, tap, and cask management through nix-darwin.
  • Shell, terminal, window manager, status bar, Git, and CLI tool configuration.
  • Out-of-store symlinks for local assets under assets/.
  • A generated flake.nix managed by flake-file from modules/inputs.nix.

Customize The Machine

Edit settings.nix before building on a different Mac or for a different user:

rec {
  username = "your-user";
  hostname = "your-hostname";
  hostPlatform = "aarch64-darwin";
  homeDirectory = "/Users/${username}";
  repoDirectory = "${homeDirectory}/nix";

  gitUserName = username;
  gitUserEmail = "you@example.com";
}

Use x86_64-darwin for Intel Macs. Keep repoDirectory aligned with the clone path because several Home Manager files symlink scripts from assets/.

Repository Structure

  • flake.nix: generated flake entrypoint. Do not edit directly.
  • flake.lock: pinned input revisions.
  • settings.nix: host, user, home directory, repo path, platform, and Git identity settings.
  • modules/inputs.nix: source of truth for flake inputs and description.
  • modules/dendritic.nix: enables flake-file and Den dendritic modules.
  • modules/hosts.nix: declares the Den host and attached user from settings.nix.
  • modules/aspects.nix: composes host-level and user-level Den aspects.
  • modules/outputs.nix: exposes the default package as the configured nix-darwin system.
  • modules/programs/: individual system and Home Manager aspects.
  • assets/: local scripts, SketchyBar files, Kitty helpers, and fonts referenced by modules.
  • Justfile: helper commands for regenerating and switching the system.

Install Nix

Install Nix in daemon mode:

sh <(curl --proto '=https' --tlsv1.2 -L https://nixos.org/nix/install) --daemon

Enable flakes for the first build if your Nix install does not already have them enabled:

mkdir -p ~/.config/nix
printf 'experimental-features = nix-command flakes\n' >> ~/.config/nix/nix.conf

Restart the shell after installing Nix so nix is on PATH.

Build And Activate

Clone the repository to the path configured by settings.nix, then build and activate the configured host:

CONFIG_HOST="$(nix eval --raw --file settings.nix hostname)"
nix build ".#darwinConfigurations.${CONFIG_HOST}.system"
sudo ./result/activate

After activation, the included just helpers can be used:

just build
just switch
just update

The drs shell function also rebuilds and activates the configured host from settings.nix.

Regenerate The Flake

flake.nix is generated. Update modules/inputs.nix, then run:

just write-flake

or:

nix run .#write-flake

Notes

  • The first build may require Xcode Command Line Tools for native packages or Homebrew integration.
  • Homebrew taps include an internal Bitbucket tap; remove or replace it in modules/programs/homebrew.nix if unavailable.
  • This configuration assumes a primary user managed by Den and Home Manager.
  • Some GUI services, such as Yabai and SketchyBar, may require macOS accessibility permissions after activation.

About

Nix setup for darwin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors