1# NixOS module for atftpd TFTP server 2 3{ config, pkgs, lib, ... }: 4 5with lib; 6 7let 8 9 cfg = config.services.atftpd; 10 11in 12 13{ 14 15 options = { 16 17 services.atftpd = { 18 19 enable = mkOption { 20 default = false; 21 type = types.bool; 22 description = '' 23 Whenever to enable the atftpd TFTP server. 24 ''; 25 }; 26 27 root = mkOption { 28 default = "/var/empty"; 29 type = types.str; 30 description = '' 31 Document root directory for the atftpd. 32 ''; 33 }; 34 35 }; 36 37 }; 38 39 config = mkIf cfg.enable { 40 41 systemd.services.atftpd = { 42 description = "atftpd TFTP server"; 43 after = [ "network.target" ]; 44 wantedBy = [ "multi-user.target" ]; 45 # runs as nobody 46 serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork --bind-address 0.0.0.0 ${cfg.root}"; 47 }; 48 49 }; 50 51}