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

nixos/nsd: symlink conf file to /etc/nsd #91514

Merged
merged 2 commits into from Jun 26, 2020
Merged

Conversation

picnoir
Copy link
Member

@picnoir picnoir commented Jun 25, 2020

Motivation for this change
We remove the configFile build flag override in the NixOS module.

Instead of embedding the conf file link to the binaries, we symlink it
to /etc/nsd/nsd.nix, the hardcoded config file location for the
various CLI nsd utilities.

This config file build option override is triggerring a nsd rebuild
for each configuration change. This prevent us to use the nixos cache
in many cases.

@hrdinka, I see you wrote that particular part. I know it was a long time ago, but I feel like I might be missing some context and do something stupid here. Would you happen to remember what led you to add this override?

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@hrdinka
Copy link
Contributor

hrdinka commented Jun 26, 2020

@NinjaTrappeur Yea, this needs a change. The reason for this is that all nsd binaries installed on the system (like nsd-control) need access to the config file to work. Back than I did not want to further clutter /etc but today this might be the better solution: Either symlink the config file to /etc/nsd/nsd.conf (better compatibilty) or maybe symlink it to nsd’s stateDir (like other services do it; better for NixOS users and worse for others) and use this path for the config file in the derivation. I am in favor of symlinking it to /etc. Just let me know if you are going to do the change or if I should do it.

@picnoir
Copy link
Member Author

picnoir commented Jun 26, 2020

Aha! I did not think about nsd-control.

Ok, sounds good. We're already symlinking the zones files to /etc/nsd/ anyways. EDIT: my bad, it's a mutable file, it's part of the statedir ofc.

Just let me know if you are going to do the change or if I should do it.

I won't be available until tonight (CEST time). If you can do it earlier, be my guest, I'll be happy to review it. If you go ahead, it'll probably a good idea to cherry-pick 9501883 at the same time.

I'm using NSD on my router, needless to say the current un-cached situation is a bit annoying to me, I'd like to fix that pretty quick!

@picnoir picnoir changed the title nixos/nsd: remove config file override. nixos/nsd: symlink conf file to /etc/nsd Jun 26, 2020
@picnoir
Copy link
Member Author

picnoir commented Jun 26, 2020

Just updated the PR. We're now creating a symlink to /etc/nsd/nsd.conf.

@hrdinka
Copy link
Contributor

hrdinka commented Jun 26, 2020

Great, thanks a lot for your changes! One last request since you are already on it. The default config file path is wrong in the derivation. It’s missing the leading /, please be so kind and add it 😃:

https://github.com/NixOS/nixpkgs/pull/91514/files#diff-a172753a317033e33503641d094d3636R14

We remove the configFile build flag override in the NixOS module.

Instead of embedding the conf file link to the binaries, we symlink it
to /etc/nsd/nsd.nix, the hardcoded config file location for the
various CLI nsd utilities.

This config file build option override is triggerring a nsd rebuild
for each configuration change. This prevent us to use the nixos cache
in many cases.

Co-authored-by: Erjo <erjo@cocoba.work>
@picnoir
Copy link
Member Author

picnoir commented Jun 26, 2020 via email

@hrdinka
Copy link
Contributor

hrdinka commented Jun 26, 2020

Thanks for all the changes 👍

@picnoir picnoir deleted the nin-fix-nsdconf branch June 27, 2020 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants