Skip to content

Conversation

Sewer56
Copy link

@Sewer56 Sewer56 commented Aug 22, 2025

Description

This brings the new claude-code home-manager settings on par in functionality with claude-code-nix-flake.

Originally claude-code-nix-flake was built in mind with upstreaming to home-manager; it's just that I've waited till claude-code worked with symlinks, since that was broken for a long time. Now, this can be upstreamed.

In this case, I've merged the additional settings from the above flake of mine into upstream claude-code.

PS. This is easier to review commit by commit,

Checklist

  • Change is backwards compatible.

  • Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

CC. @khaneliman

What do you think we should do with claude.json? It does have some tunable options a person may want to touch such as:

"autoUpdates": false,
"theme": "dark-daltonized",
"isQualifiedForDataSharing": false,
"hasCompletedOnboarding": true,
"bypassPermissionsModeAccepted": true,
"hasUsedBackslashReturn": true,
"hasOpusPlanDefault": false,

Which a user may want to touch.
(Also mcpServers, but we found a way around this one by wrapping the CLI).

Problem is, claude-code mutates this file, so we can't really symlink it into read-only nix store.
In claude-code-nix-flake; I would merge settings into the existing file; just like I did with others until claude code fixed symlinks. However, I'm not sure how acceptable that is by upstream home-manager standards.

@home-manager-ci home-manager-ci bot requested a review from khaneliman August 22, 2025 21:35
@Sewer56 Sewer56 force-pushed the claude-code-extras branch from a3912b7 to 0a1f01b Compare August 22, 2025 21:36
@Sewer56 Sewer56 mentioned this pull request Aug 22, 2025
9 tasks
Comment on lines 209 to 236
agentsDir = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Path to a directory containing agent files for Claude Code.
Agent files from this directory will be symlinked to .claude/agents/.
'';
example = lib.literalExpression ./agents;
};

commandsDir = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Path to a directory containing command files for Claude Code.
Command files from this directory will be symlinked to .claude/commands/.
'';
example = lib.literalExpression ./commands;
};

hooksDir = lib.mkOption {
type = lib.types.nullOr lib.types.path;
default = null;
description = ''
Path to a directory containing hook files for Claude Code.
Hook files from this directory will be symlinked to .claude/hooks/.
'';
example = lib.literalExpression ./hooks;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dir options remind me that I had the intention of refactoring sourceFileOrLines option so I could just change the type of the corresponding options. I have a branch for it, but just haven't gotten to it, yet. Because, I'd rather have the option support either a directory, an attrset of files, or attrset of lines, etc

@Sewer56 Sewer56 force-pushed the claude-code-extras branch from 2a24d34 to 12b8f77 Compare August 22, 2025 22:10
@Sewer56
Copy link
Author

Sewer56 commented Aug 22, 2025

Do you think linking the fields to their relevant options in https://docs.anthropic.com/en/docs/claude-code would be helpful?
There's always the risk of the URLs changing, but I figured I'd note the possibility.

@Sewer56
Copy link
Author

Sewer56 commented Aug 22, 2025

In any case, just tried on own fully featured config, seems to work fine thus far 👌

@Sewer56
Copy link
Author

Sewer56 commented Aug 27, 2025

Anything I can do to help in merging this into home-manager?
I'd prefer to work with upstream, rather than forking whenever possible.

@khaneliman
Copy link
Collaborator

Anything I can do to help in merging this into home-manager? I'd prefer to work with upstream, rather than forking whenever possible.

Sorry, just really busy with work lately... has slowed down my ability to do as much open source atm. I have a branch that I'm working through reworking the type for an option to support lines, paths, or directories. I just didn't want to introduce new options that would get deprecated right away.

@Sewer56
Copy link
Author

Sewer56 commented Aug 29, 2025

Don't worry, I feel you- I know what it's like.

My commit graph is about the same as yours- so it's always really an endless, neverending laundry list. I alone got like 3 years worth of projects in the pipeline, ahahaha.

Take your time! I asked just in case there was a separate, unrelated blocker. I'm perfectly fine just merging maim every once in a while to update for the time being.

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