2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-08-21 14:05:45 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-08-21 14:05:45 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-21 14:05:45 +01:00
|
|
|
options = {
|
|
|
|
|
|
|
|
services.tftpd.enable = mkOption {
|
2015-02-01 14:57:28 +00:00
|
|
|
type = types.bool;
|
2009-08-21 14:05:45 +01:00
|
|
|
default = false;
|
|
|
|
description = ''
|
2015-02-01 14:57:28 +00:00
|
|
|
Whether to enable tftpd, a Trivial File Transfer Protocol server.
|
2009-08-21 14:05:45 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
services.tftpd.path = mkOption {
|
2015-02-01 14:57:28 +00:00
|
|
|
type = types.path;
|
2009-08-21 14:05:45 +01:00
|
|
|
default = "/home/tftp";
|
|
|
|
description = ''
|
2015-02-01 14:57:28 +00:00
|
|
|
Where the tftp server files are stored.
|
2009-08-21 14:05:45 +01: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}";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|