NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.6k forks source link

NSD state directory is hard-coded, it would be nice to be able to change it. #145167

Open fudoniten opened 2 years ago

fudoniten commented 2 years ago

Describe the bug

The state directory for NSD is hard-coded to /var/lib/nsd in the NixOS module. It would be nice if it were a configuration option, so the state data could be stored somewhere else. This is especially important in the case of systems with a non-persistent /var.

Weird to make this a bug, but it doesn't fit any other categories.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Initialize nsd on a host without a persistent /var.

Expected behavior

Allow users to specify a path other than /var/lib/nsd for NSD state, if desired.

Additional context

I'm using several systems with tmpfs roots, as described here: https://elis.nu/blog/2020/05/nixos-tmpfs-as-root/

Therefore, every time I restart one of my hosts, all data stored in /var is lost. For many packages, I can change the various data directories to a location of my choosing to keep it persistent. That's not currently an option for NSD. I can create a link or something to get around this, but I think it'd be cleaner to allow for an override.

Notify maintainers

@hrdinka

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

Maintainer information:

# a list of nixos modules affected by the problem
module: services.nsd
bjornfor commented 2 years ago

Would using symlinks or binding mounts a solution?