Skip to content

Conversation

@mirkolenz
Copy link
Member

Description

Add module for configuring .npmrc via home manager. Inspired by the NixOS module.

I'm not sure if the tests are set up correctly. Since the package is a nested attrset, I didn't use a stub, but set the package to null instead. Please let me know if there's a better way to handle this.

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

@mirkolenz
Copy link
Member Author

mirkolenz commented Dec 9, 2025

OK, I think I found an elegant solution: I created a custom ini generation function which automatically appends square brackets to list values. I renamed the option from npmrc to settings with a proper type and updated the tests by adding an array-based entry.

One thing I changed as well compared to the last iteration: The package option now installs the nodejs package because at least on my system, using pkgs.nodePackages.npm or pkgs.nodejs.pkgs.npm resulted in a full rebuild of the nodejs package (which is expensive). It also seems to be the case that pkgs.nodePackages_xx is no longer available and just not updated in the upstream NixOS module.

Let me know what you think 😄

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.

3 participants