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 '';
17 };
18
19 services.tftpd.path = mkOption {
20 type = types.path;
21 default = "/home/tftp";
22 description = ''
23 Where the tftp server files are stored.
24 '';
25 };
26
27 };
28
29
30 ###### implementation
31
32 config = mkIf config.services.tftpd.enable {
33
34 services.xinetd.enable = true;
35
36 services.xinetd.services = singleton
37 { name = "tftp";
38 protocol = "udp";
39 server = "${pkgs.netkittftp}/sbin/in.tftpd";
40 serverArgs = "${config.services.tftpd.path}";
41 };
42
43 };
44
45}