update pvlog

This commit is contained in:
Kopatz
2025-11-22 14:26:43 +01:00
parent 943584e20b
commit e97d1c0947
4 changed files with 51 additions and 1 deletions

View File

@@ -88,6 +88,10 @@ in
"domain" = "yt.home.arpa";
"answer" = ip;
}
{
"domain" = "pvlog.home.arpa";
"answer" = ip;
}
{
"domain" = "nextcloud.home.arpa";
"answer" = wireguardIp;

View File

@@ -27,6 +27,16 @@ in
default = "/";
description = "Location under which the data logger is reachable";
};
fqdn = mkOption {
type = types.str;
default = "pvlog.home.arpa";
description = "FQDN under which the data logger is reachable";
};
useStepCa = mkOption {
type = types.bool;
default = true;
description = "Use step-ca for ACME certificates";
};
};
};
@@ -38,6 +48,22 @@ in
group = "kop-pvlog";
};
users.groups.kop-pvlog = { };
security.acme.certs."${cfg.fqdn}" = lib.mkIf cfg.useStepCa {
server = "https://127.0.0.1:8443/acme/kop-acme/directory";
};
services.nginx.virtualHosts."${cfg.fqdn}" = {
forceSSL = true;
enableACME = true;
quic = true;
http3 = true;
locations."/".proxyPass = "http://127.0.0.1:${builtins.toString cfg.port}";
locations."/".extraConfig = ''
more_clear_headers 'x-frame-options';
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Authorization, Origin, X-Requested-With, Content-Type, Accept";
'';
};
systemd.services.kop-pvlog = {
description = "Fronius data logger";
wants = [ "network-online.target" ];

View File

@@ -12,7 +12,7 @@ buildGoModule rec {
src = fetchGit {
url = "gitolite@kopatz.dev:kop-pvlog.git";
ref = "master";
rev = "23828dfa1275aac2b31e16b5e3cfb452d56aeae6";
rev = "2bb67c4b27bba9b99cf2182f989a53bb7f346659";
};
vendorHash = "sha256-8wYERVt3PIsKkarkwPu8Zy/Sdx43P6g2lz2xRfvTZ2E=";

20
pkgs/kop-pvlog/update.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p jq nix-prefetch-git
set -e
PACKAGE_FILE="default.nix" # Replace with your package file path
REPO_URL="gitolite@kopatz.dev:kop-pvlog.git" # Replace with the repository URL
echo "Fetching latest revision from $REPO_URL..."
# Get the latest revision and sha256
latest_rev=$(nix-prefetch-git $REPO_URL | jq -r '.rev')
echo "Latest revision: $latest_rev"
# Update the package file with the new revision and sha256
sed -i "s|rev = \".*\";|rev = \"$latest_rev\";|" $PACKAGE_FILE
echo "Package file $PACKAGE_FILE updated successfully."