Reusing as a Baseline
Downstream (“extended” flavor) repositories consume this configuration as a flake input and build their hosts from its building blocks, keeping their own codebase slim while benefiting from the continued maintenance here. The flake exposes the reusable library as:
nixosModules.baseline— the glue every consuming host needs (Home Manager integration, additional overlays, shared Home Manager settings).nixosModules."roles/…",nixosModules."concepts/…",nixosModules."system/…"— the role, concept, and system modules, keyed by their path.homeModules."user/…"— the shared user-level Home Manager modules.
The downstream flake wires only the shared baseline into every host. Each host then attaches its own role, disks, and hardware configuration, so machines are not forced to be alike.
Example downstream flake and host
Section titled “Example downstream flake and host”# flake.nix (in a downstream repository)outputs = { nixpkgs, painless, ... }@attrs: let lib = nixpkgs.lib; mkSystem = name: lib.nixosSystem { system = "x86_64-linux"; specialArgs = attrs; modules = [ painless.nixosModules.baseline { system.autoUpgrade.flake = import ./upgrade-source.nix; } ./hosts/${name} ]; }; hostNames = builtins.attrNames ( lib.filterAttrs (_: t: t == "directory") (builtins.readDir ./hosts) ); in { nixosConfigurations = lib.genAttrs hostNames mkSystem; };# hosts/example/default.nix — picks its own role and disks{ painless, ... }:{ imports = [ ./hardware-configuration.nix painless.nixosModules."roles/workstation/office" painless.nixosModules."system/disks/automatic" ]; networking.hostName = "example";}