nixos: add atftpd service
This commit is contained in:
parent
8f50d803ef
commit
99243a5c51
|
@ -192,6 +192,7 @@
|
||||||
./services/network-filesystems/rsyncd.nix
|
./services/network-filesystems/rsyncd.nix
|
||||||
./services/network-filesystems/samba.nix
|
./services/network-filesystems/samba.nix
|
||||||
./services/networking/amuled.nix
|
./services/networking/amuled.nix
|
||||||
|
./services/networking/atftpd.nix
|
||||||
./services/networking/avahi-daemon.nix
|
./services/networking/avahi-daemon.nix
|
||||||
./services/networking/bind.nix
|
./services/networking/bind.nix
|
||||||
./services/networking/bitlbee.nix
|
./services/networking/bitlbee.nix
|
||||||
|
|
51
nixos/modules/services/networking/atftpd.nix
Normal file
51
nixos/modules/services/networking/atftpd.nix
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
# NixOS module for atftpd TFTP server
|
||||||
|
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
cfg = config.services.atftpd;
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.atftpd = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
default = false;
|
||||||
|
type = types.uniq types.bool;
|
||||||
|
description = ''
|
||||||
|
Whenever to enable the atftpd TFTP server.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
root = mkOption {
|
||||||
|
default = "/var/empty";
|
||||||
|
type = types.uniq types.string;
|
||||||
|
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}";
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in a new issue