Add support for `nss-mdns'.
Currently, the solution is a bit hackish since running applications will not work after a `nixos-rebuild' because `libnss_mdns' is not in their `LD_LIBRARY_PATH'. svn path=/nixos/trunk/; revision=11162
This commit is contained in:
parent
7390b6e5bd
commit
d1f29d328d
@ -1,5 +1,5 @@
|
||||
{ config, pkgs, upstartJobs, systemPath, wrapperDir
|
||||
, defaultShell, extraEtc, nixEnvVars, modulesTree
|
||||
, defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath
|
||||
}:
|
||||
|
||||
let
|
||||
@ -56,7 +56,9 @@ import ../helpers/make-etc.nix {
|
||||
}
|
||||
|
||||
{ # Name Service Switch configuration file. Required by the C library.
|
||||
source = ./nsswitch.conf;
|
||||
source = if config.services.avahi.nssmdns
|
||||
then (assert config.services.avahi.enable; ./nsswitch-mdns.conf)
|
||||
else ./nsswitch.conf;
|
||||
target = "nsswitch.conf";
|
||||
}
|
||||
|
||||
@ -116,7 +118,7 @@ import ../helpers/make-etc.nix {
|
||||
{ # Script executed when the shell starts as a login shell.
|
||||
source = pkgs.substituteAll {
|
||||
src = ./profile.sh;
|
||||
inherit systemPath wrapperDir modulesTree;
|
||||
inherit systemPath wrapperDir modulesTree nssModulesPath;
|
||||
inherit (pkgs) glibc;
|
||||
timeZone = config.time.timeZone;
|
||||
defaultLocale = config.i18n.defaultLocale;
|
||||
|
11
etc/nsswitch-mdns.conf
Normal file
11
etc/nsswitch-mdns.conf
Normal file
@ -0,0 +1,11 @@
|
||||
# NSS configuration files with mDNS enabled (requires running Avahi daemon).
|
||||
|
||||
passwd: ldap files
|
||||
group: ldap files
|
||||
shadow: ldap files
|
||||
|
||||
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
|
||||
networks: files dns
|
||||
|
||||
services: files
|
||||
protocols: files
|
@ -1,4 +1,5 @@
|
||||
export PATH=@wrapperDir@:/var/run/current-system/sw/bin:/var/run/current-system/sw/sbin
|
||||
export LD_LIBRARY_PATH=@nssModulesPath@
|
||||
export MODULE_DIR=@modulesTree@/lib/modules
|
||||
export NIXPKGS_CONFIG=/nix/etc/config.nix
|
||||
export PAGER="less -R"
|
||||
|
@ -986,6 +986,21 @@
|
||||
default = true;
|
||||
description = ''Whether to allow publishing.'';
|
||||
};
|
||||
|
||||
nssmdns = mkOption {
|
||||
default = false;
|
||||
description = ''
|
||||
Whether to enable the mDNS NSS (Name Service Switch) plug-in.
|
||||
Enabling it allows applications to resolve names in the `.local'
|
||||
domain by transparently querying the Avahi daemon.
|
||||
|
||||
Warning: Currently, enabling this option breaks DNS lookups after
|
||||
a `nixos-rebuild'. This is because `/etc/nsswitch.conf' is
|
||||
updated to use `nss-mdns' but `libnss_mdns' is not in
|
||||
applications' `LD_LIBRARY_PATH'. The next time `/etc/profile' is
|
||||
sourced, it will set up an appropriate `LD_LIBRARY_PATH', though.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
bitlbee = {
|
||||
|
@ -125,7 +125,8 @@ rec {
|
||||
|
||||
# NSS modules. Hacky!
|
||||
nssModules =
|
||||
if config.users.ldap.enable then [pkgs.nss_ldap] else [];
|
||||
pkgs.lib.optional config.users.ldap.enable pkgs.nss_ldap
|
||||
++ pkgs.lib.optional config.services.avahi.nssmdns pkgs.nssmdns;
|
||||
|
||||
nssModulesPath = pkgs.lib.concatStrings (pkgs.lib.intersperse ":"
|
||||
(map (mod: mod + "/lib") nssModules));
|
||||
@ -175,7 +176,7 @@ rec {
|
||||
# The static parts of /etc.
|
||||
etc = import ../etc/default.nix {
|
||||
inherit config pkgs upstartJobs systemPath wrapperDir
|
||||
defaultShell nixEnvVars modulesTree;
|
||||
defaultShell nixEnvVars modulesTree nssModulesPath;
|
||||
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
||||
};
|
||||
|
||||
@ -255,6 +256,8 @@ rec {
|
||||
]
|
||||
++ pkgs.lib.optional config.security.sudo.enable pkgs.sudo
|
||||
++ pkgs.lib.optional config.services.bitlbee.enable pkgs.bitlbee
|
||||
++ pkgs.lib.optional config.services.avahi.enable pkgs.avahi
|
||||
++ pkgs.lib.optional config.services.avahi.nssmdns pkgs.nssmdns
|
||||
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
||||
++ pkgs.lib.concatLists (map (job: job.extraPath) upstartJobs.jobs)
|
||||
++ config.environment.extraPackages pkgs
|
||||
|
Loading…
Reference in New Issue
Block a user