1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8{
9 options = {
10 services.tftpd.enable = lib.mkOption {
11 type = lib.types.bool;
12 default = false;
13 description = ''
14 Whether to enable tftpd, a Trivial File Transfer Protocol server.
15 The server will be run as an xinetd service.
16 '';
17 };
18
19 services.tftpd.path = lib.mkOption {
20 type = lib.types.path;
21 default = "/srv/tftp";
22 description = ''
23 Where the tftp server files are stored.
24 '';
25 };
26 };
27
28 config = lib.mkIf config.services.tftpd.enable {
29 services.xinetd.enable = true;
30
31 services.xinetd.services = lib.singleton {
32 name = "tftp";
33 protocol = "udp";
34 server = "${pkgs.netkittftp}/sbin/in.tftpd";
35 serverArgs = "${config.services.tftpd.path}";
36 };
37 };
38}