Skip to content

fix(nix): defer programs.worktrunk to home-manager's own module - #4788

Merged
max-sixty merged 3 commits into
mainfrom
agent-a5b13cbd747ead5d5
Nov 14, 2026
Merged

max-sixty merged 3 commits into
mainfrom
agent-a5b13cbd747ead5d5

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

home-manager master now declares programs.worktrunk itself (merged in September, shipping from release 26.11), so importing this flake's homeModules.default alongside it fails with "The option programs.worktrunk.enable' … is already declared". homeModules.defaultnow defers to home-manager's module and only defaults itspackageto this flake's build; on releases without that module (26.05 and older) it importsnix/home-manager-module.nixas before, so nobody's evaluation breaks. The flake package also installs the agent skills undershare/skills/worktrunk/, where home-manager's claudeCodeIntegration` links them from and fails the build without them.

Worth weighing: the legacy import and module are temporary, with a comment to delete them once home-manager 26.05 is end-of-life, about the end of December. A new home-module flake check evaluates the module under stubs of both home-manager layouts, since nix flake check never ran homeModules through the module system.

viicslen hit the clash in viicslen-nix/nixos. Requested by max-sixty. Reproduced on main and checked in a nixos/nix container against real home-manager master and release-26.05: both evaluate with the flake's build as the default, and a user's own package wins. nix flake check --no-build --all-systems passes, and each new assertion fails against a broken module; the full flake build runs in the nightly job this PR triggers.

This was written by Claude Code on behalf of max-sixty

home-manager master declares programs.worktrunk itself, so importing this
flake's homeModules.default under it fails with "The option
`programs.worktrunk.enable' ... is already declared". Our module declared
a subset of the same options (enable, package, and the four shell
integrations, with the same shell init), and home-manager's adds settings
and claudeCodeIntegration. The one thing ours added was a package default
pointing at this flake's build.

homeModules.default now sets programs.worktrunk.package to this flake's
worktrunk with mkDefault, so a user's own setting still wins. It imports
nix/home-manager-module.nix only when home-manager's modulesPath lacks
programs/worktrunk.nix, which is every release before 26.11. Imports keep
working on both sides: home-manager master and 26.11 onward use their own
module, and 26.05 and older keep ours, with the same package and shell
integration as before. A comment on the import says when to delete it.
When home-manager ships the module but doesn't load it (disabledModules, or
minimal mode), the import fails with a message saying how to load it.

A home-module flake check evaluates both paths against stand-ins for
home-manager, since `nix flake check` doesn't run homeModules through the
module system.
home-manager's programs.worktrunk.claudeCodeIntegration links the
worktrunk and wt-switch-create skills from the package's
share/skills/worktrunk/, where nixpkgs' installAgentSkills hook puts them;
wt-switch-create is on whenever claudeCodeIntegration is. This flake's
package installed no skills, so with it as programs.worktrunk.package,
which homeModules.default sets, enabling claudeCodeIntegration failed the
build with "Claude Code skill source ... is neither a file nor a
directory".

The package now copies the repo-root skills/ into that layout, and the
source filter keeps skills/ directories. The locked nixpkgs predates
installAgentSkills, so a postInstall does the copy.
@max-sixty
max-sixty merged commit ff747b9 into main Nov 14, 2026
42 checks passed
@max-sixty
max-sixty deleted the agent-a5b13cbd747ead5d5 branch November 14, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants