aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <tom@vanderlee.io>2026-09-17 11:49:58 +0200
committerGravatar Tom van der Lee <tom@vanderlee.io>2026-09-17 11:49:58 +0200
commit41db5fc767fbe5a5453b2fa0583de8c3b2cf4021 (patch)
tree53c9f545c7e5bdbb57ec5e625edc54fb8da3d208 /README.md
parentf793f76e26b461c3228c69926d82bf950aaac671 (diff)
downloaddesktop-flake-41db5fc767fbe5a5453b2fa0583de8c3b2cf4021.tar.gz
desktop-flake-41db5fc767fbe5a5453b2fa0583de8c3b2cf4021.tar.bz2
desktop-flake-41db5fc767fbe5a5453b2fa0583de8c3b2cf4021.zip
Add automatic dotfiles clone + stow
modules/home/dotfiles.nix clones ~/dotfiles on activation (only if not already present) and stows every top-level package directory into $HOME, independently per package so one conflict doesn't block the rest. Removes home-manager's own git config management in favor of letting the stowed ~/dotfiles/git/.gitconfig own it, and adds homeConfigurations."tom@darwin" so the feature is usable on this Mac. users/tom.nix now points home.dotfiles.repoUrl at the real repo.
Diffstat (limited to 'README.md')
-rw-r--r--README.md19
1 files changed, 16 insertions, 3 deletions
diff --git a/README.md b/README.md
index 3688c88..13c8be2 100644
--- a/README.md
+++ b/README.md
@@ -7,10 +7,11 @@ A single Nix flake for provisioning both NixOS hosts and non-NixOS systems (any
7- `flake.nix` — inputs (`nixpkgs`, `home-manager`) and outputs (`nixosConfigurations`, `homeConfigurations`, `formatter`, `devShells`) 7- `flake.nix` — inputs (`nixpkgs`, `home-manager`) and outputs (`nixosConfigurations`, `homeConfigurations`, `formatter`, `devShells`)
8- `lib/` — `mkNixos` and `mkHome` helper functions that build `nixosConfigurations` / `homeConfigurations` entries 8- `lib/` — `mkNixos` and `mkHome` helper functions that build `nixosConfigurations` / `homeConfigurations` entries
9- `modules/nixos/common.nix` — shared NixOS-only system settings applied to every NixOS host 9- `modules/nixos/common.nix` — shared NixOS-only system settings applied to every NixOS host
10- `modules/home/` — the shared, cross-platform home-manager profile (shell, git, editor, CLI tools). The same modules are consumed whether activated via a NixOS host's home-manager module or standalone `home-manager switch` 10- `modules/home/` — the shared, cross-platform home-manager profile (shell, editor, CLI tools, dotfiles). The same modules are consumed whether activated via a NixOS host's home-manager module or standalone `home-manager switch`
11- `users/tom.nix` — identity/profile file consumed by both `mkNixos` and `mkHome` 11- `users/tom.nix` — identity/profile file consumed by both `mkNixos` and `mkHome`
12- `hosts/template/` — a copy-source-only NixOS host skeleton; **never** wired into `flake.nix` outputs directly (excluded from discovery by name — see below). Copy it via `scripts/bootstrap-host.sh` (or `nix run .#bootstrap-host`) when provisioning a real machine 12- `hosts/template/` — a copy-source-only NixOS host skeleton; **never** wired into `flake.nix` outputs directly (excluded from discovery by name — see below). Copy it via `scripts/bootstrap-host.sh` (or `nix run .#bootstrap-host`) when provisioning a real machine
13- `scripts/bootstrap-host.sh` — scaffolds a new `hosts/<hostname>/` from the template; exposed as `apps.<system>.bootstrap-host` 13- `scripts/bootstrap-host.sh` — scaffolds a new `hosts/<hostname>/` from the template; exposed as `apps.<system>.bootstrap-host`
14- `modules/home/dotfiles.nix` — opt-in personal dotfiles automation (see below)
14 15
15Any directory under `hosts/` other than `hosts/template` that contains a `system` file automatically becomes a real `nixosConfigurations.<name>` output — adding a host means dropping in a directory, not editing `flake.nix`. 16Any directory under `hosts/` other than `hosts/template` that contains a `system` file automatically becomes a real `nixosConfigurations.<name>` output — adding a host means dropping in a directory, not editing `flake.nix`.
16 17
@@ -34,14 +35,26 @@ This flake does not partition disks for you — do that first, with the standard
34 35
35## Installing on a non-NixOS system (any Linux, or macOS once supported) 36## Installing on a non-NixOS system (any Linux, or macOS once supported)
36 37
37Non-NixOS hosts are unaffected by `bootstrap-host` — there's nothing per-host to scaffold, since `homeConfigurations."tom@linux"` is one generic entry shared by every standalone machine. 38Non-NixOS hosts are unaffected by `bootstrap-host` — there's nothing per-host to scaffold. `homeConfigurations` has one generic entry per platform (`tom@linux` for x86_64-linux, `tom@darwin` for aarch64-darwin), shared by every standalone machine of that platform.
38 39
391. Install Nix. Recommended: the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer) (flakes enabled by default). The official installer also works, but you'll need to add `experimental-features = nix-command flakes` to `nix.conf` yourself. 401. Install Nix. Recommended: the [Determinate Systems installer](https://github.com/DeterminateSystems/nix-installer) (flakes enabled by default). The official installer also works, but you'll need to add `experimental-features = nix-command flakes` to `nix.conf` yourself.
402. `git clone <your-remote-url> ~/nix-config`. 412. `git clone <your-remote-url> ~/nix-config`.
413. First run: `nix run home-manager/master -- switch --flake ~/nix-config#tom@linux`. After that, `home-manager switch --flake ~/nix-config#tom@linux` works directly. 423. First run: `nix run home-manager/master -- switch --flake ~/nix-config#tom@linux` (or `#tom@darwin` on macOS). After that, `home-manager switch --flake ~/nix-config#tom@linux` (or `#tom@darwin`) works directly.
42 43
43This only touches your home directory — no sudo required. 44This only touches your home directory — no sudo required.
44 45
46## Personal dotfiles (opt-in)
47
48`modules/home/dotfiles.nix` can automatically clone a separate personal dotfiles repo to `~/dotfiles` and symlink its top-level package directories into `$HOME`, GNU-Stow style (each package directory's contents mirror their target path — e.g. a package's `.gitconfig` links to `~/.gitconfig`). It's opt-in and controlled by a single option:
49
50```nix
51home.dotfiles.repoUrl = "https://example.com/your/dotfiles.git";
52```
53
54`users/tom.nix` sets this to `https://git.tomvanderlee.com/dotfiles` — the feature is active as soon as this flake is activated with `home-manager switch`.
55
56Behavior notes: an existing `~/dotfiles` checkout is never re-cloned or modified; every non-hidden top-level directory is treated as a stow package; one package's conflict with an existing file only skips that package (a warning is printed) rather than blocking the rest. Because `~/dotfiles/git/.gitconfig` is expected to be the sole source of git configuration once stowed, this repo's own `programs.git` home-manager management has been removed — `git` itself is still installed via `modules/home/cli-tools.nix` regardless of whether `repoUrl` is set.
57
45## Development 58## Development
46 59
47- `nix fmt` — format all `.nix` files with `nixfmt-rfc-style`. 60- `nix fmt` — format all `.nix` files with `nixfmt-rfc-style`.