Repository navigation
feat(nvf,nixvim): keep each Neovim in a profile that its parent activates - #104
Merged
Merged
Conversation
clhodapp
force-pushed
the
feat/editor-profiles
branch
2 times, most recently
from
October 18, 2026 06:38
7bb876d to
c94c06c
Compare
clhodapp
force-pushed
the
feat/editor-profiles
branch
from
October 18, 2026 07:54
c94c06c to
df0743a
Compare
clhodapp
force-pushed
the
feat/editor-profiles
branch
2 times, most recently
from
October 18, 2026 08:27
7706bbb to
901dc7b
Compare
clhodapp
force-pushed
the
feat/editor-profiles
branch
from
October 18, 2026 17:35
901dc7b to
be7d562
Compare
…ates An nvf or nixvim configuration declared inside a machine, a home or a hjem configuration relates to that configuration as a home relates to its machine: it has an activation of its own, which the configuration above runs each time it is activated itself. `lib.caisson.integrations.profileOf` gives such a configuration the outputs `activationPackage` and `profile`. `activate` checks for drift against the nearest configuration above with an activation, and points a Nix profile at the Neovim with `nix-env --profile`, which also makes the profile a garbage-collector root; it adds no generation when the profile already points there. Inside a machine the profile is a profile of the system, `/nix/var/nix/profiles/caisson/<kind>/<name>`; inside a home or a hjem configuration, or at a top, it is a profile of the user, `$HOME/.local/state/caisson/profiles/<kind>/<name>`. The home marker moves under `$HOME/.local/state` as well, since a unit of the machine and a shell may see `$XDG_STATE_HOME` differently. Each class has a `profile-activation` module in its `default` module: - nixos and systemManager: a unit per profile wanted by `multi-user.target`, run as root for a profile of the system, and as the user after `hjem-activate@<user>` for a profile inside a hjem configuration, whose own activation has no step to add; - darwin: steps of `postActivation`, the same way; - homeManager: an activation step after the files are linked and the marker is written, so `home-manager switch`, a switch of the machine and a boot all put the profile back; - hjem: the programs and the variable below. Each also installs `profileShimsOf`: `nvim` (and `vi`, `vim` where the Neovim has them) runs the profile `$CAISSON_NVIM_PROFILE` names, read each time it runs, and the default of the configuration when it is unset. A home or a hjem configuration sets the variable to its own profile, and a shell can `export` another. Where several profiles share the variable, `caisson.profiles.selected` names the default. nvf and nixvim get a `default` module declaring `caisson.drift.warn`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hjem is pronounced with a leading "y" sound, so it takes "a". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
clhodapp
force-pushed
the
feat/editor-profiles
branch
from
October 18, 2026 18:04
be7d562 to
38faaa2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
An nvf or nixvim configuration declared inside a machine, a home or a hjem configuration now relates to that configuration the way a home relates to its machine. It has an activation of its own, which the configuration above runs each time it is activated itself.
Stacked on #103, whose drift check every profile runs.
The profile
lib.caisson.integrations.profileOfgives the configuration the outputsactivationPackageandprofile.activatechecks for drift against the nearest configuration above with an activation. It then points a Nix profile at the Neovim withnix-env --profile, which also registers a garbage-collector root. When the profile already points at that Neovim, it adds no generation./nix/var/nix/profiles/caisson/<kind>/<name>caisson-profile-<kind>-<name>, as root, wanted bymulti-user.targetpostActivationstep, as root$HOME/.local/state/caisson/profiles/<kind>/<name>linkGenerationcaisson-profile-<user>-<kind>-<name>, as the user, afterhjem-activate@<user>activateby handEvery activation of the configuration above puts the profile back to what that configuration declares. That covers
home-manager switch, a switch of the machine, and a boot, since the machine activates its homes and profiles at boot.Choosing a profile
Each class installs
profileShimsOf:nvim, plusviandvimwhere the Neovims have them. Each runs the profile named by$CAISSON_NVIM_PROFILE, read every time it runs, and the configuration's default when the variable is unset. A home or a hjem configuration sets the variable to its own profile, and a shell canexportanother value. Where several profiles share the variable,caisson.profiles.selectednames the default, and evaluation fails until it does.Other changes (pre-1.0)
defaultmodule declaringcaisson.drift.warn.$HOME/.local/state. A unit of the machine and a shell of the user may see$XDG_STATE_HOMEdifferently, and both must find the same file. User profiles use the same prefix for the same reason.Testing
nix flake checkpasses, including the unit tests, the pinned-world suite and the eval-weight gate.neovimConfigurationbuilds.$HOME:activatecreates the profile at the right Neovim;activateadds no generation;nix-env --set, the nextactivateputs the profile back, and the history keeps all three generations;nvimshim runs the profile the variable names, and the default when it is unset.nix flake check --no-buildpasses in all 17 workspace consumers with this branch in place of both caisson pins: ch-home-manager and ch-personal-machines onfix/activation-drift(their maint: update flake pins #17 and refactor(nixpkgs): registries are read from caisson-core by the name of the mkLib argument #59), ch-system-manager ontest/system-manager-configurations(refactor: nixos-minimal as its own integration over the nixos class #15), the others onmain.Not covered yet
hjem standalone switchdoesn't activate its profiles. Inside a machine, the machine does.Docs: nix-caisson/nix-caisson.github.io, branch
docs/editor-profiles.🤖 Generated with Claude Code