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
|
{ config, pkgs, upstartJobs, systemPath, wrapperDir
|
||||||
, defaultShell, extraEtc, nixEnvVars, modulesTree
|
, defaultShell, extraEtc, nixEnvVars, modulesTree, nssModulesPath
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
@ -56,7 +56,9 @@ import ../helpers/make-etc.nix {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{ # Name Service Switch configuration file. Required by the C library.
|
{ # 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";
|
target = "nsswitch.conf";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +118,7 @@ import ../helpers/make-etc.nix {
|
|||||||
{ # Script executed when the shell starts as a login shell.
|
{ # Script executed when the shell starts as a login shell.
|
||||||
source = pkgs.substituteAll {
|
source = pkgs.substituteAll {
|
||||||
src = ./profile.sh;
|
src = ./profile.sh;
|
||||||
inherit systemPath wrapperDir modulesTree;
|
inherit systemPath wrapperDir modulesTree nssModulesPath;
|
||||||
inherit (pkgs) glibc;
|
inherit (pkgs) glibc;
|
||||||
timeZone = config.time.timeZone;
|
timeZone = config.time.timeZone;
|
||||||
defaultLocale = config.i18n.defaultLocale;
|
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 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 MODULE_DIR=@modulesTree@/lib/modules
|
||||||
export NIXPKGS_CONFIG=/nix/etc/config.nix
|
export NIXPKGS_CONFIG=/nix/etc/config.nix
|
||||||
export PAGER="less -R"
|
export PAGER="less -R"
|
||||||
|
@ -986,6 +986,21 @@
|
|||||||
default = true;
|
default = true;
|
||||||
description = ''Whether to allow publishing.'';
|
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 = {
|
bitlbee = {
|
||||||
|
@ -125,7 +125,8 @@ rec {
|
|||||||
|
|
||||||
# NSS modules. Hacky!
|
# NSS modules. Hacky!
|
||||||
nssModules =
|
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 ":"
|
nssModulesPath = pkgs.lib.concatStrings (pkgs.lib.intersperse ":"
|
||||||
(map (mod: mod + "/lib") nssModules));
|
(map (mod: mod + "/lib") nssModules));
|
||||||
@ -175,7 +176,7 @@ rec {
|
|||||||
# The static parts of /etc.
|
# The static parts of /etc.
|
||||||
etc = import ../etc/default.nix {
|
etc = import ../etc/default.nix {
|
||||||
inherit config pkgs upstartJobs systemPath wrapperDir
|
inherit config pkgs upstartJobs systemPath wrapperDir
|
||||||
defaultShell nixEnvVars modulesTree;
|
defaultShell nixEnvVars modulesTree nssModulesPath;
|
||||||
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
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.security.sudo.enable pkgs.sudo
|
||||||
++ pkgs.lib.optional config.services.bitlbee.enable pkgs.bitlbee
|
++ 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.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
||||||
++ pkgs.lib.concatLists (map (job: job.extraPath) upstartJobs.jobs)
|
++ pkgs.lib.concatLists (map (job: job.extraPath) upstartJobs.jobs)
|
||||||
++ config.environment.extraPackages pkgs
|
++ config.environment.extraPackages pkgs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user