diff --git a/nixos/modules/services/network-filesystems/nfsd.nix b/nixos/modules/services/network-filesystems/nfsd.nix index c40bcf28c28f..67597d37813f 100644 --- a/nixos/modules/services/network-filesystems/nfsd.nix +++ b/nixos/modules/services/network-filesystems/nfsd.nix @@ -1,7 +1,4 @@ { config, lib, pkgs, ... }: - -with lib; - let cfg = config.services.nfs.server; @@ -12,8 +9,8 @@ in { imports = [ - (mkRenamedOptionModule [ "services" "nfs" "lockdPort" ] [ "services" "nfs" "server" "lockdPort" ]) - (mkRenamedOptionModule [ "services" "nfs" "statdPort" ] [ "services" "nfs" "server" "statdPort" ]) + (lib.mkRenamedOptionModule [ "services" "nfs" "lockdPort" ] [ "services" "nfs" "server" "lockdPort" ]) + (lib.mkRenamedOptionModule [ "services" "nfs" "statdPort" ] [ "services" "nfs" "server" "statdPort" ]) ]; ###### interface @@ -23,24 +20,24 @@ in services.nfs = { server = { - enable = mkOption { - type = types.bool; + enable = lib.mkOption { + type = lib.types.bool; default = false; description = '' Whether to enable the kernel's NFS server. ''; }; - extraNfsdConfig = mkOption { - type = types.str; + extraNfsdConfig = lib.mkOption { + type = lib.types.str; default = ""; description = '' Extra configuration options for the [nfsd] section of /etc/nfs.conf. ''; }; - exports = mkOption { - type = types.lines; + exports = lib.mkOption { + type = lib.types.lines; default = ""; description = '' Contents of the /etc/exports file. See @@ -48,8 +45,8 @@ in ''; }; - hostName = mkOption { - type = types.nullOr types.str; + hostName = lib.mkOption { + type = lib.types.nullOr lib.types.str; default = null; description = '' Hostname or address on which NFS requests will be accepted. @@ -58,22 +55,22 @@ in ''; }; - nproc = mkOption { - type = types.int; + nproc = lib.mkOption { + type = lib.types.int; default = 8; description = '' Number of NFS server threads. Defaults to the recommended value of 8. ''; }; - createMountPoints = mkOption { - type = types.bool; + createMountPoints = lib.mkOption { + type = lib.types.bool; default = false; description = "Whether to create the mount points in the exports file at startup time."; }; - mountdPort = mkOption { - type = types.nullOr types.int; + mountdPort = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; example = 4002; description = '' @@ -81,8 +78,8 @@ in ''; }; - lockdPort = mkOption { - type = types.nullOr types.int; + lockdPort = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; example = 4001; description = '' @@ -92,8 +89,8 @@ in ''; }; - statdPort = mkOption { - type = types.nullOr types.int; + statdPort = lib.mkOption { + type = lib.types.nullOr lib.types.int; default = null; example = 4000; description = '' @@ -111,7 +108,7 @@ in ###### implementation - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { services.rpcbind.enable = true; @@ -137,7 +134,7 @@ in '' mkdir -p /var/lib/nfs - ${optionalString cfg.createMountPoints + ${lib.optionalString cfg.createMountPoints '' # create export directories: # skip comments, take first col which may either be a quoted