chore(ci): flake update

This commit is contained in:
arcnmx 2024-06-30 10:44:12 -07:00
parent 51d9ac16f0
commit 46c14614a9
2 changed files with 26 additions and 24 deletions

24
flake.lock generated
View file

@ -160,11 +160,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1719588253, "lastModified": 1719677234,
"narHash": "sha256-A03i8xiVgP14DCmV5P7VUv37eodCjY4e1iai0b2EuuM=", "narHash": "sha256-qO9WZsj/0E6zcK4Ht1y/iJ8XfwbBzq7xdqhBh44OP/M=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "7e68e55d2e16d3a1e92a679430728c35a30fd24e", "rev": "36317d4d38887f7629876b0e43c8d9593c5cc48d",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -190,11 +190,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1719254875, "lastModified": 1719506693,
"narHash": "sha256-ECni+IkwXjusHsm9Sexdtq8weAq/yUyt1TWIemXt3Ko=", "narHash": "sha256-C8e9S7RzshSdHB7L+v9I51af1gDM5unhJ2xO1ywxNH8=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2893f56de08021cffd9b6b6dfc70fd9ccd51eb60", "rev": "b2852eb9365c6de48ffb0dc2c9562591f652242a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -206,11 +206,11 @@
}, },
"nixpkgs-stable": { "nixpkgs-stable": {
"locked": { "locked": {
"lastModified": 1719099622, "lastModified": 1719663039,
"narHash": "sha256-YzJECAxFt+U5LPYf/pCwW/e1iUd2PF21WITHY9B/BAs=", "narHash": "sha256-tXlrgAQygNIy49LDVFuPXlWD2zTQV9/F8pfoqwwPJyo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "5e8e3b89adbd0be63192f6e645e0a54080004924", "rev": "4a1e673523344f6ccc84b37f4413ad74ea19a119",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -267,11 +267,11 @@
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
"lastModified": 1719268571, "lastModified": 1719716556,
"narHash": "sha256-pcUk2Fg5vPXLUEnFI97qaB8hto/IToRfqskFqsjvjb8=", "narHash": "sha256-KA9gy2Wkv76s4A8eLnOcdKVTygewbw3xsB8+awNMyqs=",
"owner": "Mic92", "owner": "Mic92",
"repo": "sops-nix", "repo": "sops-nix",
"rev": "c2ea1186c0cbfa4d06d406ae50f3e4b085ddc9b3", "rev": "b5974d4331fb6c893e808977a2e1a6d34b3162d6",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -4,12 +4,8 @@
... ...
}: let }: let
inherit (lib.modules) mkIf mkMerge; inherit (lib.modules) mkIf mkMerge;
inherit (lib.attrsets) attrValues; inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) concatMap toList elem; inherit (lib.lists) any toList elem;
allExporters = let
exporters = removeAttrs config.services.prometheus.exporters ["unifi-poller"];
in
concatMap toList (attrValues exporters);
in { in {
config = { config = {
services.prometheus.exporters = { services.prometheus.exporters = {
@ -70,11 +66,17 @@ in {
]; ];
}; };
}; };
networking.firewall.interfaces.lan.allowedTCPPorts = networking.firewall.interfaces.lan.allowedTCPPorts = let
map ( # blacklist broken/deprecated exporters
exporter: allExporters = removeAttrs config.services.prometheus.exporters ["unifi-poller" "minio"];
mkIf (exporter.enable && !exporter.openFirewall) exporter.port enablePort = fallback: exporter: exporter.enable or fallback && !exporter.openFirewall or (!fallback);
) mkExporterPorts = name: exporters': let
allExporters; exporters = toList exporters';
allowedTCPPorts = map mkExporterPort exporters;
res = builtins.tryEval (any (enablePort true) exporters);
cond = lib.warnIf (!res.success) "broken prometheus exporter: ${name}" res.value;
in mkIf cond allowedTCPPorts;
mkExporterPort = exporter: mkIf (enablePort false exporter) exporter.port;
in mkMerge (mapAttrsToList mkExporterPorts allExporters);
}; };
} }