nixpkgs/nixos/modules/services/networking/atftpd.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.3 KiB
Nix
Raw Normal View History

2014-06-12 05:36:16 +00:00
# NixOS module for atftpd TFTP server
2014-09-29 13:45:59 +00:00
{ config, pkgs, lib, ... }:
2014-06-12 05:36:16 +00:00
let
cfg = config.services.atftpd;
in
{
options = {
services.atftpd = {
enable = lib.mkOption {
2014-06-12 05:36:16 +00:00
default = false;
type = lib.types.bool;
2014-06-12 05:36:16 +00:00
description = ''
Whether to enable the atftpd TFTP server. By default, the server
binds to address 0.0.0.0.
'';
};
extraOptions = lib.mkOption {
default = [];
type = lib.types.listOf lib.types.str;
example = lib.literalExpression ''
[ "--bind-address 192.168.9.1"
"--verbose=7"
]
'';
description = ''
Extra command line arguments to pass to atftp.
2014-06-12 05:36:16 +00:00
'';
};
root = lib.mkOption {
default = "/srv/tftp";
type = lib.types.path;
2014-06-12 05:36:16 +00:00
description = ''
Document root directory for the atftpd.
'';
};
};
};
config = lib.mkIf cfg.enable {
2014-06-12 05:36:16 +00:00
systemd.services.atftpd = {
description = "TFTP Server";
2014-06-12 05:36:16 +00:00
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
# runs as nobody
serviceConfig.ExecStart = "${pkgs.atftp}/sbin/atftpd --daemon --no-fork ${lib.concatStringsSep " " cfg.extraOptions} ${cfg.root}";
2014-06-12 05:36:16 +00:00
};
};
}