Skip to content

Nvim migrate dir - #371

Merged
shunkakinoki merged 3 commits into
mainfrom
nvim-migrate-dir
Nov 26, 2025
Merged

Nvim migrate dir#371
shunkakinoki merged 3 commits into
mainfrom
nvim-migrate-dir

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Nov 26, 2025

Copy link
Copy Markdown
Owner

Summary by cubic

Migrated Neovim config to home-manager/programs/neovim to keep everything in one place and simplify local development. Updated Makefile and Home Manager to symlink init.lua and copy a writable nvim-pack-lock.json.

  • Refactors

    • Moved init.lua, nvim-pack-lock.json, and .gitignore to home-manager/programs/neovim/.
    • Removed config/nvim module; merged setup into home-manager/programs/neovim/default.nix.
    • Updated neovim-dev, neovim-sync, and lua-check-neovim Makefile targets to use new paths.
  • Migration

    • Run make switch (or home-manager switch) to apply.
    • For local dev, run make neovim-dev to link files under ~/.config/nvim.
    • No functional changes to Neovim or plugins.

Written for commit 10c9d74. Summary will update automatically on new commits.

Copilot AI review requested due to automatic review settings November 26, 2025 11:54
@shunkakinoki
shunkakinoki enabled auto-merge (squash) November 26, 2025 11:54
@coderabbitai

coderabbitai Bot commented Nov 26, 2025

Copy link
Copy Markdown

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Reorganized Neovim configuration structure and initialization processes.
    • Updated configuration file management and loading mechanisms.

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Neovim configuration was moved from config/nvim/... into home-manager/programs/neovim/.... The Home Manager module was added at the new location (providing an out-of-store symlink for init.lua and an activation step to copy nvim-pack-lock.json), the old module was removed, and Makefile targets were updated to use the new paths.

Changes

Cohort / File(s) Change Summary
Makefile updates
Makefile
Updated targets (neovim-dev, neovim-sync, lua-check-neovim) to reference home-manager/programs/neovim/... instead of config/nvim/...; adjusted symlink, sed/printf, and dofile usages to the new init.lua and nvim-pack-lock.json locations.
Top-level package list
config/default.nix
Removed ./nvim entry from the exported package list.
Removed old Neovim module
config/nvim/default.nix
Deleted: removed home.file.".config/nvim/init.lua" binding, home.activation.copyNvimPackLock activation, and nvimPackLockJson variable and related logic.
New Home Manager Neovim module
home-manager/programs/neovim/default.nix
Added module with signature { config, lib, pkgs, ... }; introduced nvimInitLua = ./init.lua and nvimPackLockJson = ./nvim-pack-lock.json; exposes home.file.".config/nvim/init.lua" as an out-of-store symlink and home.activation.copyNvimPackLock to copy the pack-lock JSON after write boundary.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Makefile as Makefile (dev targets)
  participant HM as Home Manager module
  participant FS as User filesystem (~/.config/nvim)

  Note over Makefile,HM: Updated target paths to use home-manager/programs/neovim

  Makefile->>HM: invoke neovim-dev / neovim-sync / lua-check-neovim
  HM->>FS: create out-of-store symlink -> ~/.config/nvim/init.lua (mkOutOfStoreSymlink)
  HM->>FS: after writeBoundary -> copy ./nvim-pack-lock.json to ~/.config/nvim/nvim-pack-lock.json (chmod 644)
  Note right of FS: Neovim sees new init.lua and pack-lock.json
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Verify behavioral parity between removed config/nvim/default.nix and new home-manager/programs/neovim/default.nix (symlink semantics, permissions, activation ordering).
  • Confirm all Makefile string manipulations (sed/printf) correctly target the new paths and edge cases (spaces, special chars).
  • Check that config.lib.file.mkOutOfStoreSymlink usage is valid in the Home Manager context and that config/lib are available where the module is imported.

Possibly related PRs

Poem

