Modular NixOS/macOS configuration using nix, flakes and home-manager.
flake.nix
: Entrypoint to the configuration.lib
: Personal library containing helper functions.hosts
: Directory with host specific configurations. Each subdirectory corresponds to a specific host and contains both the system and home-manager configuration for that host. This is done by enabling/disabling the modules that can be found inmodules
.alpha
: Desktop PC - 64GB RAM, Intel i9-10850K, RTX 3090 | KDE Plasmabeta
: Macbook for work
modules
: Configuration modules. Each subdirectory contains adefault.nix
that imports all modules, i.e.,*.nix
files (including those in nested subdirectories). Each module declares an enable option to toggle it. Additionally, it may declare extra options to further customize that module.base
: Common system modules for both NixOS and Darwin (macOS). Notably, it contains theuser
submodule used to declare the user's information and whether to enable home-manager or not.nixos
: System modules specific to NixOS.darwin
: System modules specific to nix-darwin.home
: Home-manager modules usable by both NixOS and Darwin.
overlays
: Patches and overrides for some packages.pkgs
: Custom packages accessible vianix build
.config
: Directory containing dotfiles that are symlinked with home-manager.
# Prepare the deployment environment
nix-shell -p just
# Deploy using `just` & Justfile
just switch <hostname>
# Alternatively, directly deploy a specific configuration
just <hostname>
# To deploy with details use the `debug` flag
just switch <hostname> debug
# or
just <hostname> debug
On NixOS the configuration can also be deployed with the usual commands:
sudo nixos-rebuild switch --flake .#<hostname>
Other nix configuration that inspired this one: