# A Dendritic Nix Flake Regenerate flake and switch to it. ```shell nix run .#write-flake nix flake check home-manager switch --flake .#desktop ``` ```shell nix flake show --all-systems ``` ```shell nix run nixpkgs#nh home switch -- --configuration john@john-pc-ubuntu . ``` ## Host Intent | Host key | Type | Intent | Entrypoint | | -------- | ---- | ------ | ---------- | | `janus` | NixOS (LXC) | Base homelab/service host with local step-ca trust bootstrap (`janus-ca`) and mTLS support. | `modules/hosts/janus/default.nix` | | `john-kde` | Home Manager (generic Linux) | KDE-focused user environment profile for `john` with desktop + docker + step client tooling. | `modules/hosts/john-kde/default.nix` | | `john-p14s` | NixOS (laptop) | Main ThinkPad P14s NixOS workstation using hardware presets and desktop/dev modules. | `modules/hosts/john-p14s/default.nix` | | `john-pc-ubuntu` | Home Manager (generic Linux) | Ubuntu-hosted home profile for `john`, includes desktop/dev tooling and restic backup client settings. | `modules/hosts/john-pc/default.nix` | | `omen-nixos` | NixOS | Omen machine wired through shared `omen-nixos` + `john` modules. | `modules/hosts/omen-nixos/default.nix` | | `soteria` | NixOS + Home Manager | Service node running Forgejo + restic server with mTLS and host-local secrets. | `modules/hosts/soteria/soteria.nix` | | `test-nix` | NixOS (LXC) | Minimal sandbox/test target for validating module composition and remote push/switch flows. | `modules/hosts/test-nix.nix` | ## Layout - Everything under `./modules` gets auto-imported by `import-tree` | Directory | Description | | ------------- | ----------- | | `hosts` | Provides either `homeConfigurations` or `nixosConfigurations` | | `nix-tools` | Nix-specific tools, like factory functions for use in the flakes | | `nixos` | `flake.modules.nixos` | | `programs` | flakes that provide `flake.modules` attributes for specific programs | | `services` | flakes that provide configuration for running services | | `users` | flakes that provide configuration for individual users with the `flake.factory.user` factory | ## Mechanics ### Flake The top-level flake is created using [flake-file](https://flake-file.oeiuwq.com/) ```shell nix flake init -t github:vic/flake-file#default ... nix run ".#write-flake" ``` This uses `inputs.flake-parts.lib.mkFlake` to create the flake. The modules are automatically imported from the `./modules` using [import-tree](https://import-tree.oeiuwq.com/). ### [Home Manager](https://flake.parts/options/home-manager.html) Uses the home-manager module of flake-parts, which is imported in `modules/home-manager/flake-parts.nix` Looks for options: - `flake.homeConfigurations` - `flake.homeModules` Show exported home configurations: ```shell nix eval --apply builtins.attrNames .#homeConfigurations ``` ### Testing These commands would are useful for debugging ```shell SYSTEM=lxc # Just evaluate (fast, catches config errors) nix eval .#nixosConfigurations.${SYSTEM}.config.system.build.toplevel # Full build (slower, produces a bootable system) nix build .#nixosConfigurations.${SYSTEM}.config.system.build.toplevel ``` ### Remote Deploy ```shell nixos-rebuild switch --flake .#lxc --target-host root@fded:fb16:653e:25da:be24:11ff:fea0:753f ```