Skip to content

About

my NixOS configuration for conveniently setting up my dev environment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

199 Commits

Folders and files

Repository files navigation

Nix config

My macOS development setup, managed with nix-darwin and Home Manager.

This repo configures my Apple Silicon MacBook Pro: mbp.

If necessary it should be easily expandable by creating a new host in the hosts/ directory.

Layout

.
├── flake.nix
├── flake.lock
├── hosts/
│   └── mbp/
├── modules/
│   ├── common/
│   └── darwin/
├── pkgs/
├── scripts/
└── justfile
  • hosts/mbp/ contains the host entry point.
  • modules/common/ contains shared user and development tooling.
  • modules/darwin/ contains macOS system settings and packages.
  • pkgs/ contains packages that are not sourced directly from nixpkgs.
  • scripts/ contains checks and update helpers.

Bootstrap

Install Determinate Nix, clone the repository, enter it, and run:

nix --extra-experimental-features 'nix-command flakes' \
  --accept-flake-config run --inputs-from . nixpkgs#just -- bootstrap

This obtains Just from the repository's locked Nixpkgs input. If just is already available, just bootstrap is equivalent. The host defaults to mbp; pass mbp as the final argument to select it explicitly.

If nh is already installed, bootstrap uses it. Otherwise it runs the repository's locked nix-darwin with sudo.

Home Manager activation attempts to install the Cloudflare CLI (cf) through Bun if it is missing. Activation and interactive shells use the same persistent Bun root at $XDG_DATA_HOME/bun (~/.local/share/bun by default), with downloads cached separately at $XDG_CACHE_HOME/bun. This requires network access on first install; Bun owns the CLI version outside the Nix lock file. Activation also caches its Zsh completion, so shell startup does not run the CLI. Installation or completion failures warn without aborting activation; failed generation preserves any existing completion. Completion refreshes on activation. After updating cf through just update-extras, run just switch to refresh its cached completion.

Activation also bootstraps the Prime infrastructure CLI through uv and the separate Rust Prime Agent through its upstream installer. Both install under ~/.local; existing executables are left alone. These are network-dependent, unpinned installations, not Nix store packages. Failures warn without aborting activation; retry with just switch. just update-extras updates both tools after installation.

On an existing installation, the next activation migrates ~/.cache/.bun to the persistent root and leaves a compatibility symlink for old shells and rollback generations. It refuses to overwrite an existing destination. The separate ~/.bun directory is untouched. Open a fresh login shell after switching to pick up the new environment and PATH.

Before the first activation, sign in to the Mac App Store so the configured masApps can be installed. The Neovim configuration, GPG secret key, TX-02 font, Zed, and browsers are intentionally managed outside this repository. just doctor checks the Neovim checkout and link, required editor commands, TX-02 font, and Zed installation; it does not verify GPG key availability, browsers, or macOS permissions.

For a replacement machine, see the recovery checklist and external-tool inventory.

Objective-See apps

Homebrew manages OverSight, BlockBlock, and What's Your Sign. After the first just switch:

  • Allow OverSight notifications and set its notification style to Alerts.
  • Grant BlockBlock Full Disk Access in System Settings. Paste Protection also requires Accessibility permission for its helper if enabled.
  • What's Your Sign's cask only stages its installer. Run the open command printed by Homebrew and complete the GUI installation. If the Code Signing Info Finder menu item is missing, enable or toggle WhatsYourSign in System Settings → Login Items & Extensions. Repeat the GUI installation after cask upgrades as needed.

These permissions and the What's Your Sign GUI installation remain manual; a successful rebuild alone does not mean setup is complete.

Daily use

Check the flake and build the configuration without activating it:

just check

Activate the configuration:

just switch

Format the Nix files:

just fmt

Run the flake checks:

just lint

Check tools and configuration that live outside Nix:

just doctor

Updating

Update the Bun and OMP pins to their latest stable releases, and update flake inputs without activating anything:

