Migrated Docker config to nix

This commit is contained in:
2026-04-11 11:36:08 +02:00
parent 104b1cfd38
commit c8bcc35e7c
7 changed files with 114 additions and 12 deletions

49
nixos/roles/wyl.nix Normal file
View File

@@ -0,0 +1,49 @@
{ config, pkgs, ... }:
let
serverIP = builtins.head (
builtins.match "([0-9.]+)/.*" config.systemd.network.networks."10-ethernet".networkConfig.Address
);
iface = config.systemd.network.networks."10-ethernet".matchConfig.Name;
in
{
networking.firewall.allowedTCPPorts = [ 8840 ];
systemd.services.watchyourlan = {
description = "WatchYourLAN network scanner";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
ExecStart = "${pkgs.watchyourlan}/bin/WatchYourLAN";
Restart = "always";
StateDirectory = "watchyourlan";
WorkingDirectory = "/var/lib/watchyourlan";
AmbientCapabilities = [ "CAP_NET_RAW" ];
};
environment = {
IFACES = iface;
GUIIP = "127.0.0.1";
GUIPORT = "8840";
PROMETHEUS = "true";
};
};
services = {
nginx = {
enable = true;
virtualHosts."${serverIP}".locations."/wyl/" = {
proxyPass = "http://127.0.0.1:8840/";
proxyWebsockets = true;
};
};
prometheus.scrapeConfigs = [
{
job_name = "watchyourlan";
static_configs = [
{
targets = [ "127.0.0.1:8840" ];
}
];
}
];
};
}