diff --git a/flake.lock b/flake.lock index d3638d3..1a221c4 100644 --- a/flake.lock +++ b/flake.lock @@ -270,21 +270,22 @@ "kubenix": { "inputs": { "flake-compat": "flake-compat_2", - "nixpkgs": "nixpkgs_2", + "nixpkgs": [ + "nixpkgs-unstable" + ], "systems": "systems_5", "treefmt": "treefmt" }, "locked": { - "lastModified": 1715243831, - "narHash": "sha256-i9FA95HFCoaQgsXRJkEAbr0iaWwy1xwuOAsBPEuEgxc=", + "lastModified": 1717788185, + "narHash": "sha256-Uc6QSQqJa2lyv/1W4StwoKrjtq7cFjlKNhdrtanToGo=", "owner": "pizzapim", "repo": "kubenix", - "rev": "79718967fafa379fd958224cb94d68f96da75ecd", + "rev": "a9590abe23a2f7577bc3271d90955e9ccc2923fe", "type": "github" }, "original": { "owner": "pizzapim", - "ref": "servers", "repo": "kubenix", "type": "github" } @@ -398,22 +399,6 @@ } }, "nixpkgs-unstable": { - "locked": { - "lastModified": 1716925596, - "narHash": "sha256-+iuYhP5k6PMjfhJjiEfBdaV95qejvGQPutthNpVhss8=", - "owner": "pizzapim", - "repo": "nixpkgs", - "rev": "9548d6e31291da38dc2c7b24a47730c25038a27e", - "type": "github" - }, - "original": { - "owner": "pizzapim", - "ref": "gatus", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1717646450, "narHash": "sha256-KE+UmfSVk5PG8jdKdclPVcMrUB8yVZHbsjo7ZT1Bm3c=", @@ -429,7 +414,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { "lastModified": 1717555607, "narHash": "sha256-WZ1s48OODmRJ3DHC+I/DtM3tDRuRJlNqMvxvAPTD7ec=", @@ -481,7 +466,7 @@ "kubenix": "kubenix", "nixhelm": "nixhelm", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "nixpkgs-unstable": "nixpkgs-unstable" } }, diff --git a/flake.nix b/flake.nix index 7ccd3f4..4278528 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,10 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; - nixpkgs-unstable.url = "github:pizzapim/nixpkgs/gatus"; + nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; deploy-rs.url = "github:serokell/deploy-rs"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; flake-utils.url = "github:numtide/flake-utils"; - kubenix.url = "github:pizzapim/kubenix/servers"; - disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; @@ -33,6 +31,11 @@ url = "git+https://git.kun.is/home/blog-pim"; inputs.nixpkgs.follows = "nixpkgs"; }; + + kubenix = { + url = "github:pizzapim/kubenix"; + inputs.nixpkgs.follows = "nixpkgs-unstable"; + }; }; outputs = diff --git a/nixos-modules/monitoring/default.nix b/nixos-modules/monitoring/default.nix index 1e46165..574af79 100644 --- a/nixos-modules/monitoring/default.nix +++ b/nixos-modules/monitoring/default.nix @@ -1,13 +1,8 @@ -{ lib, pkgs, nixpkgs-unstable, config, machines, ... }: +{ lib, config, machines, ... }: let cfg = config.lab.monitoring; in { - imports = [ - "${nixpkgs-unstable}/nixos/modules/services/monitoring/gatus.nix" - ./gatus-endpoints.nix - ]; - options = { lab.monitoring = { enable = lib.mkOption { @@ -48,63 +43,13 @@ in ); }; - services.gatus = lib.mkIf cfg.server.enable { - enable = true; - package = pkgs.unstable.gatus; - - settings = { - storage = { - type = "sqlite"; - path = "/srv/gatus/gatus.db"; - }; - - alerting.email = { - from = "gatus@kun.is"; - host = "mail.smtp2go.com"; - port = 2525; - to = "pim@kunis.nl"; - client.insecure = true; - - default-alert = { - enabled = true; - failure-threshold = 2; - success-threshold = 1; - send-on-resolved = true; - }; - }; - }; - }; - - users = { - users.gatus = { - isSystemUser = true; - group = "gatus"; - }; - - groups.gatus = { }; - }; - - system.activationScripts = lib.mkIf cfg.server.enable { - gatus = '' - mkdir -p /srv/gatus - chown gatus:gatus /srv/gatus - ''; - }; - services.nginx = lib.mkIf cfg.server.enable { enable = true; virtualHosts."${config.networking.fqdn}" = { - locations = { - "/" = { - proxyPass = "http://127.0.0.1:${toString config.services.gatus.settings.web.port}"; - recommendedProxySettings = true; - }; - - "/prometheus/" = { - proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}"; - recommendedProxySettings = true; - }; + locations."/prometheus/" = { + proxyPass = "http://127.0.0.1:${toString config.services.prometheus.port}"; + recommendedProxySettings = true; }; }; };