nixpkgs/nixos/modules/virtualisation
Michael Franzl cae086d605
nixos/virtualisation: increase priority for libvirt NSS modules
When `services.resolved` is enabled, then `resolve [!UNAVAIL=return]`
is added to `system.nssDatabases.hosts` with priority 501,
which prevents lower-priority NSS modules from running
unless systemd-resolved is not available.

Quoting from `man nss-resolve`:

> To activate the NSS module, add "resolve [!UNAVAIL=return]" to the line
> starting with "hosts:" in /etc/nsswitch.conf. Specifically, it is
> recommended to place "resolve" early in /etc/nsswitch.conf's "hosts:"
> line. It should be before the "files" entry, since systemd-resolved
> supports /etc/hosts internally, but with caching. To the contrary, it
> should be after "mymachines", to give hostnames given to local VMs and
> containers precedence over names received over DNS. Finally, we
> recommend placing "dns" somewhere after "resolve", to fall back to
> nss-dns if systemd-resolved.service is not available.

Note that the man page (just) recommends "early" and means with this
"before the 'files' and 'dns' entries". It does not insist on being
first or excluding other modules.

For this reason, libvirt NSS modules should run before the `resolve`
module. They should come right next to `mymachines` because both are
conceptually very similar -- they resolve local VMs/containers.

Since the data source of the libvirt NSS modules are local
plain text files (see source code of the libvirt NSS module),
no performance impact is expected form this raise of priorities.

Other NSS modules in NixOS also explicitly set their priority, which is
why this change increases consistency.

Fixes #322022
2024-06-25 20:22:14 +02:00
..
podman nixos/podman: Create docker socket symlink via socket unit (#305803) 2024-05-02 14:04:37 +00:00
amazon-ec2-amis.nix nixos/amazon-ec2-amis: Add NixOS 23.11 2024-03-02 22:40:50 +01:00
amazon-image.nix nixos/amazon-image: Enable Amazon SSM Agent by default 2024-03-08 16:24:00 +10:00
amazon-init.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
amazon-options.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
anbox.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
appvm.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
azure-agent.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
azure-bootstrap-blobs.nix
azure-common.nix
azure-config-user.nix
azure-config.nix
azure-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
azure-images.nix
brightbox-config.nix
brightbox-image.nix
build-vm.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
cloudstack-config.nix
container-config.nix
containerd.nix nixos/containerd: remove LimitNOFILE from service (#313507) 2024-06-02 17:51:10 +02:00
containers.nix nixos/containers: set storage.settings via mkDefault 2024-05-06 16:34:00 +02:00
cri-o.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
digital-ocean-config.nix digital-ocean: revert "make it easier to use disko" 2024-04-21 11:36:17 +02:00
digital-ocean-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
digital-ocean-init.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
docker-image.nix
docker-rootless.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
docker.nix treewide: big opengl cleanup 2024-06-16 14:11:33 +03:00
ec2-amis.nix
ec2-data.nix
ec2-metadata-fetcher.sh
ecs-agent.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
gce-images.nix
google-compute-config.nix
google-compute-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
grow-partition.nix
hyperv-guest.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
hyperv-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
includes-to-excludes.py
incus.nix treewide: fix mkEnableOption usage 2024-06-14 02:41:42 -04:00
kubevirt.nix
kvmgt.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
libvirtd.nix nixos/virtualisation: increase priority for libvirt NSS modules 2024-06-25 20:22:14 +02:00
linode-config.nix treewide: remove deprecated grub.version references 2024-02-25 08:29:58 -08:00
linode-image.nix
lxc-container.nix nixos/lxc-container: link to prepare-root when boot.initrd.systemd.enable is on 2024-02-20 23:12:41 +01:00
lxc-image-metadata.nix treewide: Remove usage of pkgs.{system,hostPlatform} aliases 2024-05-16 11:48:32 +02:00
lxc-instance-common.nix
lxc.nix nixos/lxc: add package option and use for incus/lxd 2024-04-22 08:31:05 -04:00
lxcfs.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
lxd-agent.nix treewide: fix all obviously wrong mkEnableOptions 2024-06-03 13:20:32 +02:00
lxd-virtual-machine.nix nixos/lxd-virtual-machine: enable CPU hotplug for x86 VMs 2024-04-18 10:36:55 -04:00
lxd.nix nixos/lxc: add package option and use for incus/lxd 2024-04-22 08:31:05 -04:00
multipass.nix treewide: fix mkEnableOption usage 2024-06-14 02:41:42 -04:00
nixos-containers.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
oci-common.nix
oci-config-user.nix
oci-containers.nix nixos/oci-containers: add preRunExtraOptions (#315356) 2024-06-05 18:18:37 -04:00
oci-image.nix nixos/oci-image: expose diskSize as a configurable option 2024-06-21 08:54:08 +02:00
oci-options.nix nixos/oci-image: expose diskSize as a configurable option 2024-06-21 08:54:08 +02:00
openstack-config.nix
openstack-metadata-fetcher.nix
openstack-options.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
openvswitch.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
parallels-guest.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
proxmox-image.nix nixos/proxmox-image: change scsi controller model to upstream default 2024-04-29 11:01:45 +05:30
proxmox-lxc.nix nixos/proxmox-lxc: fix console access (#307163) 2024-06-03 00:15:27 +02:00
qemu-guest-agent.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
qemu-vm.nix treewide: fix mkEnableOption usage 2024-06-14 02:41:42 -04:00
rosetta.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
spice-usb-redirection.nix maintainers: drop lheckemann 2024-06-21 15:54:54 +02:00
vagrant-guest.nix nixos/vagrant-guest: prefer 'install' over 'chmod' 2024-04-09 21:41:00 +02:00
vagrant-virtualbox-image.nix
virtualbox-guest.nix virtualbox guest module: draganddrop became dragAndDrop (#317756) 2024-06-06 16:48:47 +02:00
virtualbox-host.nix nixos/virtualbox-host: fix typo in assertion 2024-06-05 14:04:03 +02:00
virtualbox-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
vmware-guest.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
vmware-host.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
vmware-image.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
waydroid.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
xe-guest-utilities.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
xen-dom0.nix nixos: remove all uses of lib.mdDoc 2024-04-13 10:07:35 -07:00
xen-domU.nix