Adding idmapd, for NFSv4.

Patch by Rickard Nilsson.

This may fix rpc.statd start.


svn path=/nixos/trunk/; revision=33330
This commit is contained in:
Lluís Batlle i Rossell 2012-03-21 11:58:06 +00:00
parent 7a9a33e90d
commit 20edb255bd
3 changed files with 52 additions and 4 deletions

View File

@ -69,7 +69,7 @@ in
services.portmap.enable = true;
services.nfs.client.enable = true; # needed for statd
services.nfs.client.enable = true; # needed for statd and idmapd
environment.systemPackages = [ pkgs.nfsUtils ];
@ -105,6 +105,7 @@ in
postStart =
''
ensure statd
ensure idmapd
'';
};

View File

@ -187,6 +187,7 @@ in
${optionalString config.services.nfs.client.enable ''
ensure statd || true
ensure idmapd || true
''}
echo "mounting filesystems..."

View File

@ -6,6 +6,27 @@ let
inInitrd = any (fs: fs == "nfs") config.boot.initrd.supportedFilesystems;
nfsStateDir = "/var/lib/nfs";
rpcMountpoint = "${nfsStateDir}/rpc_pipefs";
idmapdConfFile = {
target = "idmapd.conf";
source = pkgs.writeText "idmapd.conf" ''
[General]
Pipefs-Directory = ${rpcMountpoint}
${optionalString (config.networking.domain != "")
"Domain = ${config.networking.domain}"}
[Mapping]
Nobody-User = nobody
Nobody-Group = nogroup
[Translation]
Method = nsswitch
'';
};
in
{
@ -40,6 +61,8 @@ in
cp -v ${pkgs.klibc}/lib/klibc/bin.static/nfsmount $out/bin
'';
environment.etc = singleton idmapdConfFile;
jobs.statd =
{ description = "Kernel NFS server - Network Status Monitor";
@ -50,9 +73,8 @@ in
preStart =
''
ensure portmap
mkdir -p /var/lib/nfs
mkdir -p /var/lib/nfs/sm
mkdir -p /var/lib/nfs/sm.bak
mkdir -p ${nfsStateDir}/sm
mkdir -p ${nfsStateDir}/sm.bak
sm-notify -d
'';
@ -61,5 +83,29 @@ in
exec = "rpc.statd --no-notify";
};
jobs.idmapd =
{ description = "Kernel NFS server - ID Map Daemon";
path = [ pkgs.nfsUtils pkgs.sysvtools pkgs.utillinux ];
stopOn = "starting shutdown";
preStart =
''
ensure portmap
mkdir -p ${rpcMountpoint}
mount -t rpc_pipefs rpc_pipefs ${rpcMountpoint}
'';
postStop =
''
umount ${rpcMountpoint}
'';
daemonType = "fork";
exec = "rpc.idmapd";
};
};
}