2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2012-03-21 21:37:37 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2012-03-21 21:37:37 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.rpcbind = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2012-03-21 21:37:37 +01:00
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc ''
|
2023-01-21 11:06:46 +01:00
|
|
|
Whether to enable `rpcbind`, an ONC RPC directory service
|
2012-03-21 21:37:37 +01: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 17:04:07 +02:00
|
|
|
config = mkIf config.services.rpcbind.enable {
|
2012-10-24 18:10:58 +02:00
|
|
|
environment.systemPackages = [ pkgs.rpcbind ];
|
2012-03-21 21:37:37 +01:00
|
|
|
|
2017-01-29 18:06:17 +01:00
|
|
|
systemd.packages = [ pkgs.rpcbind ];
|
2012-03-21 21:37:37 +01:00
|
|
|
|
2017-01-29 18:06:17 +01:00
|
|
|
systemd.services.rpcbind = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2022-11-21 21:43:28 +01: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 18:06:17 +01:00
|
|
|
};
|
2012-03-21 21:37:37 +01:00
|
|
|
|
2018-06-30 01:58:35 +02:00
|
|
|
users.users.rpc = {
|
2017-01-29 18:06:17 +01:00
|
|
|
group = "nogroup";
|
|
|
|
uid = config.ids.uids.rpc;
|
|
|
|
};
|
2013-09-26 17:04:07 +02:00
|
|
|
};
|
2012-03-21 21:37:37 +01:00
|
|
|
|
|
|
|
}
|