2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-03-21 20:37:37 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2012-03-21 20:37:37 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.rpcbind = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2012-03-21 20:37:37 +00:00
|
|
|
default = false;
|
|
|
|
description = ''
|
2023-01-21 10:06:46 +00:00
|
|
|
Whether to enable `rpcbind`, an ONC RPC directory service
|
2012-03-21 20:37:37 +00:00
|
|
|
notably used by NFS and NIS, and which can be queried
|
|
|
|
using the rpcinfo(1) command. `rpcbind` is a replacement for
|
|
|
|
`portmap`.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
2013-09-26 15:04:07 +00:00
|
|
|
config = mkIf config.services.rpcbind.enable {
|
2012-10-24 16:10:58 +00:00
|
|
|
environment.systemPackages = [ pkgs.rpcbind ];
|
2012-03-21 20:37:37 +00:00
|
|
|
|
2017-01-29 17:06:17 +00:00
|
|
|
systemd.packages = [ pkgs.rpcbind ];
|
2012-03-21 20:37:37 +00:00
|
|
|
|
2017-01-29 17:06:17 +00:00
|
|
|
systemd.services.rpcbind = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2022-11-21 20:43:28 +00:00
|
|
|
# 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" ];
|
2017-01-29 17:06:17 +00:00
|
|
|
};
|
2012-03-21 20:37:37 +00:00
|
|
|
|
2018-06-29 23:58:35 +00:00
|
|
|
users.users.rpc = {
|
2017-01-29 17:06:17 +00:00
|
|
|
group = "nogroup";
|
|
|
|
uid = config.ids.uids.rpc;
|
|
|
|
};
|
2013-09-26 15:04:07 +00:00
|
|
|
};
|
2012-03-21 20:37:37 +00:00
|
|
|
|
|
|
|
}
|