-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stevenblack-blocklist: add ipv6 support #374656
base: master
Are you sure you want to change the base?
Conversation
e4af7e5
to
6c42b02
Compare
|
Just took a look at the attached GitHub issue as well as your PR changes for the upstream provided flake. I have some thoughts but I'll comment on them as soon as I am available, particularly in terms of the accompanying NixOS module in relation to this change. |
I think I know where you're going with this. Would you like me to add a toggleable flag? EDIT: I'll just add one anyway. |
6c42b02
to
1890ac4
Compare
24513b2
to
96c45e7
Compare
d3860da
to
8e85653
Compare
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think we should move
dontAddIPv6
into the function arguments instead of as an attribute. That way, we can use.override
instead of.overrideAttrs
, since this is usually the common pattern I see in Nixpkgs. - The PR is trying to do too much now with the
lib/options.nix
andlib/tests/modules/declare-mkPackageOption.nix
changes. These are functions used heavily in a lot of NixOS modules, and I don't think we should make a change to them in this random PR. - Good use of the
config.networking.enableIPv6
, I was actually debating on whether it'd be a good idea to use or not, especially since Nixpkgs defaults with it on but quite a lot of people still do not have IPv6 capable hardware available.
Currently I'm debating on the creation of a new package stevenblack-blocklist-ipv6
, and the extra outputs. Both technically fit within the spirit of what I had initially done when refactoring this module, but I'm beginning to wonder if it makes it look cluttered and messy.
To clarify on the above, I don't intend to say these are necessarily bad, after all I do actually like that we leverage Hydra and the cache to store more and thereby download less on our individual machines, but I do wonder if it fits well with what other Nixpkgs maintainers/commiters would consider as good quality code. I'm hoping another reviewer can chime in on some of these things so that there's more assurance.
From my end though, once you address the numbered points above, I do feel like it's fine, though I will admit it still nags me a bit. Still, a small feeling isn't enough to justify stopping a good PR.
Most people do have IPv6-capable hardware, and it's been that way for a while. It's their ISP that's holding them back, and even then they could host their own NAT64.
This is actually a semi-common pattern; it's just that usually these modifications are defined in
I feel the same way, but I don't see an easy way around this without breaking existing configs. I'll make a kludge but it won't be pretty. I'll also cherry-pick it into its own PR. |
8e85653
to
b163c8a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I review code, I tend to try and think about how I would write a certain piece of code, and if what I am writing and seeing aligns well with other code I have viewed in said repository. Apologies in advance for my nitpicking but I'm still a bit on the fence about some of the things here.
I'm not really sure that we need a separate package entirely for the IPv6 hostfiles. This could be something that's part of the original package as a "feature-flag" opt-in, and could be overriden within the module upon request. Something akin to what I'll minimally type out below is what I would consider closer to what I see in Nixpkgs already, and a better choice rather than exposing a whole new package.
# pkgs/by-name/st/stevenblack/package.nix
{
lib,
stdenvNoCC,
fetchFromGitHub,
nix-update-script,
enableIPv6 ? true, # or "withIPv6 ? true"
}:
...
# nixos/modules/config/stevenblack.nix
{
config,
lib,
pkgs,
...
}:
{
# [...omitted...]
config = mkIf cfg.enable {
networking.stevenblack.package = lib.mkIf cfg.enableIPv6 cfg.package.override { enableIPv6 = true; };
# [...omitted...]
};
}
An additional set of benefits to doing it this way would be that we can still support the cfg.package
changing. With your current PR, if I wanted to "pin" the package via setting networking.stevenblack.package = someOlderVersionOfTheDrv;
, I would subsequently be unable to make use of the networking.stevenblack.enableIPv6
flag, since your current code prioritizes the package and will not attempt to override it. The alternative way I have suggested would still allow for this behaviour.
On a different note, I'm also thinking that maybe we can enable IPv6 by default, just to match networking.enableIPv6
also being default enabled. As adoption for IPv6 grows in the future, most people will probably expect it to just work without actively scouring the NixOS modules to enable every little flag. This would be a perfect choice for future compatibility, whilst still allowing the user to toggle it off should they want to save on closure size.
I'm not sure if these changes constitute adding a release-note, but if it's acceptable I think that should be added as well, just to note on the fact that enableIPv6 is an option now and that it's enabled by default, so that users are aware of such a change.
There is no This way, if you want to pin an older drv, you pin the ipv6 version of it. I'm hesitant to make the ipv6 version the default; it's a pretty major change. I also really dislike the
Again, there is no
Again, there is no |
I thought I'd already mentioned that adding
Fair enough, I only say that because that's how I tend to see feature-flag behaviour in Nix derivations. There are numerous examples of this way which is why I preferred going about it that way as well.
Fair point, most people don't report their configs when reporting build failures, which does make things harder to reproduce. I suppose with all that being said the second package can stay, it seems to be the cleaner way to go about things at this point. My only concern is the fact that now we expose a Either way, we would need a minor addition to the release notes regarding this module. I don't see a way to keep the NixOS module exactly as-is, whilst also adding IPv6 support for it (unless we simply force users to use |
Yea, I see this too. It kind of grates me.
I wonder if the best way to go about this might be to have a |
Hmm, the main problem I can see is in regards to closure size. Every hosts file would increase by quite a lot, and there wouldn't be a good way for such an option to "check" if a hosts file supports IPv6 entries or not. It's not a bad idea overall, but it would definitely need some things ironed out. |
Most people don't have particularly large host files. IIRC, it typically contains just the loopback address. It's really just for hostfile based blocking or caching that these lists can get quite large. |
See StevenBlack/hosts#47
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.