You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I say "Nix", I am referring to the repository hosted at NixOS/nix
When I say nix, I am referring to the a generic nix binary implementation
The Problem
Over the last year(s), the community has grown a fair bit and with it, new implementations of nix itself have sprung up. This has introduced a problem we haven't really had before: many users in Nixpkgs now want to switch out their nix. So how can they do that?
Current Solutions
I've seen three main ways:
Set nix.package in NixOS/home-manager
This (mostly) only changes the default nix in your $PATH
Some programs will respect this, some (most?) won't
It's a bit of a force brute method, and can (and has) cause(d) issues with software that uses some of the newer APIs introduced by Nix that aren't present in Lix
Vastly improved by introducing the alias nixForLinking, which allowed packages to specifically depend on the Nix C API not present in Lix
Causes rebuilds(!!)
Overriding packages
Sorta a middleground between both of the above?
Inconsistent, as some packages won't take in nix as an input
Nice for fine-grained control, or patching the effects of the above overlay
Issues With Them
IMO, much of the above boils down to a question of what exactly is nix?
By the pure Nixpkgs definition, it's the latest "stable" version of Nix. This implies that programs which depend on it currently have compatibility with at least v2.28 of Nix
Some packages - even in Nixpkgs itself - make different assumptions though. Namely:
nix is a generic implementation of nix
nix is something that's already present in the environment and doesn't need to be listed
These three definitions of what nix is and how it's meant to be used create a good amount of inconsistency and confusion. Packagers/developers for example now have to ask questions like if they need to test against other implementations for compatibility, if they need to pin to a specific implementation/version, or if they should even include a nix input at all. Likewise, users are faced with multiple, distinct ways of replacing their nix implementation that might not replace it everywhere reasonable, could directly break some packages, or isn't possible outside of manipulating $PATH
Better Solutions?
The main point of this issue is to encourage discussion on how to better solve the above, and make it easy enough for most users of Nixpkgs/NixOS to override the version or implementation of nix they're using.
An idea I had was to make a more generic nix alias (similar to nixForLinking) that implies the use of features compatible with Nix 2.18 - as these are mostly shared between Lix and Nix. Most packages could then probably use this nixGeneric (placeholder name 😉) in the same way they use nix now, hopefully after they've tested for compatibility. This would give nix implementation upstreams a nice override target, developers and packagers and nice way to express generic compatibility support, and avoid the pitfalls of not including a nix input at all
An alternative would of course be to just document nix itself as the "generic implementation", but I think that'd be slightly more breaking and put less emphasis on packagers actually testing to make sure they can use a generic implementation
Regardless, I would really love to find a more consistent and document-able solution to all this here :)
Note
Because this is also inconsistent and confusing:
NixOS/nixnix, I am referring to the a genericnixbinary implementationThe Problem
Over the last year(s), the community has grown a fair bit and with it, new implementations of
nixitself have sprung up. This has introduced a problem we haven't really had before: many users in Nixpkgs now want to switch out theirnix. So how can they do that?Current Solutions
I've seen three main ways:
nix.packagein NixOS/home-managernixin your$PATHnixnixForLinking, which allowed packages to specifically depend on the Nix C API not present in Lixnixas an inputIssues With Them
IMO, much of the above boils down to a question of what exactly is
nix?By the pure Nixpkgs definition, it's the latest "stable" version of Nix. This implies that programs which depend on it currently have compatibility with at least v2.28 of Nix
nixpkgs/pkgs/top-level/all-packages.nix
Line 15136 in 86eba14
Some packages - even in Nixpkgs itself - make different assumptions though. Namely:
nixis a generic implementation ofnixnixis something that's already present in the environment and doesn't need to be listedThese three definitions of what
nixis and how it's meant to be used create a good amount of inconsistency and confusion. Packagers/developers for example now have to ask questions like if they need to test against other implementations for compatibility, if they need to pin to a specific implementation/version, or if they should even include anixinput at all. Likewise, users are faced with multiple, distinct ways of replacing theirniximplementation that might not replace it everywhere reasonable, could directly break some packages, or isn't possible outside of manipulating$PATHBetter Solutions?
The main point of this issue is to encourage discussion on how to better solve the above, and make it easy enough for most users of Nixpkgs/NixOS to override the version or implementation of
nixthey're using.An idea I had was to make a more generic
nixalias (similar tonixForLinking) that implies the use of features compatible with Nix 2.18 - as these are mostly shared between Lix and Nix. Most packages could then probably use thisnixGeneric(placeholder name 😉) in the same way they usenixnow, hopefully after they've tested for compatibility. This would giveniximplementation upstreams a nice override target, developers and packagers and nice way to express generic compatibility support, and avoid the pitfalls of not including anixinput at allAn alternative would of course be to just document
nixitself as the "generic implementation", but I think that'd be slightly more breaking and put less emphasis on packagers actually testing to make sure they can use a generic implementationRegardless, I would really love to find a more consistent and document-able solution to all this here :)
Related work
#384099
#391402
#396601
#396442
#433617
#436447
Upstream Nix overlay
Upstream Lix overlay