just update

The update allows uncommitted changes to flake.lock, pkgs/bun-latest.nix, and pkgs/omp-latest.nix, but refuses changes to other files. The safety check supports both Jujutsu and ordinary Git clones.

just update-bun and just update-omp refresh individual pins. Bun uses an upstream Apple Silicon release with nixpkgs' packaging and Darwin fixups, so it can update even when nixpkgs lags. OMP uses a prebuilt Apple Silicon binary pinned by build ID and SHA-256. Normal rebuilds keep these versions until the pins are updated.

Update tools managed outside Nix:

just update-extras

This updates Bun global packages to latest releases (including Pi and cf), npm globals, uv tools, Rust toolchains, Prime Agent, Sentry CLI, Pi extensions, Mac App Store apps, and Homebrew packages. Missing commands are skipped. Failures are reported without preventing the other extras from being attempted; the stage exits unsuccessfully if any updater fails. Updates run from $HOME, never from the caller's project.

This does not update source checkouts, Cargo-installed binaries, arbitrary downloaded executables, or independently installed GUI apps such as Zed and browsers. Those retain their own update workflows. Other Nix packages normally follow nixpkgs. Node 24 temporarily uses the official, hash-pinned Apple Silicon 24.22.1 security release, including its bundled libraries. The system Node runtime, Cloudflare CLI completion, and Twilio use this package without rebuilding unrelated tools. It automatically defers to nixpkgs once its Node 24 package reaches 24.22.1 or newer. Bun and OMP have independently updated upstream release pins.

Run the full update workflow:

just rebuild-update

This runs four stages in order:

  1. Update repository pins.
  2. Check the flake and build the host.
  3. Activate the configuration.
  4. Update external CLI packages, extensions, toolchains, and apps.

Each stage is available separately, so a failed update does not force the whole workflow to be repeated.

Nix storage maintenance

Determinate Nix owns automatic store garbage collection. A separate root launchd job, org.nixos.nix-prune-generations, prunes only the system profile every Sunday at 12:00 local time. It keeps all generations from the last 30 days and at least the latest 10. It does not collect store garbage or prune project/direnv roots.

Preview the retention policy without changing anything:

nh clean profile /nix/var/nix/profiles/system --dry --keep 10 --keep-since 30d --no-gc --no-gcroots --no-direnv

The job is installed by just switch; activation does not immediately prune anything. Logs go to /var/log/nix-prune-generations.log. Pruned generations are no longer available for rollback. Determinate can reclaim their unreferenced dependencies later.

What is managed

Nix and Home Manager

  • Shell and terminal tooling
  • Git and Jujutsu
  • Editors and language tooling
  • Zellij
  • Shared packages
  • Theme and user configuration

nix-darwin

  • macOS defaults
  • System and security settings
  • AeroSpace
  • GPG
  • Homebrew
  • Zed
  • macOS-specific packages

Package ownership

The setup is Nix-first, not Nix-only.

Stable CLI tools, development tools, and shared configuration belong in Nix. Homebrew handles GUI apps, vendor tools, and packages that currently work better outside nixpkgs.

Brave, Chrome, and Helium are installed and updated outside Nix.

Zed is installed as a macOS app, while its settings are managed declaratively.

The Neovim configuration lives in the standalone ~/Code/nvim repository. Home Manager links it into ~/.config/nvim. just doctor verifies that link and the external tools the editor expects.

Neovim uses the hash-pinned tsrs compiler/language server from pkgs/tsrs.nix, without its opt-in fast mode. The package includes its matching standard library declarations; TypeScript's tsc remains installed as a reference compiler, not aliased to tsrs. Projects keep their own TypeScript dependencies. This tsrs release targets TypeScript 7.1 beta and has documented compatibility gaps. Its version and hash are updated manually in pkgs/tsrs.nix, followed by just check; just update does not advance this pin.

About

my NixOS configuration for conveniently setting up my dev environment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages