2014-06-12 07:36:16 +02:00
|
|
|
# NixOS module for atftpd TFTP server
|
|
|
|
|
2014-09-29 15:45:59 +02:00
|
|
|
{ config, pkgs, lib, ... }:
|
2014-06-12 07:36:16 +02:00
|
|
|
|
2014-09-29 15:45:59 +02:00
|
|
|
with lib;
|
2014-06-12 07:36:16 +02:00
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
cfg = config.services.atftpd;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
options = {
|
|
|
|
|
|
|
|
services.atftpd = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
2015-06-15 18:10:26 +02:00
|
|
|
type = types.bool;
|
2014-06-12 07:36:16 +02:00
|
|
|
description = ''
|
|
|
|
Whenever to enable the atftpd TFTP server.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
root = mkOption {
|
|
|
|
default = "/var/empty";
|
2015-06-15 17:42:55 +02:00
|
|
|
type = types.str;
|
2014-06-12 07:36:16 +02:00
|
|
|
description = ''
|
|
|
|
Document root directory for the atftpd.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
systemd.services.atftpd = {
|
|
|
|
description = "atftpd TFTP server";
|
|
|
|
after = [ "network.target" ];
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
# runs as nobody
|
|
|
|
serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|