Nix flake for declaratively managing and configuring my systems.
Install Determinate Nix
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- installNote
Determinate Nix enables flakes by default and manages the Nix installation. Open a new shell after installation if nix is not yet available. Bootstrapping requires an Apple Silicon Mac and administrator access for sudo. direnv is optional and provides automatic access to the development environment.
Run this on a new Mac:
nix run github:samueljoli/systems#machine-nameRun
just machinesto list available host machines.
This builds and activates the macOS system configuration, applies the Home Manager configuration, and installs the configured Homebrew packages and applications.
To bootstrap a checkout instead of the GitHub revision:
nix run .#machine-nameFrom another directory, point the command at a local checkout with:
SYSTEMS_FLAKE=/path/to/systems nix run .#machine-nameThe machine hostname becomes both the Darwin configuration name and the bootstrap command name.
Machine definitions compose reusable Darwin and Home Manager modules. Shared configuration lives in modules/, while machine-specific differences live in machines/.
This keeps configuration reusable as more machines are added. A machine selects the modules it needs instead of copying the complete configuration from another machine.
To add another Mac:
- Create a directory under
machines/. - Add a machine definition based on
machines/lakay/. - Select the shared Darwin and Home Manager modules.
- Add only machine-specific settings to that machine's directory.
- Register the machine in
machines/default.nix. - Bootstrap it with its flake application:
nix run .#machine-nameThe Neovim configuration is also exposed as an independent flake package. It
currently supports Apple Silicon macOS (aarch64-darwin).
From a local checkout:
git clone https://github.com/samueljoli/systems.git
cd systems
nix run .#neovimOr run it directly from GitHub:
nix run github:samueljoli/systems#neovimTo install it into your Nix profile instead:
nix profile install github:samueljoli/systems#neovim
nvimThe standalone package includes the Nix-pinned plugins, Tree-sitter grammars, language servers, formatters, and command-line tools used by the configuration. The Home Manager configuration and the standalone package share the same Lua and plugin definitions.
This repository uses direnv to load the Nix development shell automatically through .envrc.
When you first enter the repository, allow direnv:
direnv allowAfter that, direnv loads the development environment automatically whenever you enter the directory. It provides tools used to work on this repository, including just, nixfmt, Nix and Lua language servers, Node.js, and TypeScript tooling.
If you do not use direnv, enter the same environment manually with:
nix develop