blob: 63c4859fbd07ad8c8e6e8638de8d76603722a30f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
{ config, lib, pkgs, ... }:
with lib;
{
###### interface
options = {
services.rpcbind = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
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.systemPackages = [ pkgs.rpcbind ];
systemd.packages = [ pkgs.rpcbind ];
systemd.services.rpcbind = {
wantedBy = [ "multi-user.target" ];
# rpcbind performs a check for /var/run/rpcbind.lock at startup
# and will crash if /var/run isn't present. In the stock NixOS
# var.conf tmpfiles configuration file, /var/run is symlinked to
# /run, so rpcbind can enter a race condition in which /var/run
# isn't symlinked yet but tries to interact with the path, so
# controlling the order explicitly here ensures that rpcbind can
# start successfully. The `wants` instead of `requires` should
# avoid creating a strict/brittle dependency.
wants = [ "systemd-tmpfiles-setup.service" ];
after = [ "systemd-tmpfiles-setup.service" ];
};
users.users.rpc = {
group = "nogroup";
uid = config.ids.uids.rpc;
};
};
}
|