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.

+19 -5
+19 -5
nixos/modules/services/networking/atftpd.nix
··· 20 20 default = false; 21 21 type = types.bool; 22 22 description = '' 23 - Whenever to enable the atftpd TFTP server. 23 + Whether to enable the atftpd TFTP server. By default, the server 24 + binds to address 0.0.0.0. 25 + ''; 26 + }; 27 + 28 + extraOptions = mkOption { 29 + default = []; 30 + type = types.listOf types.str; 31 + example = literalExample '' 32 + [ "--bind-address 192.168.9.1" 33 + "--verbose=7" 34 + ] 35 + ''; 36 + description = '' 37 + Extra command line arguments to pass to atftp. 24 38 ''; 25 39 }; 26 40 27 41 root = mkOption { 28 - default = "/var/empty"; 29 - type = types.str; 42 + default = "/srv/tftp"; 43 + type = types.path; 30 44 description = '' 31 45 Document root directory for the atftpd. 32 46 ''; ··· 39 53 config = mkIf cfg.enable { 40 54 41 55 systemd.services.atftpd = { 42 - description = "atftpd TFTP server"; 56 + description = "TFTP Server"; 43 57 after = [ "network.target" ]; 44 58 wantedBy = [ "multi-user.target" ]; 45 59 # runs as nobody 46 - serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}"; 60 + serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.root}"; 47 61 }; 48 62 49 63 };