This is my Nix configuration. It supports my macOS, nixOS, and home-manager configurations.
Nix and Flakes must be installed in order to build the derivations. I recommend using the Determinate Nix Installer.
curl --proto '=https' --tlsv1.2 -sSf -L \
https://install.determinate.systems/nix | sh -s -- install
You can now build a system configuration by running nix build
and specifying the configuration target:
For nix-darwin
(macOS):
nix build .#darwinConfigurations.bromanko-personal-mbp.system
./result/sw/bin/darwin-rebuild switch --flake .#bromanko-personal-mbp
For nixos
:
nixos-rebuild switch --flake .#nixosConfigurations.dev-vm
For home-manager
:
nix build .#homeManagerConfigurations.fb-devserver.activationPackage
./result/activate
For a LiveCD:
[!NOTE] These ISOs must be built on a Linux system.
nix build .#isoConfigurations.macmini.config.system.build.isoImage
The home-manager configuration is decoupled from the nixos or Darwin modules. This allows me to use the same config for both environments managed by nixos/nix-darwin and plain home-manager. Unfortunately it makes the organization of modules messy. The modules defining home-manager options must be in separate files from the config itself. This is because I need to import the home-manager config manually outside of the module loading process.
- The
/home-manager
folder contains the home-manager config and will get imported under ahome-manager
option. - The
/modules/home-manager
folder contains the options for enabling home-manager configuration.
This setup is heavily inspired by:
- malob's excellent nixpkgs configuration.
- hlissner's dotfiles