Skip to content
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

Nix allow appending config + refactor #2807

Closed
wants to merge 2 commits into from

Conversation

toastal
Copy link
Contributor

@toastal toastal commented Jan 23, 2025

The motivation for refactor is wanting to still add my own values to the list such as

127.0.0.1 myproject.localhost

At present enabling will override existing configurations. This should fix that as well as other minor fixups along the way. Now with this config

{
   networking = {
      stevenBlockHosts = {
         enable = true;
         blockFakenews = true;
      };
      extraHosts = ''
         127.0.0.1 myproject.localhost
      '';
   };
}

And the lib.mkAfter will append the StevenBlack hosts list after my extra config.

127.0.0.1 localhost
::1 localhost

127.0.0.1 myproject.localhost

# Title: StevenBlack/hosts with the fakenews extension
#
# …rest of config

The docs were also updated to including following the user’s existing nixpkgs since this is probably what the user wants (not adding multiple copies of the expensive-to-download nixpkgs tarball).

Can review commit by commit.

1

Footnotes

  1. Please consider giving up MS GitHub or offering a non-proprietary, non-US-corporate-controlled mirror for this free software project. I wish to delete this Microsoft account in the future, but I need more projects like this to support alternative methods to send patches & contribute.

• remove ``with nixpkgs.lib`` make it easier to understand where the
  functions are coming from (now the more common practice)
• use ``lib.optional`` & ``lib.optionalString`` for optional values
• use ``lib.mkAfter`` so users can still add to the ``extraHosts`` value

Format: reStructuredText
This prevents users from getting an explosion of ``nixpkgs`` in their
lock file since this flake is not providing a pinned version for
``nixpkgs`` (for ``lib`` & ``pkgs``). This should point users in the
right direction for pinning a compatibile Nixpkgs version should the
need ever arise in the case that the API changes.

Format: reStructuredText
@StevenBlack
Copy link
Owner

Thank you for this @toastal.

I have a question. Why would someone ever combine a PR with a rant about "MS Github"? How is THAT, in any way, a good idea?

These are two categorically distinct concepts. It telegraphs a remarkable lack of focus. It calls into question everything else because it's so wantonly scrambled. Two separate concepts? two separate issues.

This repo, since 2016, has been mirrored to GitLab. https://gitlab.com/StevenBlack/hosts. There are other mirrors.

Closing. If you would like this PR merged, please resubmit without the bullshit.

@toastal
Copy link
Contributor Author

toastal commented Jan 23, 2025 via email

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.

2 participants