🐇 I hopped through folders, tiny and quick,
Moved init.lua and the pack-lock stick,
From config burrow to home-manager den,
Symlinks set and scripts copied then,
A tidy warren — happy rabbit, hic! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Nvim migrate dir' is vague and lacks specificity about the actual migration scope and objectives. Consider a more descriptive title like 'Migrate Neovim config to home-manager/programs/neovim' to clearly convey the main change.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset by explaining the migration of Neovim configuration, including specific details about moved files, removed modules, and updated Makefile targets.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nvim-migrate-dir

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 57fe015 and 10c9d74.

📒 Files selected for processing (1)
  • home-manager/programs/neovim/default.nix (2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.nix: Use nixfmt for formatting all Nix files
Document complex configurations with comments in Nix files

**/*.nix: Use 2 spaces for indentation in Nix files
Keep line length under 100 characters in Nix files
Sort attribute sets alphabetically in Nix files
Use consistent spacing around operators in Nix files
Format lists and sets consistently in Nix files

Use treefmt.toml for formatting Nix files

**/*.nix: Use mkOption for configurable options in Nix modules
Implement proper typing for all options in Nix modules
Follow the Nix expression language style guide

Files:

  • home-manager/programs/neovim/default.nix
**/default.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use default.nix files for module exports

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/*/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Program configurations should be located in home-manager/programs/<name>/ and use home-manager's built-in modules when available

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/**/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Program configurations must include all necessary dependencies in their configuration

Files:

  • home-manager/programs/neovim/default.nix
home-manager/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

home-manager/**/*.nix: Use typed options whenever possible in Nix configurations
Document all configuration options in Nix modules and programs
Follow home-manager's module structure and keep configurations modular
Use proper indentation and formatting in Nix configuration files

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Follow program-specific best practices in program configuration files

Program configurations in home-manager/programs/ should be organized by program name, include all necessary dependencies, use home.packages for package installations, and use programs.<name> when available in home-manager

Files:

  • home-manager/programs/neovim/default.nix
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/*/default.nix : Program configurations should be located in `home-manager/programs/<name>/` and use home-manager's built-in modules when available
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Follow home-manager's module structure and keep configurations modular
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Keep configurations modular across home-manager, hosts, and nix-darwin directories
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Use proper indentation and formatting in Nix configuration files
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/services/*/default.nix : Service configurations should be located in `home-manager/services/<name>/` with proper service definitions and correct dependency handling
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/modules/*/default.nix : Custom modules must be located in `home-manager/modules/<name>/` and must include a `default.nix` file
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Document all major changes in Nix configurations

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/*/default.nix : Program configurations should be located in `home-manager/programs/<name>/` and use home-manager's built-in modules when available

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/default.nix : Program configurations must include all necessary dependencies in their configuration

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Follow home-manager's module structure and keep configurations modular

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Document all configuration options in Nix modules and programs

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Use proper indentation and formatting in Nix configuration files

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/modules/**/default.nix : Each module in `home-manager/modules/` should have a clear `default.nix` with proper option declarations following the home-manager module structure

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/services/**/default.nix : Service configurations must include proper service definitions, handle dependencies correctly, and document service parameters

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Keep configurations modular across home-manager, hosts, and nix-darwin directories

Applied to files:

  • home-manager/programs/neovim/default.nix
🔇 Additional comments (3)
home-manager/programs/neovim/default.nix (3)

1-6: LGTM!

The additional config and lib arguments are necessary for the new symlink and activation script functionality.


12-18: LGTM!

The configuration properly uses home-manager's built-in programs.neovim module with appropriate settings. The attributes are correctly sorted alphabetically.


20-23: Symlink approach is appropriate for editable init.lua.

Using mkOutOfStoreSymlink allows the init.lua file to remain editable outside the Nix store, which is correct for local development. The force = true is appropriate for the migration scenario.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on reorganizing the Neovim configuration by migrating its files to a more structured home-manager/programs/neovim directory. This change aims to centralize and improve the management of Neovim-related configurations, especially those integrated with Home Manager. The necessary adjustments have been made to the Makefile and Home Manager configuration files to ensure seamless operation with the new directory structure.

Highlights

  • Directory Restructuring: Neovim configuration files, including init.lua, nvim-pack-lock.json, and .gitignore, have been moved from the config/nvim/ directory to a new home-manager/programs/neovim/ location.
  • Makefile Updates: The Makefile targets (neovim-dev, neovim-sync, lua-check-neovim) have been updated to reflect the new paths for the Neovim configuration files, ensuring that build and synchronization processes continue to function correctly.
  • Home Manager Configuration Relocation: The Home Manager configuration for Neovim, previously defined in config/nvim/default.nix, has been moved to home-manager/programs/neovim/default.nix and updated to manage the Neovim files from their new directory.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR migrates the Neovim configuration from a standalone config/nvim directory into the home-manager programs structure at home-manager/programs/neovim.

  • Moved Neovim configuration files from config/nvim/ to home-manager/programs/neovim/
  • Integrated configuration directly into the home-manager neovim module
  • Updated all file path references in the Makefile to point to the new location

Reviewed changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated 2 comments.

File Description
home-manager/programs/neovim/default.nix Added nvim configuration management with symlink creation for init.lua and activation script for nvim-pack-lock.json
config/nvim/default.nix Removed entire file as configuration moved to home-manager
config/default.nix Removed import of ./nvim module
Makefile Updated all references from config/nvim/ to home-manager/programs/neovim/

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

};

