Skip to content

reuse(devLib): expose extended lib by default and use an overlay to extend it#1927

Draft
ju1m wants to merge 1 commit into
ngi-nix:mainfrom
ju1m:reuse-devLib
Draft

reuse(devLib): expose extended lib by default and use an overlay to extend it#1927
ju1m wants to merge 1 commit into
ngi-nix:mainfrom
ju1m:reuse-devLib

Conversation

@ju1m
Copy link
Copy Markdown

@ju1m ju1m commented Dec 27, 2025

+reuse: exposing the extended lib by default enables to reuse it in modules
evaluated by pkgs.testers.runNixOSTest in projects/tests.nix,
otherwise lib given to modules when testing is Nixpkgs' pkgs.lib.

+clarity: being able to factorize code in a library
is much easier to check, maintain and develop
than having to manage multiple copies of the same code.

+standardization: having some code in a library
nudges more to use it than if it would require to copy,
since it's already an explicitly shared pattern.

+customizability: using an overlay enables to customize lib's
sub attrs (eg. adding types to lib.types).

-portability: using a custom lib specific to NGIpkgs
means the code is less portable, eg. pushing it into Nixpkgs or NixOS
means pushing the part of lib it depends on with it,
or to copy it in the package or module.

-installability: using a custom lib specific to NGIpkgs
means the modules must be imported with that lib by users,
which may not be obvious.

… extend it

+reuse: exposing the extended `lib` by default enables to reuse it in modules
evaluated by `pkgs.testers.runNixOSTest` in `projects/tests.nix`,
otherwise `lib` given to modules when testing is Nixpkgs' `pkgs.lib`.

+clarity: being able to factorize code in a `lib`rary
is much easier to check, maintain and develop
than having to manage multiple copies of the same code.

+standardization: having some code in a `lib`rary
nudges more to use it than if it would require to copy,
since it's already an explicitly shared pattern.

+customizability: using an overlay enables to customize `lib`'s
sub attrs (eg. adding types to `lib.types`).

-portability: using a custom `lib` specific to NGIpkgs
means the code is less portable, eg. pushing it into Nixpkgs or NixOS
means pushing the part of `lib` it depends on with it,
or to copy it in the package or module.

-installability: using a custom `lib` specific to NGIpkgs
means the modules must be imported with that `lib` by users,
which may not be obvious.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant