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 flake: use lib.mkAfter to allow extraHosts #2814

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

toastal
Copy link
Contributor

@toastal toastal commented Jan 30, 2025

At present, if a user uses networking.stevenBlockHosts.enable = true in tandem with networking.extraHosts, the extraHosts will override this Flake which is an unexpected behavior. By using lib.mkAfter, a user can now prepend extra hosts. Meaning:

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

will now output

127.0.0.1 localhost
::1 localhost

127.0.0.1 myproject.localhost

# Title: StevenBlack/hosts with the fakenews extension
#
# …

instead of removing StevenBlack/hosts.

NOTE: using lib.* like #2813 to avoid a potential merge conflict


Also has been open @ https://gitlab.com/StevenBlack/hosts/-/merge_requests/3

At present, if a user uses ``networking.stevenBlockHosts.enable = true``
in tandem with ``networking.extraHosts``, the ``extraHosts`` will
override this Flake which is an unexpected behavior. By using
``lib.mkAfter``, a user can now prepend extra hosts. Meaning:

.. code:: nix

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

will now output

.. code::

  127.0.0.1 localhost
  ::1 localhost

  127.0.0.1 myproject.localhost

  # Title: StevenBlack/hosts with the fakenews extension
  #
  # …

instead of removing StevenBlack/hosts.

Format: text/x-rst
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.

1 participant