From 99243a5c514c888e09bbc13214a6ba23ea03d392 Mon Sep 17 00:00:00 2001 From: Jan Malakhovski Date: Thu, 12 Jun 2014 05:36:16 +0000 Subject: nixos: add atftpd service --- nixos/modules/module-list.nix | 1 + nixos/modules/services/networking/atftpd.nix | 51 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 nixos/modules/services/networking/atftpd.nix diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index 297ca0d1be4..f7ab4a474b8 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -192,6 +192,7 @@ ./services/network-filesystems/rsyncd.nix ./services/network-filesystems/samba.nix ./services/networking/amuled.nix + ./services/networking/atftpd.nix ./services/networking/avahi-daemon.nix ./services/networking/bind.nix ./services/networking/bitlbee.nix diff --git a/nixos/modules/services/networking/atftpd.nix b/nixos/modules/services/networking/atftpd.nix new file mode 100644 index 00000000000..ab9f8650f0f --- /dev/null +++ b/nixos/modules/services/networking/atftpd.nix @@ -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}"; + }; + + }; + +} -- cgit 1.4.1