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