1 # NixOS module for atftpd TFTP server
2 { config, pkgs, lib, ... }:
5 cfg = config.services.atftpd;
15 enable = lib.mkOption {
17 type = lib.types.bool;
19 Whether to enable the atftpd TFTP server. By default, the server
20 binds to address 0.0.0.0.
24 extraOptions = lib.mkOption {
26 type = lib.types.listOf lib.types.str;
27 example = lib.literalExpression ''
28 [ "--bind-address 192.168.9.1"
33 Extra command line arguments to pass to atftp.
38 default = "/srv/tftp";
39 type = lib.types.path;
41 Document root directory for the atftpd.
49 config = lib.mkIf cfg.enable {
51 systemd.services.atftpd = {
52 description = "TFTP Server";
53 after = [ "network.target" ];
54 wantedBy = [ "multi-user.target" ];
56 serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.root}";