Generate nsswitch.conf properly
This commit is contained in:
parent
4b78161e3e
commit
757ab7f6d3
@ -1,11 +0,0 @@
|
|||||||
# NSS configuration files with mDNS enabled (requires running Avahi daemon).
|
|
||||||
|
|
||||||
passwd: ldap files
|
|
||||||
group: ldap files
|
|
||||||
shadow: ldap files
|
|
||||||
|
|
||||||
hosts: files mdns_minimal [NOTFOUND=return] dns mdns
|
|
||||||
networks: files dns
|
|
||||||
|
|
||||||
services: files
|
|
||||||
protocols: files
|
|
@ -1,10 +0,0 @@
|
|||||||
passwd: files ldap
|
|
||||||
group: files ldap
|
|
||||||
shadow: files ldap
|
|
||||||
|
|
||||||
hosts: files dns
|
|
||||||
networks: files dns
|
|
||||||
ethers: files
|
|
||||||
|
|
||||||
services: files
|
|
||||||
protocols: files
|
|
@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
# NSS modules. Hacky!
|
# NSS modules. Hacky!
|
||||||
system.nssModules = pkgs.lib.mkOption {
|
system.nssModules = mkOption {
|
||||||
internal = true;
|
internal = true;
|
||||||
default = [];
|
default = [];
|
||||||
description = "
|
description = "
|
||||||
@ -15,21 +17,23 @@ let
|
|||||||
several DNS resolution methods to be specified via
|
several DNS resolution methods to be specified via
|
||||||
<filename>/etc/nsswitch.conf</filename>.
|
<filename>/etc/nsswitch.conf</filename>.
|
||||||
";
|
";
|
||||||
merge = pkgs.lib.mergeListOption;
|
merge = mergeListOption;
|
||||||
apply = list:
|
apply = list:
|
||||||
let
|
let
|
||||||
list2 =
|
list2 =
|
||||||
list
|
list
|
||||||
# !!! this should be in the LDAP module
|
# !!! this should be in the LDAP module
|
||||||
++ pkgs.lib.optional config.users.ldap.enable pkgs.nss_ldap;
|
++ optional config.users.ldap.enable pkgs.nss_ldap;
|
||||||
in {
|
in {
|
||||||
list = list2;
|
list = list2;
|
||||||
path = pkgs.lib.makeLibraryPath list2;
|
path = makeLibraryPath list2;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inherit (config.services.avahi) nssmdns;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -39,10 +43,17 @@ in
|
|||||||
[ # Name Service Switch configuration file. Required by the C library.
|
[ # Name Service Switch configuration file. Required by the C library.
|
||||||
# !!! Factor out the mdns stuff. The avahi module should define
|
# !!! Factor out the mdns stuff. The avahi module should define
|
||||||
# an option used by this module.
|
# an option used by this module.
|
||||||
{ source =
|
{ source = pkgs.writeText "nsswitch.conf"
|
||||||
if config.services.avahi.nssmdns
|
''
|
||||||
then ./nsswitch-mdns.conf
|
passwd: files ldap
|
||||||
else ./nsswitch.conf;
|
group: files ldap
|
||||||
|
shadow: files ldap
|
||||||
|
hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"}
|
||||||
|
networks: files dns
|
||||||
|
ethers: files
|
||||||
|
services: files
|
||||||
|
protocols: files
|
||||||
|
'';
|
||||||
target = "nsswitch.conf";
|
target = "nsswitch.conf";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user