raven/labsync: declaratively build tftp env

Fixes #8.
This commit is contained in:
Simon Bruder 2021-12-28 09:49:44 +01:00
parent 59ff307047
commit 71769cb74c
No known key found for this signature in database
GPG key ID: 8D3C82F9F309F8EC
5 changed files with 38 additions and 3 deletions

View file

@ -0,0 +1,40 @@
# legacy labsync, currently partly implemented in docker outside of this configuration
{ pkgs, ... }:
{
services.opentracker.enable = true;
services.nginx.virtualHosts."labsync.lab.fablab-nea.de" = {
locations = {
"/" = {
root = "/opt/docker/tftpgen/data";
extraConfig = ''
autoindex on;
'';
};
"/generator/".proxyPass = "http://127.0.0.1:8695/";
};
};
services.atftpd = {
enable = true;
root = pkgs.runCommand "pxelinux-tftproot" { } ''
mkdir -p $out/pxelinux.cfg
cp ${pkgs.syslinux}/share/syslinux/{ldlinux.c32,libcom32.c32,libutil.c32,lpxelinux.0,vesamenu.c32} $out
cp ${./splash.png} $out/splash.png
cp ${./pxelinux.cfg} $out/pxelinux.cfg/default
# required to serve labsync/labsync.cfg, which is generated dynamically by a docker container
ln -s /opt/docker/tftpgen/data $out/labsync
'';
};
networking.firewall.allowedTCPPorts = [
6881 # aria2
6969 # opentracker
];
networking.firewall.allowedUDPPorts = [
6882 # aria2
69 # tftpd
6969 # opentracker
];
}