add home-status.html

This commit is contained in:
Ingolf Wagner 2023-03-18 08:16:25 +01:00
parent b9be980ad3
commit 0a32439a4c
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
6 changed files with 47 additions and 4 deletions

View file

@ -150,6 +150,7 @@
};
specialArgs = {
inherit private_assets;
assets = ./nixos/assets;
};
};

View file

@ -4,7 +4,7 @@
home-manager.users.mainUser = {
programs.doom-emacs = {
enable = lib.mkDefault true;
doomPrivateDir = ../../../doom.d;
doomPrivateDir = ../../../../doom.d;
extraConfig = ''
;; "monospace" means use the system default. However, the default is usually two
;; points larger than I'd like, so I specify size 12 here.

View file

@ -104,6 +104,7 @@ in
bitwarden
sensu-go-cli
yq-go
];

View file

@ -31,6 +31,8 @@
./grafana.nix
./telegraf.nix
./home-display.nix
];
sops.defaultSopsFile = ../../secrets/pepe.yaml;

View file

@ -0,0 +1,40 @@
{ lib, pkgs, config, assets, ... }:
{
networking.firewall.allowedTCPPorts = [ 80 ];
networking.firewall.allowedUDPPorts = [ 80 ];
services.nginx.virtualHosts."${config.networking.hostName}.private" = {
locations."= /home-status.html".alias = "/srv/home-status/index.html";
};
systemd.services.home-status-refresh = {
enable = true;
script =
let
mustache = "${pkgs.mustache-go}/bin/mustache";
jq = "${pkgs.jq}/bin/jq";
index_html_template = refreshSeconds: pkgs.writeText "index_html.template" ''
<html>
<head><meta http-equiv="refresh" content="${toString refreshSeconds}"></head>
<body>{{ date }}</body>
</html>
'';
in
''
${jq} --raw-input '.' <(date +"%Y-%m-%d %H:%M";echo "hallo") \
| ${jq} --slurp '{ date : .[0], test : .[1] }' \
| ${mustache} ${index_html_template 60} > /srv/home-status/index.html
'';
};
systemd.timers.home-status-refresh = {
enable = true;
# man systemd.time
timerConfig.OnCalendar = "minutely";
wantedBy = [ "multi-user.target" ];
};
}

View file

@ -50,8 +50,7 @@
# use for pam (sudo)
# --------------------------
security.pam.u2f.enable = true;
security.pam.u2f.authFile =
toString config.sops.secrets.yubikey_u2fAuthFile.path;
security.pam.u2f.authFile = toString config.sops.secrets.yubikey_u2fAuthFile.path;
sops.secrets.yubikey_u2fAuthFile = { };
}