1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/nixos/modules/services/networking/atftpd.nix

66 lines
1.2 KiB
Nix
Raw Normal View History

2014-06-12 06:36:16 +01:00
# NixOS module for atftpd TFTP server
2014-09-29 14:45:59 +01:00
{ config, pkgs, lib, ... }:
2014-06-12 06:36:16 +01:00
2014-09-29 14:45:59 +01:00
with lib;
2014-06-12 06:36:16 +01:00
let
cfg = config.services.atftpd;
in
{
options = {
services.atftpd = {
enable = mkOption {
default = false;
2015-06-15 17:10:26 +01:00
type = types.bool;
2014-06-12 06:36:16 +01:00
description = ''
Whether to enable the atftpd TFTP server. By default, the server
binds to address 0.0.0.0.
'';
};
extraOptions = mkOption {
default = [];
type = types.listOf types.str;
example = literalExample ''
[ "--bind-address 192.168.9.1"
"--verbose=7"
]
'';
description = ''
Extra command line arguments to pass to atftp.
2014-06-12 06:36:16 +01:00
'';
};
root = mkOption {
default = "/srv/tftp";
type = types.path;
2014-06-12 06:36:16 +01:00
description = ''
Document root directory for the atftpd.
'';
};
};
};
config = mkIf cfg.enable {
systemd.services.atftpd = {
description = "TFTP Server";
2014-06-12 06:36:16 +01: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 06:36:16 +01:00
};
};
}