2014-04-14 14:26:48 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-08-21 13:05:45 +00:00
|
|
|
|
2014-04-14 14:26:48 +00:00
|
|
|
with lib;
|
2009-08-21 13:05:45 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 18:20:50 +00:00
|
|
|
|
2009-08-21 13:05:45 +00:00
|
|
|
options = {
|
|
|
|
|
|
|
|
services.tftpd.enable = mkOption {
|
2015-02-01 14:57:28 +00:00
|
|
|
type = types.bool;
|
2009-08-21 13:05:45 +00:00
|
|
|
default = false;
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2015-02-01 14:57:28 +00:00
|
|
|
Whether to enable tftpd, a Trivial File Transfer Protocol server.
|
2016-10-17 14:13:49 +00:00
|
|
|
The server will be run as an xinetd service.
|
2009-08-21 13:05:45 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.tftpd.path = mkOption {
|
2015-02-01 14:57:28 +00:00
|
|
|
type = types.path;
|
2016-10-17 14:14:08 +00:00
|
|
|
default = "/srv/tftp";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2015-02-01 14:57:28 +00:00
|
|
|
Where the tftp server files are stored.
|
2009-08-21 13:05:45 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf config.services.tftpd.enable {
|
|
|
|
|
|
|
|
services.xinetd.enable = true;
|
|
|
|
|
|
|
|
services.xinetd.services = singleton
|
|
|
|
{ name = "tftp";
|
|
|
|
protocol = "udp";
|
|
|
|
server = "${pkgs.netkittftp}/sbin/in.tftpd";
|
|
|
|
serverArgs = "${config.services.tftpd.path}";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|