config (WIP)
My personal system configurations for Darwin/macOS and NixOS, written in Nix.
The goal of this repo is to use and evolve my working environment across all my systems and machines.
Setup
NixOS
These setup instructions assume a fresh install of NixOS.
- Make
git
available to your shell, e.g. by runningnix-shell -p git
- Clone this repository (if using this as base for your own config, you should fork it first) and change into its directory.
- If you are not me, customize the values in
user
inmeta.nix
- Enable nix's command line and flakes features:
export NIX_CONFIG="experimental-features = nix-command flakes"
- Bootstrap the system configuration:
- For a machine already defined in
meta.nix
and with an entry inflake.nix
, runsudo nixos-rebuild switch --flake .#NAME_OF_MACHINE
- For a new machine:
- Add an entry for the machine in
meta.nix
(see existing entries) - Create a directory for the machine in the
machines
directory, e.g.johns-laptop
- In the machine's directory, add
hardware-configuration.nix
by runningcp /etc/nixos/hardware-configuration.nix .
- To update the file if the hardware changes, run
sudo nixos-generate-config
and copy over the file again orecho "$(nixos-generate-config --show-hardware-config)" > hardware-configuration.nix
to update it directly - Create a
configuration.nix
file that importshardware-configuration.nix
andnixos/configuration.nix
(relative path) - In the configuration file, set
networking.hostName
to the hostname defined for the machine inmeta.nix
(you can import the file for that purpose) - In
flake.nix
, create an entry for the machine (e.g.johns-laptop
) innixosConfigurations
that imports the machine'sconfiguration.nix
as a module (see existing configurations) - From the directory's root, run
sudo nixos-rebuild switch --flake .#NAME_OF_MACHINE
- Add an entry for the machine in
- For a machine already defined in
Darwin
TODO