summaryrefslogtreecommitdiffstats
path: root/nixos/modules/services/networking/atftpd.nix
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2016-10-16 17:54:49 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2016-10-17 16:20:24 +0200
commitf3876cbba0fe8eb5137c58560de40788c40f17de (patch)
tree378dabe7d0e9afcb478591b00a3968d9a78631c4 /nixos/modules/services/networking/atftpd.nix
parent953fd050c0b6322bb276238ce30ed25088990048 (diff)
nixos/atftpd: various improvements
* Add extraOptions option, to pass arbitrary command line options to atftp. Especially useful to specify which address to bind to (--bind-addres ...). * Improve descriptions (fix a typo, document default bind address, don't repeat service name in systemd description + capitalize) * Change default server directory from /var/empty to /srv/tftp, and change types.str to types.path.
Diffstat (limited to 'nixos/modules/services/networking/atftpd.nix')
-rw-r--r--nixos/modules/services/networking/atftpd.nix24
1 files changed, 19 insertions, 5 deletions
diff --git a/nixos/modules/services/networking/atftpd.nix b/nixos/modules/services/networking/atftpd.nix
index d875ddc63528..e7fd48c99a85 100644
--- a/nixos/modules/services/networking/atftpd.nix
+++ b/nixos/modules/services/networking/atftpd.nix
@@ -20,13 +20,27 @@ in
default = false;
type = types.bool;
description = ''
- Whenever to enable the atftpd TFTP server.
+ Whether to enable the atftpd TFTP server. By default, the server
+ binds to address 0.0.0.0.
+ '';
+ };
+
+ extraOptions = mkOption {
+ default = [];
+ type = types.listOf types.str;
+ example = literalExample ''
+ [ "--bind-address 192.168.9.1"
+ "--verbose=7"
+ ]
+ '';
+ description = ''
+ Extra command line arguments to pass to atftp.
'';
};
root = mkOption {
- default = "/var/empty";
- type = types.str;
+ default = "/srv/tftp";
+ type = types.path;
description = ''
Document root directory for the atftpd.
'';
@@ -39,11 +53,11 @@ in
config = mkIf cfg.enable {
systemd.services.atftpd = {
- description = "atftpd TFTP server";
+ description = "TFTP Server";
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
# runs as nobody
- serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}";
+ serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.root}";
};
};