Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

20 Commits

Folders and files

Repository files navigation

nixvana-ii

A shared macOS starter using Nix, home-manager, nix-darwin, and McMonad. The example targets Apple Silicon. It carries the reusable desktop and command-line pieces of nixvana, with public inputs and editable example identities. Personal host configurations, private services, credentials, and games are excluded.

Quick start

  1. Install the Xcode command-line tools (xcode-select --install), Nix, and Homebrew. The Nix installer should enable flakes and nix-command.

  2. Follow the macOS setup guide for the shared Brewfile, Ghostty, and optional input/microphone preferences.

  3. Set home.username in home-manager/example-host.nix to your macOS short username (id -un). The home directory is derived from it. Rename my-mac and its hostname value in home-manager/flake.nix if desired.

  4. From the repository root, build the configuration first, then apply it:

    nix run ./home-manager#home-manager -- build --flake ./home-manager#my-mac
    nix run ./home-manager#home-manager -- switch --flake ./home-manager#my-mac

    This also installs the home-manager command for future use. If you rename the host, use that name after # in both commands.

  5. Complete McMonad permissions and first-run setup. Home Manager starts McMonad now and at login. Quit any previous window manager and disable its login item before switching.

Home Manager preserves your keyboard languages and Caps Lock behaviour. The Karabiner profile and macOS defaults are optional, explicit setup steps. Backups are disabled until you configure and enable them.

For the optional desktop system monitor, see mconky-rs / Wallstats setup.

What is managed where

Path Purpose
flake.nix Development shell with nixfmt and nixd
home-manager/flake.nix Public inputs, pinned McMonad, and example host
home-manager/example-host.nix Your username, optional services, McMonad preferences
home-manager/darwin.nix Shared CLI, shell, Nix tooling, and GPG modules
home-manager/include/cli-darwin.nix CLI packages including btop, duf, and dust
home-manager/include/services/ GPG and opt-in restic backup agents
nix-darwin/flake.nix Optional system configuration and hostname
imperative-darwin/Brewfile Shared GUI apps and supporting CLI tools
imperative-darwin/configs/ Ghostty, Karabiner, LinearMouse, and MicGuard examples

Add personal applications and service integrations in your own configuration. Keep credentials outside Nix expressions: their contents can enter the world-readable Nix store. Review the diff before sharing your customised fork.

Optional nix-darwin setup

Edit the hostname, users.users.youruser, and its home directory in nix-darwin/flake.nix. Remote SSH access is disabled; enable it only if needed. The flake leaves Nix itself under the installer’s management (nix.enable = false).

From the repository root:

nix run ./nix-darwin#darwin-rebuild -- build --flake ./nix-darwin#my-mac
sudo nix run ./nix-darwin#darwin-rebuild -- switch --flake ./nix-darwin#my-mac

Scheduled backups (opt-in)

home-manager/include/services/backup-darwin.nix provides a daily restic backup at 14:00. Choose your own repository, configure any backend credentials outside this repository, and set these options in your host configuration:

services.backup-home = {
  enable = true;
  repo = "sftp:backup-host:/backups/my-mac";
  passwordCommand = "security find-generic-password -a restic -s backup -w";
};

If upgrading a configuration that already used these backups, set enable = true and retain your repository before switching; the new default disables the agent.

The password command must retrieve an existing secret. The default reads the backup service for the restic account from macOS Keychain; you can change it to your password manager’s command. There is no default repository or assumed cloud account. Use a distinct repository path for each machine.

The existing backup command can initialise a new repository. It retains 7 daily, 4 weekly, 12 monthly, and 3 yearly snapshots, then prunes. Review its exclusions before relying on it: caches and several macOS-protected directories are omitted. Run backup-home manually after enabling it and verify a restore before relying on the schedule. The Mac must be awake for the scheduled run.

Run logs are in ~/.local/log/backup-home-*.log; launchd stdout/stderr are in ~/Library/Logs/backup-home-launchd.*.log.

Launch agents and troubleshooting

Home Manager manages launchd.agents.<name> and generates plists under ~/Library/LaunchAgents/org.nix-community.home.<name>.plist.

Agent When it runs
mcmonad At login, with restart on exit
gpg-agent-start At login
backup-home Daily at 14:00, only when enabled

For example, inspect or restart McMonad:

launchctl print "gui/$(id -u)/org.nix-community.home.mcmonad"
launchctl kickstart -k "gui/$(id -u)/org.nix-community.home.mcmonad"

Edit McMonad’s Haskell configuration in home-manager/example-host.nix, then run home-manager switch --flake ./home-manager#my-mac. Home Manager owns ~/.config/mcmonad/mcmonad.hs; editing that generated file is not persistent. The switch attempts to recompile the configuration and restarts the agent. Check its output for compiler errors: the current upstream module falls back to its bundled defaults on compilation failure, even if the switch succeeds. Those defaults can re-enable OCR and change mouse behaviour. A Nix build alone does not typecheck your Haskell configuration.

If recompilation fails, stop the agent while you fix the source:

launchctl bootout "gui/$(id -u)/org.nix-community.home.mcmonad"

Reapply Home Manager after correcting the source and confirm compilation succeeds. If the agent is still unloaded, load its generated plist again:

launchctl bootstrap "gui/$(id -u)" ~/Library/LaunchAgents/org.nix-community.home.mcmonad.plist

Check ~/Library/Logs/mcmonad-launcher.log for startup errors. Recheck Accessibility permissions after an upgrade if hotkeys stop working.

Updating inputs

Update only the input you intend to change, review its lockfile diff, and build before switching. For example:

nix flake update mcmonad --flake ./home-manager
nix run ./home-manager#home-manager -- build --flake ./home-manager#my-mac

Keep the public HTTPS input URLs when sharing the configuration; do not copy a personal checkout’s lockfile or private overlays wholesale.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages