diff --git a/flake.nix b/flake.nix index e79cf56c..3aa47740 100644 --- a/flake.nix +++ b/flake.nix @@ -136,6 +136,7 @@ download = "download.${baseName}"; files = "files.${baseName}"; git = "git.${baseName}"; + hister = "hister.${baseName}"; imap = "imap.purelymail.com"; influxdb = "influxdb.${baseName}"; irc = "irc.${baseName}"; diff --git a/platforms/nixos/modules/nmasur/presets/services/hister.nix b/platforms/nixos/modules/nmasur/presets/services/hister.nix new file mode 100644 index 00000000..0611f67d --- /dev/null +++ b/platforms/nixos/modules/nmasur/presets/services/hister.nix @@ -0,0 +1,59 @@ +{ + config, + lib, + ... +}: + +let + inherit (config.nmasur.settings) hostnames; + cfg = config.nmasur.presets.services.hister; +in + +{ + + options.nmasur.presets.services.hister = { + enable = lib.mkEnableOption "Hister web history service"; + port = lib.mkOption { + type = lib.types.port; + description = "Port to use for the localhost"; + default = 4433; + }; + }; + + config = lib.mkIf cfg.enable { + + services.hister = { + enable = true; + port = cfg.port; + settings = { + app = { + user_handling = true; + }; + server = { + base_url = "https://${hostnames.hister}"; + }; + }; + }; + + # Adding new users: + # sudo -u hister hister --config /run/hister/config.yml create-user --admin + + # Allow web traffic to Caddy + nmasur.presets.services.caddy.routes = [ + { + match = [ { host = [ hostnames.hister ]; } ]; + handle = [ + { + handler = "reverse_proxy"; + upstreams = [ { dial = "localhost:${builtins.toString cfg.port}"; } ]; + } + ]; + } + ]; + + # Configure Cloudflare DNS to point to this machine + services.cloudflare-dyndns.domains = [ hostnames.hister ]; + + }; + +} diff --git a/platforms/nixos/modules/nmasur/profiles/communications.nix b/platforms/nixos/modules/nmasur/profiles/communications.nix index 0a22ceb1..0e828c77 100644 --- a/platforms/nixos/modules/nmasur/profiles/communications.nix +++ b/platforms/nixos/modules/nmasur/profiles/communications.nix @@ -43,6 +43,7 @@ in cloudflared.enable = lib.mkDefault true; gitea.enable = lib.mkDefault true; grafana.enable = lib.mkDefault true; + hister.enable = lib.mkDefault true; influxdb2.enable = lib.mkDefault true; karakeep.enable = lib.mkDefault true; litestream.enable = lib.mkDefault true;