diff options
| author | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-02-26 11:48:44 -0600 |
|---|---|---|
| committer | Collin Williams <96917990+bluedragon1221@users.noreply.github.com> | 2026-02-26 11:48:44 -0600 |
| commit | 07c023cb185e7c49a04246a686dd2a560bb0d55f (patch) | |
| tree | 7566eda3dc43cbb3ec8c97ed996cc75b436fec82 /modules/services/nixos | |
| parent | af9357c2652605185214fb52a09c9472498d2a74 (diff) | |
btopweb
Diffstat (limited to 'modules/services/nixos')
| -rw-r--r-- | modules/services/nixos/btopweb.nix | 35 | ||||
| -rw-r--r-- | modules/services/nixos/goaccess.nix | 9 |
2 files changed, 39 insertions, 5 deletions
diff --git a/modules/services/nixos/btopweb.nix b/modules/services/nixos/btopweb.nix new file mode 100644 index 0000000..1975c5d --- /dev/null +++ b/modules/services/nixos/btopweb.nix @@ -0,0 +1,35 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.collinux.services.btopweb; +in { + imports = [ + (import ./mkCaddyCfg.nix cfg) + ]; + + config = lib.mkIf cfg.enable { + users.groups."btopweb" = {}; + users.users."btopweb" = { + isSystemUser = true; + group = "btopweb"; + }; + + systemd.services."btopweb" = { + description = "Host btop on a website"; + restartIfChanged = true; + wants = ["network-online.target"]; + after = ["network-online.target"]; + wantedBy = ["multi-user.target"]; + + serviceConfig = { + User = "btopweb"; + Type = "simple"; + + ExecStart = "${pkgs.gotty}/bin/gotty --reconnect --port ${toString cfg.port} ${pkgs.btop}/bin/btop"; + }; + }; + }; +} diff --git a/modules/services/nixos/goaccess.nix b/modules/services/nixos/goaccess.nix index a71a9c3..f8940c9 100644 --- a/modules/services/nixos/goaccess.nix +++ b/modules/services/nixos/goaccess.nix @@ -15,6 +15,8 @@ date-format = "%s"; log-format = "CADDY"; tz = config.time.timeZone; + log-file = "/var/log/caddy/access-williamsfam.us.com.log"; + geoip-database = geoip; ws-url = if cfg.publicUrl != null @@ -22,16 +24,13 @@ else if cfg.privateUrl != null then "wss://${cfg.privateUrl}:443/ws" else null; - port = "7890"; + port = 7890; addr = cfg.listenAddr; real-time-html = "true"; - log-file = "/var/log/caddy/access-williamsfam.us.com.log"; - geoip-database = geoip; output = "/var/www/goaccess/index.html"; external-assets = "true"; all-static-files = "false"; - html-report-title = "stats@ganymede"; hl-header = "true"; agent-list = "false"; @@ -45,7 +44,7 @@ real-os = "true"; }; - settingsFile = pkgs.writeText "goaccess.conf" (settings |> builtins.mapAttrs (k: v: "${k} ${v}") |> builtins.attrValues |> lib.concatStringsSep "\n"); + settingsFile = pkgs.writeText "goaccess.conf" (settings |> builtins.mapAttrs (k: v: "${k} ${toString v}") |> builtins.attrValues |> lib.concatStringsSep "\n"); in { imports = [ (import ./mkCaddyCfg.nix cfg) |
