From 8a01d244b1abd4e2eec26c19a0db0316b87100f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Forsman?= Date: Sun, 25 Aug 2013 22:12:14 +0200 Subject: [PATCH] Add services.samba.nsswins option This option allows for seamless WINS/NetBIOS name lookup, using nsswitch. --- modules/config/nsswitch.nix | 3 ++- modules/services/network-filesystems/samba.nix | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/config/nsswitch.nix b/modules/config/nsswitch.nix index 0a922756bf9..ad62b5597be 100644 --- a/modules/config/nsswitch.nix +++ b/modules/config/nsswitch.nix @@ -7,6 +7,7 @@ with pkgs.lib; let inherit (config.services.avahi) nssmdns; + inherit (config.services.samba) nsswins; in @@ -43,7 +44,7 @@ in passwd: files ldap group: files ldap shadow: files ldap - hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} myhostname + hosts: files ${optionalString nssmdns "mdns_minimal [NOTFOUND=return]"} dns ${optionalString nssmdns "mdns"} ${optionalString nsswins "wins"} myhostname networks: files dns ethers: files services: files diff --git a/modules/services/network-filesystems/samba.nix b/modules/services/network-filesystems/samba.nix index 518142ba97b..70a14487ea5 100644 --- a/modules/services/network-filesystems/samba.nix +++ b/modules/services/network-filesystems/samba.nix @@ -170,6 +170,16 @@ in example = "share"; }; + nsswins = mkOption { + default = false; + type = types.uniq types.bool; + description = '' + Whether to enable the WINS NSS (Name Service Switch) plug-in. + Enabling it allows applications to resolve WINS/NetBIOS names (a.k.a. + Windows machine names) by transparently querying the winbindd daemon. + ''; + }; + }; }; @@ -196,6 +206,8 @@ in users.extraGroups.smbguest.gid = config.ids.uids.smbguest; + system.nssModules = optional cfg.nsswins samba; + systemd = { targets.samba = { description = "Samba server";