nixos/services.diod: remove with lib;
This commit is contained in:
parent
a9748cc118
commit
44985668d8
@ -1,5 +1,4 @@
|
|||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
cfg = config.services.diod;
|
cfg = config.services.diod;
|
||||||
|
|
||||||
@ -9,9 +8,9 @@ let
|
|||||||
allsquash = ${diodBool cfg.allsquash}
|
allsquash = ${diodBool cfg.allsquash}
|
||||||
auth_required = ${diodBool cfg.authRequired}
|
auth_required = ${diodBool cfg.authRequired}
|
||||||
exportall = ${diodBool cfg.exportall}
|
exportall = ${diodBool cfg.exportall}
|
||||||
exportopts = "${concatStringsSep "," cfg.exportopts}"
|
exportopts = "${lib.concatStringsSep "," cfg.exportopts}"
|
||||||
exports = { ${concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.exports)} }
|
exports = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.exports)} }
|
||||||
listen = { ${concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.listen)} }
|
listen = { ${lib.concatStringsSep ", " (map (s: ''"${s}"'' ) cfg.listen)} }
|
||||||
logdest = "${cfg.logdest}"
|
logdest = "${cfg.logdest}"
|
||||||
nwthreads = ${toString cfg.nwthreads}
|
nwthreads = ${toString cfg.nwthreads}
|
||||||
squashuser = "${cfg.squashuser}"
|
squashuser = "${cfg.squashuser}"
|
||||||
@ -23,14 +22,14 @@ in
|
|||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
services.diod = {
|
services.diod = {
|
||||||
enable = mkOption {
|
enable = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = "Whether to enable the diod 9P file server.";
|
description = "Whether to enable the diod 9P file server.";
|
||||||
};
|
};
|
||||||
|
|
||||||
listen = mkOption {
|
listen = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [ "0.0.0.0:564" ];
|
default = [ "0.0.0.0:564" ];
|
||||||
description = ''
|
description = ''
|
||||||
[ "IP:PORT" [,"IP:PORT",...] ]
|
[ "IP:PORT" [,"IP:PORT",...] ]
|
||||||
@ -38,8 +37,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
exports = mkOption {
|
exports = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
List the file systems that clients will be allowed to mount. All paths should
|
List the file systems that clients will be allowed to mount. All paths should
|
||||||
@ -54,8 +53,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
exportall = mkOption {
|
exportall = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Export all file systems listed in /proc/mounts. If new file systems are mounted
|
Export all file systems listed in /proc/mounts. If new file systems are mounted
|
||||||
@ -65,8 +64,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
exportopts = mkOption {
|
exportopts = lib.mkOption {
|
||||||
type = types.listOf types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
default = [];
|
default = [];
|
||||||
description = ''
|
description = ''
|
||||||
Establish a default set of export options. These are overridden, not appended
|
Establish a default set of export options. These are overridden, not appended
|
||||||
@ -74,8 +73,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
nwthreads = mkOption {
|
nwthreads = lib.mkOption {
|
||||||
type = types.int;
|
type = lib.types.int;
|
||||||
default = 16;
|
default = 16;
|
||||||
description = ''
|
description = ''
|
||||||
Sets the (fixed) number of worker threads created to handle 9P
|
Sets the (fixed) number of worker threads created to handle 9P
|
||||||
@ -83,16 +82,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
authRequired = mkOption {
|
authRequired = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Allow clients to connect without authentication, i.e. without a valid MUNGE credential.
|
Allow clients to connect without authentication, i.e. without a valid MUNGE credential.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
userdb = mkOption {
|
userdb = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
This option disables password/group lookups. It allows any uid to attach and
|
This option disables password/group lookups. It allows any uid to attach and
|
||||||
@ -100,8 +99,8 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
allsquash = mkOption {
|
allsquash = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Remap all users to "nobody". The attaching user need not be present in the
|
Remap all users to "nobody". The attaching user need not be present in the
|
||||||
@ -109,16 +108,16 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
squashuser = mkOption {
|
squashuser = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "nobody";
|
default = "nobody";
|
||||||
description = ''
|
description = ''
|
||||||
Change the squash user. The squash user must be present in the password file.
|
Change the squash user. The squash user must be present in the password file.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
logdest = mkOption {
|
logdest = lib.mkOption {
|
||||||
type = types.str;
|
type = lib.types.str;
|
||||||
default = "syslog:daemon:err";
|
default = "syslog:daemon:err";
|
||||||
description = ''
|
description = ''
|
||||||
Set the destination for logging.
|
Set the destination for logging.
|
||||||
@ -127,8 +126,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
statfsPassthru = mkOption {
|
statfsPassthru = lib.mkOption {
|
||||||
type = types.bool;
|
type = lib.types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
This option configures statfs to return the host file system's type
|
This option configures statfs to return the host file system's type
|
||||||
@ -136,15 +135,15 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = lib.mkOption {
|
||||||
type = types.lines;
|
type = lib.types.lines;
|
||||||
default = "";
|
default = "";
|
||||||
description = "Extra configuration options for diod.conf.";
|
description = "Extra configuration options for diod.conf.";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf config.services.diod.enable {
|
config = lib.mkIf config.services.diod.enable {
|
||||||
environment.systemPackages = [ pkgs.diod ];
|
environment.systemPackages = [ pkgs.diod ];
|
||||||
|
|
||||||
systemd.services.diod = {
|
systemd.services.diod = {
|
||||||
|
Loading…
Reference in New Issue
Block a user