add home-status.html
This commit is contained in:
parent
b9be980ad3
commit
0a32439a4c
6 changed files with 47 additions and 4 deletions
|
@ -150,6 +150,7 @@
|
||||||
};
|
};
|
||||||
specialArgs = {
|
specialArgs = {
|
||||||
inherit private_assets;
|
inherit private_assets;
|
||||||
|
assets = ./nixos/assets;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -261,7 +262,7 @@
|
||||||
nixos-hardware.nixosModules.common-gpu-intel
|
nixos-hardware.nixosModules.common-gpu-intel
|
||||||
];
|
];
|
||||||
home-manager.users.root = {
|
home-manager.users.root = {
|
||||||
home.stateVersion = "22.11";
|
home.stateVersion = "22.11";
|
||||||
imports = [
|
imports = [
|
||||||
doom-emacs-nix.hmModule
|
doom-emacs-nix.hmModule
|
||||||
];
|
];
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
home-manager.users.mainUser = {
|
home-manager.users.mainUser = {
|
||||||
programs.doom-emacs = {
|
programs.doom-emacs = {
|
||||||
enable = lib.mkDefault true;
|
enable = lib.mkDefault true;
|
||||||
doomPrivateDir = ../../../doom.d;
|
doomPrivateDir = ../../../../doom.d;
|
||||||
extraConfig = ''
|
extraConfig = ''
|
||||||
;; "monospace" means use the system default. However, the default is usually two
|
;; "monospace" means use the system default. However, the default is usually two
|
||||||
;; points larger than I'd like, so I specify size 12 here.
|
;; points larger than I'd like, so I specify size 12 here.
|
||||||
|
|
|
@ -104,6 +104,7 @@ in
|
||||||
bitwarden
|
bitwarden
|
||||||
|
|
||||||
sensu-go-cli
|
sensu-go-cli
|
||||||
|
yq-go
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
./grafana.nix
|
./grafana.nix
|
||||||
./telegraf.nix
|
./telegraf.nix
|
||||||
|
|
||||||
|
./home-display.nix
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
sops.defaultSopsFile = ../../secrets/pepe.yaml;
|
sops.defaultSopsFile = ../../secrets/pepe.yaml;
|
||||||
|
|
40
nixos/machines/pepe/home-display.nix
Normal file
40
nixos/machines/pepe/home-display.nix
Normal 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" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -50,8 +50,7 @@
|
||||||
# use for pam (sudo)
|
# use for pam (sudo)
|
||||||
# --------------------------
|
# --------------------------
|
||||||
security.pam.u2f.enable = true;
|
security.pam.u2f.enable = true;
|
||||||
security.pam.u2f.authFile =
|
security.pam.u2f.authFile = toString config.sops.secrets.yubikey_u2fAuthFile.path;
|
||||||
toString config.sops.secrets.yubikey_u2fAuthFile.path;
|
|
||||||
sops.secrets.yubikey_u2fAuthFile = { };
|
sops.secrets.yubikey_u2fAuthFile = { };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue