-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
nix flake: use lib.mkAfter
put the host list at the end
#2814
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
base: master
Are you sure you want to change the base?
Conversation
db1d052
to
dd05205
Compare
8888ec1
to
b2d5175
Compare
lib.mkAfter
to allow extraHostslib.mkAfter
put the host list at the end
dbb555e
to
2e56bfe
Compare
d2af908
to
c770cb7
Compare
b1aebb4
to
d0e9a5d
Compare
At present, if a user uses ``networking.stevenBlockHosts.enable = true`` in tandem with ``networking.extraHosts``, the ``extraHosts`` will put be put after which makes it very difficult to see the custom adds with even the ``$PAGER`` operating a bit slow due to file size. I would propose putting this project’s hosts at the end of the hosts file. 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 # # … Format: text/x-rst
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.
Not too familiar with the mkOrder
-like nix functions, but this looks sane to me. Have not tested this, however, and this does seem like it has the potential of breaking things.
@Pandapip1 |
Agreed, changing the order has the potential to change the behaviour for users. Perhaps this could be controlled via another config option? |
Agreed, changing the order has the potential to change the behaviour
for users. Perhaps this could be controlled via another config option?
This is true, but has 2 issue. The 1st being as mentioned, the user has
a hard time getting to the hosts values they have set, but 2nd the first
match in the hosts files is what the system will use… meaning that if
the user wants to override xxx.com, they will not be able to since by
default, Nix will append custom values to end. Having used the Python
scripts in the past, the behavior was to append to the StevenBlack hosts
to the file, not prepend. I think this is a pretty important thing to
consider & having thought about it, the current behavior could actually
be considered a ‘bug’.
|
I'm gonna assume that the author of this PR has tested this. Assuming it works correctly, this is good to merge and seems like a reasonable change. |
@Pandapip1 I have tested for several months since I first opened the merge request on GitLab after the maker said GitLab was a supported mirror. …Hence many rebases. |
Sounds like this should be merged then |
I suppose given it's the first match that will be used, thus any overrides would need to be at the top, this does make sense. I think any chance of this changing the behaviour for any users is pretty slim. |
At present, if a user uses
networking.stevenBlockHosts.enable = true
in tandem withnetworking.extraHosts
, theextraHosts
will put be put after which makes it very difficult to see the custom adds with even the$PAGER
operating a bit slow due to file size. I would propose putting this project’s hosts at the end of the hosts file. Meaning:will now output
NOTE: using
lib.*
like #2813 to avoid a potential merge conflictAlso has been open @ https://gitlab.com/StevenBlack/hosts/-/merge_requests/3