mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(graph.r): use geoip from updater, share with retiolum
This commit is contained in:
@@ -1,13 +1,12 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
network = "retiolum";
|
network = "retiolum";
|
||||||
|
|
||||||
stateDirectory = "retiolum-map";
|
stateDirectory = "retiolum-map";
|
||||||
|
|
||||||
geo-ip-database = pkgs.fetchurl {
|
geo-ip-database = "${lib.head config.services.geoipupdate.settings.EditionIDs}.mmdb";
|
||||||
url = "http://c.krebsco.de/GeoLite2-City.mmdb";
|
geo-ip-database-path = "${config.services.geoipupdate.settings.DatabaseDirectory}/${geo-ip-database}";
|
||||||
sha256 = "01lcmphcw4lgy02v9sa5xly991nsk0x0w6vm0dcr1mq6zg4b15v5";
|
|
||||||
};
|
|
||||||
tinc-graph-source = pkgs.fetchFromGitHub {
|
tinc-graph-source = pkgs.fetchFromGitHub {
|
||||||
owner = "kmein";
|
owner = "kmein";
|
||||||
repo = "tinc-graph";
|
repo = "tinc-graph";
|
||||||
@@ -21,7 +20,7 @@ in
|
|||||||
description = "Retiolum indexing service";
|
description = "Retiolum indexing service";
|
||||||
wants = [ "tinc.${network}.service" ];
|
wants = [ "tinc.${network}.service" ];
|
||||||
script = ''
|
script = ''
|
||||||
${tinc-graph}/bin/tinc-graph --geoip-file ${geo-ip-database} --network ${network} \
|
${tinc-graph}/bin/tinc-graph --geoip-file ${geo-ip-database-path} --network ${network} \
|
||||||
| ${pkgs.coreutils}/bin/tee network.json \
|
| ${pkgs.coreutils}/bin/tee network.json \
|
||||||
| ${tinc-graph}/bin/tinc-statistics > statistics.json
|
| ${tinc-graph}/bin/tinc-statistics > statistics.json
|
||||||
|
|
||||||
@@ -55,4 +54,15 @@ in
|
|||||||
recommendedTlsSettings = true;
|
recommendedTlsSettings = true;
|
||||||
virtualHosts."graph.r".locations."/".root = "/var/lib/${stateDirectory}";
|
virtualHosts."graph.r".locations."/".root = "/var/lib/${stateDirectory}";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services.geoip-share = {
|
||||||
|
after = [ "geoipupdate.service" ];
|
||||||
|
script = let
|
||||||
|
cyberlocker-tools = pkgs.callPackage <stockholm/krebs/5pkgs/simple/cyberlocker-tools> {};
|
||||||
|
in "${cyberlocker-tools}/bin/cput ${geo-ip-database} < ${geo-ip-database-path}";
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
DynamicUser = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user