Author: viric
Date: Wed Mar 21 20:37:37 2012
New Revision: 33342
URL: https://nixos.org/websvn/nix/?rev=33342&sc=1

Log:
Changing portmap by rpcbind on nfs services.

That could make rpc.statd work.

Patch by Rickard Nilsson.

I'm not sure we need that netconfig file in etc.

Added:
   nixos/trunk/modules/services/networking/rpcbind.nix
Modified:
   nixos/trunk/modules/module-list.nix
   nixos/trunk/modules/services/network-filesystems/nfsd.nix
   nixos/trunk/modules/tasks/filesystems/nfs.nix

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Wed Mar 21 20:35:15 2012        (r33341)
+++ nixos/trunk/modules/module-list.nix Wed Mar 21 20:37:37 2012        (r33342)
@@ -141,6 +141,7 @@
   ./services/networking/quassel.nix
   ./services/networking/radvd.nix
   ./services/networking/rdnssd.nix
+  ./services/networking/rpcbind.nix
   ./services/networking/sabnzbd.nix
   ./services/networking/ssh/lshd.nix
   ./services/networking/ssh/sshd.nix

Modified: nixos/trunk/modules/services/network-filesystems/nfsd.nix
==============================================================================
--- nixos/trunk/modules/services/network-filesystems/nfsd.nix   Wed Mar 21 
20:35:15 2012        (r33341)
+++ nixos/trunk/modules/services/network-filesystems/nfsd.nix   Wed Mar 21 
20:37:37 2012        (r33342)
@@ -67,7 +67,7 @@
 
   config = mkIf cfg.enable {
 
-    services.portmap.enable = true;
+    services.rpcbind.enable = true;
 
     services.nfs.client.enable = true; # needed for statd and idmapd
 
@@ -89,7 +89,7 @@
 
         preStart =
           ''
-            ensure portmap
+            ensure rpcbind
             ensure mountd
 
             # Create a state directory required by NFSv4.
@@ -116,7 +116,7 @@
 
         preStart =
           ''
-            ensure portmap
+            ensure rpcbind
 
             mkdir -p /var/lib/nfs
             touch /var/lib/nfs/rmtab

Added: nixos/trunk/modules/services/networking/rpcbind.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixos/trunk/modules/services/networking/rpcbind.nix Wed Mar 21 20:37:37 
2012        (r33342)
@@ -0,0 +1,80 @@
+{ config, pkgs, ... }:
+
+with pkgs.lib;
+
+let
+
+  netconfigFile = {
+    target = "netconfig";
+    source = pkgs.writeText "netconfig" ''
+      #
+      # The network configuration file. This file is currently only used in
+      # conjunction with the TI-RPC code in the libtirpc library.
+      #
+      # Entries consist of:
+      #
+      #       <network_id> <semantics> <flags> <protofamily> <protoname> \
+      #               <device> <nametoaddr_libs>
+      #
+      # The <device> and <nametoaddr_libs> fields are always empty in this
+      # implementation.
+      #
+      udp        tpi_clts      v     inet     udp     -       -
+      tcp        tpi_cots_ord  v     inet     tcp     -       -
+      udp6       tpi_clts      v     inet6    udp     -       -
+      tcp6       tpi_cots_ord  v     inet6    tcp     -       -
+      rawip      tpi_raw       -     inet      -      -       -
+      local      tpi_cots_ord  -     loopback  -      -       -
+      unix       tpi_cots_ord  -     loopback  -      -       -
+    '';
+  };
+
+
+in
+
+{
+
+  ###### interface
+
+  options = {
+
+    services.rpcbind = {
+
+      enable = mkOption {
+        default = false;
+        description = ''
+          Whether to enable `rpcbind', an ONC RPC directory service
+          notably used by NFS and NIS, and which can be queried
+          using the rpcinfo(1) command. `rpcbind` is a replacement for
+          `portmap`.
+        '';
+      };
+
+    };
+
+  };
+
+
+  ###### implementation
+
+  config = mkIf config.services.rpcbind.enable {
+
+    environment.etc = [netconfigFile];
+
+    jobs.rpcbind =
+      { description = "ONC RPC rpcbind";
+
+        startOn = "started network-interfaces";
+        stopOn = "";
+
+        daemonType = "fork";
+
+        exec =
+          ''
+            ${pkgs.rpcbind}/bin/rpcbind
+          '';
+      };
+
+  };
+
+}

Modified: nixos/trunk/modules/tasks/filesystems/nfs.nix
==============================================================================
--- nixos/trunk/modules/tasks/filesystems/nfs.nix       Wed Mar 21 20:35:15 
2012        (r33341)
+++ nixos/trunk/modules/tasks/filesystems/nfs.nix       Wed Mar 21 20:37:37 
2012        (r33342)
@@ -49,7 +49,7 @@
 
   config = mkIf config.services.nfs.client.enable {
 
-    services.portmap.enable = true;
+    services.rpcbind.enable = true;
     
     system.fsPackages = [ pkgs.nfsUtils ];
 
@@ -72,7 +72,7 @@
 
         preStart =
           ''
-            ensure portmap
+            ensure rpcbind
             mkdir -p ${nfsStateDir}/sm
             mkdir -p ${nfsStateDir}/sm.bak
             sm-notify -d
@@ -92,7 +92,7 @@
 
         preStart =
           ''
-            ensure portmap
+            ensure rpcbind
             mkdir -p ${rpcMountpoint}
             mount -t rpc_pipefs rpc_pipefs ${rpcMountpoint}
           '';
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to