# Can I add libraries with no dependents \_inside\_ nixpkgs?

**URL:** https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396
**Category:** Documentation
**Created:** [July 4, 2025, 1:53pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396 "2025-07-04T13:53:00Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jherland](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jherland/32/8755_2.png) [@jherland](https://discourse.nixos.org/u/jherland)
#### Post date: [July 4, 2025, 1:53pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/1 "2025-07-04T13:53:00Z")

</div>

Hi, as part of helping a client upstream suitable parts of their nixpkgs overlay, I’m adding some new packages to nixpkgs.

Some of these packages are libraries that (as of now) have no users/dependents inside nixpkgs, but are being used within the client’s (proprietary) code base. (For the record, I’m adding myself as a maintainer to all the new packages I’m adding, and I’m happy to remain their maintainer for the foreseeable future.)

Examples:

- [https://github.com/NixOS/nixpkgs/pull/417794](https://github.com/NixOS/nixpkgs/pull/417794)
- [cnpypp: init at 0-unstable-2025-06-22 by jherland · Pull Request #422095 · NixOS/nixpkgs · GitHub](https://github.com/NixOS/nixpkgs/pull/422095)

However, I’ve since discovered [this recent addition](https://github.com/NixOS/nixpkgs/pull/405187/files) to the documentation, specifically this sentence:

> Library packages should have at least one dependent.

It is not clear to me whether this refers to dependents _inside_ nixpkgs, or if dependents in downstream forks/overlays are sufficient?

---

<div class="post-metadata">

### Author: ![rhendric](https://discourse.nixos.org/user_avatar/discourse.nixos.org/rhendric/32/5699_2.png) [@rhendric](https://discourse.nixos.org/u/rhendric)
#### Post date: [July 4, 2025, 2:33pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/2 "2025-07-04T14:33:08Z")

</div>

> [@jherland](#):
>
> this refers to dependents _inside_ nixpkgs

That’s my interpretation. The intent of that line in the context of its PR is to keep Nixpkgs free of libraries that become insecure due to a lack of attention. It’s only a ‘should’; perhaps if you can make a strong case that your client will maintain this library diligently despite no in-tree dependencies forcing the issue, I’d let it slide. But otherwise, I think that one client having a proprietary application that uses this library is a pretty central example of ‘niche’. If they go poof or just stop using this dependency, who’d know? How would any issues get caught? At least with an obscure OSS leaf application, someone else could come around and pick it up if the original maintainer loses interest.

---

<div class="post-metadata">

### Author: ![bme](https://discourse.nixos.org/letter_avatar_proxy/v4/letter/b/d2c977/32.png) [@bme](https://discourse.nixos.org/u/bme)
#### Post date: [July 4, 2025, 10:12pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/3 "2025-07-04T22:12:02Z")

</div>

I definitely question the inclusion, I also question the wisdom for your client: surely it’s better for them to maintain control of it by keeping it in their own tree / overlay? I get that these libs are relatively unmaintained but if new versions / patches are produced on whose schedule do they want to take those patches?

Also if they cease to be your client do you intend to keep maintaining it for free forever? Why should the nixpkgs cache bandwidth / ci minutes be spent on this?

---

<div class="post-metadata">

### Author: ![Pandapip1](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pandapip1/32/17982_2.png) [@Pandapip1](https://discourse.nixos.org/u/Pandapip1)
#### Post date: [July 14, 2025, 8:14pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/4 "2025-07-14T20:14:37Z")

</div>

Hi! I’m the one that originally suggested that line. My intent was any dependents, not just those in nixpkgs. It was meant to be an easy answer for libraries to satisfy the “How realistic is it that it will be used by other people?” criterion: if the library _is_ being used, then the answer is definitely yes. If it isn’t, then the answer is almost certainly no.

However, if you don’t have any dependents inside nixpkgs, you _should_ write a basic program with basic functionality as a test, so you can catch any breakages. This isn’t a requirement, nor is it documented anywhere, but it is best practice.

---

<div class="post-metadata">

### Author: ![jherland](https://discourse.nixos.org/user_avatar/discourse.nixos.org/jherland/32/8755_2.png) [@jherland](https://discourse.nixos.org/u/jherland)
#### Post date: [July 15, 2025, 7:40am UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/5 "2025-07-15T07:40:33Z")

</div>

Thank you for your feedback! I certainly agree we don’t want unused or broken libraries in nixpkgs.

For the libraries I’m adding, I make sure they come with tests that exercise the library’s functionality, and that these tests are run in the checkPhase. This does not technically count as a separate dependent in nixpkgs, I guess, but I hope it still follows the best practice.

---

<div class="post-metadata">

### Author: ![Pandapip1](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pandapip1/32/17982_2.png) [@Pandapip1](https://discourse.nixos.org/u/Pandapip1)
#### Post date: [July 15, 2025, 3:31pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/6 "2025-07-15T15:31:43Z")

</div>

Opened a clarifying PR:

> <https://github.com/NixOS/nixpkgs/pull/425473>
>
> There was some unintentional ambiguity in the way this was phrased (see https://…discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396). Let's make it unambiguous.
> 
> This was my intent with the rule. This isn't to say the other interpretation isn't without its merits, but let's fix the ambiguity first and \_then\_ debate whether it should be changed.
> 
> \## Things done
> 
> 
> 
> \- Built on platform(s)
> - \[\] x86\_64-linux
> - \[\] aarch64-linux
> - \[\] x86\_64-darwin
> - \[\] aarch64-darwin
> \- For non-Linux: Is sandboxing enabled in \`nix.conf\`? (See \[Nix manual\](https://nixos.org/manual/nix/stable/command-ref/conf-file.html))
> - \[\] \`sandbox = relaxed\`
> - \[\] \`sandbox = true\`
> \- \[\] Tested, as applicable:
> - \[NixOS test(s)\](https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests) (look inside \[nixos/tests\](https://github.com/NixOS/nixpkgs/blob/master/nixos/tests))
> - and/or \[package tests\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests)
> - or, for functions and "core" functionality, tests in \[lib/tests\](https://github.com/NixOS/nixpkgs/blob/master/lib/tests) or \[pkgs/test\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/test)
> - made sure NixOS tests are \[linked\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#linking-nixos-module-tests-to-a-package) to the relevant packages
> \- \[\] Tested compilation of all packages that depend on this change using \`nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"\`. Note: all changes have to be committed, also see \[nixpkgs-review usage\](https://github.com/Mic92/nixpkgs-review#usage)
> \- \[\] Tested basic functionality of all binary files (usually in \`./result/bin/\`)
> \- \[Nixpkgs 25.11 Release Notes\](https://github.com/NixOS/nixpkgs/blob/master/doc/release-notes/rl-2511.section.md) (or backporting \[25.05\](https://github.com/NixOS/nixpkgs/blob/master/doc/manual/release-notes/rl-2505.section.md) Nixpkgs Release notes)
> - \[\] (Package updates) Added a release notes entry if the change is major or breaking
> \- \[NixOS 25.11 Release Notes\](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2511.section.md) (or backporting \[25.05\](https://github.com/NixOS/nixpkgs/blob/master/nixos/doc/manual/release-notes/rl-2505.section.md) NixOS Release notes)
> - \[\] (Module updates) Added a release notes entry if the change is significant
> - \[\] (Module addition) Added a release notes entry if adding a new NixOS module
> \- \[x\] Fits \[CONTRIBUTING.md\](https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md), \[pkgs/README.md\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md), \[maintainers/README.md\](https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md) and other contributing documentation in corresponding paths.
> 
> 
> 
> \---
> 
> Add a :+1: \[reaction\] to \[pull requests you find important\].
> 
> \[reaction\]: https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
> \[pull requests you find important\]: https://github.com/NixOS/nixpkgs/pulls?q=is%3Aopen+sort%3Areactions-%2B1-desc

---

<div class="post-metadata">

### Author: ![Pandapip1](https://discourse.nixos.org/user_avatar/discourse.nixos.org/pandapip1/32/17982_2.png) [@Pandapip1](https://discourse.nixos.org/u/Pandapip1)
#### Post date: [September 22, 2025, 5:59pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/7 "2025-09-22T17:59:04Z")

</div>

Update: the PR is now merged, so the answer to the original question is now a definitive _yes_, as long as the guidelines are followed (in this case specifically, an example program should be added to `passthru.tests`)

---

<div class="post-metadata">

### Author: ![SergeK](https://discourse.nixos.org/user_avatar/discourse.nixos.org/sergek/32/2972_2.png) [@SergeK](https://discourse.nixos.org/u/SergeK)
#### Post date: [September 22, 2025, 7:00pm UTC](https://discourse.nixos.org/t/can-i-add-libraries-with-no-dependents-inside-nixpkgs/66396/8 "2025-09-22T19:00:14Z")

</div>

Another 2c: if in doubt, just write it down in the PR who do you see potentially as potential users, to what uses, why they’d chose that over this. FWIW even in general, would be nice for `meta.description`s and `services.*.enable` options to explicitly answer these questions\[1\].

For `cnpy` and `cnpypp` specifically, I’m pretty sure I at some considered them for my stack at the uni, probably had Nix expressions too. I’ll probably need them again some time for obvious reasons. That there are no revdeps in Nixpkgs yet is (trivial) is a marker for “pay attention”, as are CoIs and commercial relationships, but they’re not more than that. Judge. Make your case if judged. Smth

* * *

1. Yeah looking at you, you nonce
