1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-18 03:30:45 +00:00

Adding xinetd with a possible tftpd server.

svn path=/nixos/trunk/; revision=16784
This commit is contained in:
Lluís Batlle i Rossell 2009-08-19 20:20:51 +00:00
parent 4e646bf39c
commit f250f69ee8
2 changed files with 96 additions and 0 deletions

View file

@ -69,6 +69,7 @@
./services/networking/ssh/lshd.nix
./services/networking/ssh/sshd.nix
./services/networking/vsftpd.nix
./services/networking/xinetd.nix
./services/networking/wpa_supplicant.nix
./services/printing/cupsd.nix
./services/scheduling/atd.nix

View file

@ -0,0 +1,95 @@
{pkgs, config, ...}:
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
services = {
xinetd = {
enable = mkOption {
default = false;
description = "
Whether to enable the vsftpd FTP server.
";
};
tftpd = {
enable = mkOption {
default = false;
description = "
Whether to enable the anonymous FTP user.
";
};
path = mkOption {
default = "/home/tftp";
description = "
Where the tftp server files are stored
";
};
};
};
};
};
in
###### implementation
let
inherit (config.services.xinetd) tftpd;
inherit (pkgs) xinetd;
tftpservice = ''
service tftp
{
protocol = udp
port = 69
socket_type = dgram
wait = yes
user = nobody
server = ${pkgs.netkittftp}/sbin/in.tftpd
server_args = ${tftpd.path}
disable = no
}
'';
configFile = pkgs.writeText "xinetd.conf" ''
defaults
{
log_type = SYSLOG daemon info
log_on_failure = HOST
log_on_success = PID HOST DURATION EXIT
}
${if tftpd.enable then tftpservice else ""}
'';
in
mkIf config.services.xinetd.enable {
require = [
options
];
services = {
extraJobs = [{
name = "xinetd";
job = ''
description "xinetd server"
start on network-interfaces/started
stop on network-interfaces/stop
start script
mkdir -p ${tftpd.path}
end script
respawn ${xinetd}/sbin/xinetd -stayalive -f ${configFile}
'';
}];
};
}