home.file.".config/nvim/init.lua" = {
source = config.lib.file.mkOutOfStoreSymlink nvimInitLua;

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The variable nvimInitLua is a relative path (./init.lua), but mkOutOfStoreSymlink requires an absolute path. This will create a broken symlink. Convert nvimInitLua to an absolute path using "${./.}/init.lua" or reference it relative to the module location.

Copilot uses AI. Check for mistakes.
Comment on lines +20 to +24
home.activation.copyNvimPackLock = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
$DRY_RUN_CMD mkdir -p "$HOME/.config/nvim"
$DRY_RUN_CMD cp -f ${nvimPackLockJson} "$HOME/.config/nvim/nvim-pack-lock.json"
$DRY_RUN_CMD chmod 644 "$HOME/.config/nvim/nvim-pack-lock.json"
'';

Copilot AI Nov 26, 2025

Copy link

Choose a reason for hiding this comment

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

The explanatory comment from the original file explaining why this file is copied instead of symlinked (so Neovim can write to it) has been removed. This comment should be preserved as it documents important behavior that's not obvious from the code.

Copilot uses AI. Check for mistakes.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request successfully migrates the Neovim configuration to a new directory structure under home-manager/programs/neovim. The changes across the Makefile and Nix files are consistent with this goal. My review includes suggestions to improve the maintainability of the Makefile by refactoring several targets to use variables, which will reduce code duplication and make future modifications easier.

Comment thread Makefile
Comment on lines +515 to +526
@NVIM_CONFIG="$(PWD)/home-manager/programs/neovim/init.lua"; \
if [ ! -f "$$NVIM_CONFIG" ]; then \
echo "⚠️ Could not find Neovim configuration at $$NVIM_CONFIG"; \
exit 1; \
fi
@echo "📝 Validating Neovim configuration syntax..."
@mkdir -p ~/.config/nvim
@ln -sf "$(PWD)/config/nvim/init.lua" ~/.config/nvim/init.lua
@if [ -f "$(PWD)/config/nvim/nvim-pack-lock.json" ]; then \
ln -sf "$(PWD)/config/nvim/nvim-pack-lock.json" ~/.config/nvim/nvim-pack-lock.json; \
@ln -sf "$(PWD)/home-manager/programs/neovim/init.lua" ~/.config/nvim/init.lua
@if [ -f "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ]; then \
ln -sf "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ~/.config/nvim/nvim-pack-lock.json; \
fi
@nvim --headless -c "lua dofile('$(PWD)/config/nvim/init.lua')" -c "qa" 2>&1; \
@nvim --headless -c "lua dofile('$(PWD)/home-manager/programs/neovim/init.lua')" -c "qa" 2>&1; \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

This target defines a shell variable NVIM_CONFIG in one command block, but subsequent commands that could use it are run in separate shells, making the variable unavailable. This is confusing and potentially error-prone. Additionally, the path to the Neovim directory is repeated. To fix this and improve maintainability, you should combine the commands into a single logical block and use variables consistently.

	@NVIM_DIR="$(PWD)/home-manager/programs/neovim"; \
	NVIM_CONFIG="$$NVIM_DIR/init.lua"; \
	if [ ! -f "$$NVIM_CONFIG" ]; then \
		echo "⚠️  Could not find Neovim configuration at $$NVIM_CONFIG"; \
		exit 1; \
	fi; \
	echo "📝 Validating Neovim configuration syntax..."; \
	mkdir -p ~/.config/nvim; \
	ln -sf "$$NVIM_CONFIG" ~/.config/nvim/init.lua; \
	if [ -f "$$NVIM_DIR/nvim-pack-lock.json" ]; then \
		ln -sf "$$NVIM_DIR/nvim-pack-lock.json" ~/.config/nvim/nvim-pack-lock.json; \
	fi; \
	nvim --headless -c "lua dofile('$$NVIM_CONFIG')" -c "qa" 2>&1; \

Comment thread Makefile
Comment on lines +477 to +478
@ln -sf "$(PWD)/home-manager/programs/neovim/init.lua" "$(HOME)/.config/nvim/init.lua"
@ln -sf "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" "$(HOME)/.config/nvim/nvim-pack-lock.json"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The path to the Neovim configuration directory is repeated. To improve maintainability and reduce redundancy, you can combine these commands into a single logical line and use a shell variable for the directory path.

	@NVIM_DIR="$(PWD)/home-manager/programs/neovim"; \
	ln -sf "$$NVIM_DIR/init.lua" "$(HOME)/.config/nvim/init.lua"; \
	ln -sf "$$NVIM_DIR/nvim-pack-lock.json" "$(HOME)/.config/nvim/nvim-pack-lock.json"

Comment thread Makefile
Comment on lines +492 to 499
@if [ -f "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json" ]; then \
if [ "$$(uname)" = "Darwin" ]; then \
sed -i '' -e '$$ { /^$$/d; }' "$(PWD)/config/nvim/nvim-pack-lock.json"; \
sed -i '' -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
else \
sed -i -e '$$ { /^$$/d; }' "$(PWD)/config/nvim/nvim-pack-lock.json"; \
sed -i -e '$$ { /^$$/d; }' "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
fi && \
printf '\n' >> "$(PWD)/config/nvim/nvim-pack-lock.json"; \
printf '\n' >> "$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The path to nvim-pack-lock.json is repeated multiple times within this target. To improve readability and maintainability, you can store it in a variable at the beginning of the command block.

	@NVIM_PACK_LOCK="$(PWD)/home-manager/programs/neovim/nvim-pack-lock.json"; \
	if [ -f "$$NVIM_PACK_LOCK" ]; then \
		if [ "$$(uname)" = "Darwin" ]; then \
			sed -i '' -e '$$ { /^$$/d; }' "$$NVIM_PACK_LOCK"; \
		else \
			sed -i -e '$$ { /^$$/d; }' "$$NVIM_PACK_LOCK"; \
		fi && \
		printf '\n' >> "$$NVIM_PACK_LOCK"; \
	fi

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
Makefile (2)

470-481: Neovim path migration looks consistent; consider centralizing the base path

The updated symlinks and lockfile handling under home-manager/programs/neovim in neovim-dev and neovim-sync are consistent with the new module location and should behave as before.

Given the same base path $(PWD)/home-manager/programs/neovim is now used in multiple targets, you could optionally introduce a single NVIM_PROG_DIR variable near the top of the Makefile and reference it here to keep future path changes localized.

Also applies to: 488-501


508-534: lua-check-neovim correctly follows the new layout; minor duplication remains

Pointing NVIM_CONFIG and the dofile call at home-manager/programs/neovim/init.lua, plus wiring the temporary symlinks into ~/.config/nvim, all line up with the relocated Neovim module and should keep the check behavior intact.

Same as above, you might factor $(PWD)/home-manager/programs/neovim into a shared Make variable to avoid repeating the literal path in multiple Neovim targets.

home-manager/programs/neovim/default.nix (1)

1-5: Neovim HM module wiring looks good; clarify mkOutOfStoreSymlink intent

This module cleanly moves Neovim setup into home-manager/programs/neovim, uses programs.neovim rather than rolling a custom module, and wires the lockfile via home.activation, which aligns with the home-manager guidelines.

One subtle point: mkOutOfStoreSymlink is being called with nvimInitLua = ./init.lua;. With a flake-based setup, ./init.lua is typically realized as a Nix store path, so the resulting symlink will still ultimately point into the store rather than to a mutable file in your working tree. If your intent is to have a truly out-of-store, live-editable init.lua (similar to the activation-based handling of nvim-pack-lock.json), you may want to instead pass an absolute path string under $HOME (e.g. derived from config.home.homeDirectory) or manage the symlink in a small home.activation script, and reserve plain source = ./init.lua; for the immutable/store-backed case.

As-is this will work functionally, but it may not deliver the “edit without rebuild” behavior often expected from mkOutOfStoreSymlink, so it’s worth double-checking the intended semantics.

As per coding guidelines and common home-manager best practices.

Also applies to: 15-24

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2dfd14a and 57fe015.

📒 Files selected for processing (4)
  • Makefile (3 hunks)
  • config/default.nix (0 hunks)
  • config/nvim/default.nix (0 hunks)
  • home-manager/programs/neovim/default.nix (2 hunks)
💤 Files with no reviewable changes (2)
  • config/default.nix
  • config/nvim/default.nix
🧰 Additional context used
📓 Path-based instructions (6)
**/*.nix

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.nix: Use nixfmt for formatting all Nix files
Document complex configurations with comments in Nix files

**/*.nix: Use 2 spaces for indentation in Nix files
Keep line length under 100 characters in Nix files
Sort attribute sets alphabetically in Nix files
Use consistent spacing around operators in Nix files
Format lists and sets consistently in Nix files

Use treefmt.toml for formatting Nix files

**/*.nix: Use mkOption for configurable options in Nix modules
Implement proper typing for all options in Nix modules
Follow the Nix expression language style guide

Files:

  • home-manager/programs/neovim/default.nix
**/default.nix

📄 CodeRabbit inference engine (CLAUDE.md)

Use default.nix files for module exports

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/*/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Program configurations should be located in home-manager/programs/<name>/ and use home-manager's built-in modules when available

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/**/default.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Program configurations must include all necessary dependencies in their configuration

Files:

  • home-manager/programs/neovim/default.nix
home-manager/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

home-manager/**/*.nix: Use typed options whenever possible in Nix configurations
Document all configuration options in Nix modules and programs
Follow home-manager's module structure and keep configurations modular
Use proper indentation and formatting in Nix configuration files

Files:

  • home-manager/programs/neovim/default.nix
home-manager/programs/**/*.nix

📄 CodeRabbit inference engine (.cursor/rules/home-manager.mdc)

Follow program-specific best practices in program configuration files

Program configurations in home-manager/programs/ should be organized by program name, include all necessary dependencies, use home.packages for package installations, and use programs.<name> when available in home-manager

Files:

  • home-manager/programs/neovim/default.nix
🧠 Learnings (13)
📓 Common learnings
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/*/default.nix : Program configurations should be located in `home-manager/programs/<name>/` and use home-manager's built-in modules when available
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Follow home-manager's module structure and keep configurations modular
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Keep configurations modular across home-manager, hosts, and nix-darwin directories
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Use proper indentation and formatting in Nix configuration files
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/services/*/default.nix : Service configurations should be located in `home-manager/services/<name>/` with proper service definitions and correct dependency handling
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/programs/**/*.nix : Program configurations in `home-manager/programs/` should be organized by program name, include all necessary dependencies, use `home.packages` for package installations, and use `programs.<name>` when available in home-manager

Applied to files:

  • Makefile
  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Document all major changes in Nix configurations

Applied to files:

  • Makefile
  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/*.nix : Follow program-specific best practices in program configuration files

Applied to files:

  • Makefile
  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Test Nix and home-manager configurations locally before pushing using `make test`

Applied to files:

  • Makefile
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Test configurations before committing using `nix flake check` and `home-manager build --show-trace`

Applied to files:

  • Makefile
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Follow home-manager's module structure and keep configurations modular

Applied to files:

  • Makefile
  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/*/default.nix : Program configurations should be located in `home-manager/programs/<name>/` and use home-manager's built-in modules when available

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Document all configuration options in Nix modules and programs

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/programs/**/default.nix : Program configurations must include all necessary dependencies in their configuration

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:35:01.066Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/nix.mdc:0-0
Timestamp: 2025-11-25T09:35:01.066Z
Learning: Applies to home-manager/modules/**/default.nix : Each module in `home-manager/modules/` should have a clear `default.nix` with proper option declarations following the home-manager module structure

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:55.014Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/home-manager.mdc:0-0
Timestamp: 2025-11-25T09:34:55.014Z
Learning: Applies to home-manager/**/*.nix : Use proper indentation and formatting in Nix configuration files

Applied to files:

  • home-manager/programs/neovim/default.nix
📚 Learning: 2025-11-25T09:34:40.062Z
Learnt from: CR
Repo: shunkakinoki/dotfiles PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-25T09:34:40.062Z
Learning: Keep configurations modular across home-manager, hosts, and nix-darwin directories

Applied to files:

  • home-manager/programs/neovim/default.nix
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (13)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Mesa Review
  • GitHub Check: Mesa Description
  • GitHub Check: nix-linux
  • GitHub Check: nix-nixos
  • GitHub Check: nix-darwin
  • GitHub Check: lua-hammerspoon
  • GitHub Check: docker-build-push (linux/amd64, amd64, ubuntu-latest)
  • GitHub Check: lua-neovim
  • GitHub Check: e2e-run (NixOS, ubuntu-latest)
  • GitHub Check: e2e-run (Ubuntu, ubuntu-latest)
  • GitHub Check: e2e-run (MacOS, macos-latest)
  • GitHub Check: docker-build-push (linux/arm64, arm64, ubuntu-24.04-arm)

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 7 files

@mesa-dot-dev

mesa-dot-dev Bot commented Nov 26, 2025

Copy link
Copy Markdown

Mesa Description

TL;DR

Migrated Neovim configuration to home-manager/programs/neovim for better organization and simplified local development.

What changed?

  • Makefile: Updated Neovim configuration paths from config/nvim/ to home-manager/programs/neovim/ for neovim-dev, neovim-sync, and lua-check-neovim targets.
  • config/default.nix: Removed the ./nvim configuration import.
  • config/nvim/default.nix: This file was entirely removed.
  • home-manager/programs/neovim/default.nix: Updated to manage init.lua (symlinked to ~/.config/nvim/init.lua) and nvim-pack-lock.json (copied to ~/.config/nvim/nvim-pack-lock.json).

Description generated by Mesa. Update settings

@mesa-dot-dev mesa-dot-dev Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Performed full review of 2dfd14a...57fe015

Analysis

  1. Incorrect use of mkOutOfStoreSymlink with let-bound variables - Using ./init.lua through a let binding causes Nix to evaluate it to a store path prematurely, breaking the out-of-store symlink mechanism that enables live editing without rebuilds.

  2. Verify file movements - While the migration path looks clean, the diff doesn't explicitly show the movement of init.lua and nvim-pack-lock.json files to the new location. This should be verified.

  3. Inconsistent configuration patterns across similar tools - While this migration creates a cleaner unified pattern for Neovim (which is good), it creates a third pattern in the codebase. Consider similar migrations for starship and direnv which currently have split configurations.

  4. Missing documentation - The architectural distinction between when to use config/ vs home-manager/programs/ should be documented to prevent future inconsistencies.

Tip

Help

Slash Commands:

  • /review - Request a full code review
  • /review latest - Review only changes since the last review
  • /describe - Generate PR description. This will update the PR body or issue comment depending on your configuration
  • /help - Get help with Mesa commands and configuration options

4 files reviewed | 0 comments | Edit Agent SettingsRead Docs

@shunkakinoki
shunkakinoki merged commit 17d5b2a into main Nov 26, 2025
25 checks passed
@shunkakinoki
shunkakinoki deleted the nvim-migrate-dir branch November 26, 2025 12:38
@coderabbitai coderabbitai Bot mentioned this pull request Nov 28, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Jan 28, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Mar 19, 2026
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