Working tegola delpoy

This uses the data from Bonn, Germany which I downloaded from
https://github.com/go-spatial/tegola-example-bonn/tree/main
This commit is contained in:
Eli Ribble 2025-11-14 18:58:42 +00:00
parent 7315b7edba
commit 423c1e6d9f
No known key found for this signature in database
5 changed files with 118 additions and 0 deletions

View file

@ -25,6 +25,7 @@
./static-websites.nix
./sudo.nix
./synapse.nix
./tegola.nix
./timecardbot.nix
./tmux.nix
./twenty-crm.nix

View file

@ -35,6 +35,7 @@ in {
ensureDBOwnership = true;
name = databaseUser;
}];
extensions = ps: with ps; [ h3-pg postgis ];
};
services.restic.backups."${backupName}-db" = {
# We can use this due to overridding restic with unstable

58
modules/system/tegola.nix Normal file
View file

@ -0,0 +1,58 @@
{ config, configFiles, lib, pkgs, ... }:
with lib;
let
databaseName = "tegola";
databaseUser = "tegola";
group = "tegola";
user = "tegola";
in {
options.myModules.tegola.enable = mkEnableOption "custom tegola configuration";
config = mkIf config.myModules.tegola.enable {
environment = {
etc."tegola.toml" = {
group = group;
source = "${configFiles}/tegola.toml";
user = user;
};
systemPackages = with pkgs; [
tegola
];
};
networking.firewall.allowedTCPPorts = [ 9090 ];
services.postgresql = {
enable = true;
ensureDatabases = [databaseName];
ensureUsers = [{
ensureClauses.login = true;
ensureDBOwnership = true;
name = databaseUser;
}];
extensions = ps: with ps; [ h3-pg postgis ];
};
systemd.services."tegola" = {
after=["network.target" "network-online.target"];
description="Tegola Vector Tile";
path = [ pkgs.tegola ];
requires=["network-online.target"];
serviceConfig = {
Group = group;
ExecStart = "${pkgs.tegola}/bin/tegola serve --config /etc/tegola.toml";
PrivateTmp = true;
TimeoutStopSec = "5s";
Type = "simple";
User = user;
WorkingDirectory = "/tmp";
};
wantedBy = ["multi-user.target"];
};
users = {
groups."${group}" = {};
users."${user}" = {
group = group;
isSystemUser = true;
};
};
};
}