mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-01 18:12:46 +00:00
52 lines
871 B
Nix
52 lines
871 B
Nix
# NixOS module for atftpd TFTP server
|
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.services.atftpd;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
services.atftpd = {
|
|
|
|
enable = mkOption {
|
|
default = false;
|
|
type = types.bool;
|
|
description = ''
|
|
Whenever to enable the atftpd TFTP server.
|
|
'';
|
|
};
|
|
|
|
root = mkOption {
|
|
default = "/var/empty";
|
|
type = types.str;
|
|
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}";
|
|
};
|
|
|
|
};
|
|
|
|
}
|