Skip to content

feat(shell): add psql and pinned nvm via Home Manager - #25

Merged
menil merged 1 commit into
mainfrom
feat/psql-nvm
Oct 26, 2026
Merged

menil merged 1 commit into
mainfrom
feat/psql-nvm

Conversation

@menil

@menil menil commented Oct 26, 2026

Copy link
Copy Markdown
Owner

🧠 AI Decision Record: View Architecture & Reasoning on GitHub

Summary

  • Add postgresql to home.packages so psql is available.
  • Pin nvm v0.40.8 with pkgs.fetchFromGitHub, since it is not packaged in nixpkgs or Home Manager, and expose it through a stable symlink at ~/.local/share/nvm-sh.
  • In .zshrc, set NVM_DIR=~/.nvm (writable, created on demand) and source nvm.sh and bash_completion from the pinned symlink.

Why this shape

The pinned nvm scripts live in the read-only Nix store, so installed Node versions need a separate writable NVM_DIR. The stable symlink keeps .zshrc independent of the store hash. Sourcing is guarded so shells start cleanly before the profile is activated.

Files

  • modules/shell.nix: postgresql package, nvmSrc pin, home.file symlink
  • src/home/.zshrc: NVM_DIR setup and nvm sourcing

Validation

nix-shell --run "just validate" passes (shellcheck, markdownlint, statix, nix flake check, nixpkgs-fmt, shfmt).

Install postgresql to provide psql, and pin nvm v0.40.8 through
fetchFromGitHub since nvm is not packaged in nixpkgs.

The pinned scripts are symlinked read-only into ~/.local/share/nvm-sh,
while NVM_DIR points at a writable ~/.nvm so installed Node versions
work.

AI-Reasoning: https://github.com/menil/dotfiles/blob/ai-reasoning/feat-psql-nvm.md

@github-actions github-actions 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.

Code Review Summary

Needs Attention (0 issues)

Suggestions (1 items)

  1. [Maintainability] Use nixpkgs nvm wrapper (LOW impact, LOW effort)
    While the author mentions nvm is not packaged, many modern nixpkgs versions provide pkgs.nvm. It may be worth double-checking the channel version to avoid manual pinning of the GitHub source.

All Clear

  • Correctness & Logic
  • Static Analysis & Types
  • Security
  • Quality & Style
  • Performance
  • PII Detection

Verdict: Ready to Merge

The implementation correctly handles the read-only nature of the Nix store by separating the nvm scripts from the writable NVM_DIR.

@menil

menil commented Oct 26, 2026

Copy link
Copy Markdown
Owner Author

Thanks for the review. I checked the nixpkgs revision pinned in flake.lock for aarch64-darwin and it has no nvm (or nvm-sh) attribute, so there is no packaged nvm to use here. Keeping the fetchFromGitHub pin at v0.40.8. I'll revisit if nixpkgs adds the package.

@menil
menil merged commit 388dcbf into main Oct 26, 2026
4 checks passed
@menil
menil deleted the feat/psql-nvm branch October 26, 2026 16:52
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.

1 participant