flake update

This commit is contained in:
Robin Appelman 2025-06-02 22:32:40 +02:00
commit 4c13f63e2f
3 changed files with 104 additions and 68 deletions

View file

@ -29,8 +29,8 @@ delay = 300
## Parameters ## Parameters
To remove the need to hard code ip addresses or host names, you can configure parameters to query for an ip address and To remove the need to hard code ip addresses or host names, you can configure
use it in a query or url. parameters to query for an ip address and use it in a query or url.
### MDNS ### MDNS
@ -38,8 +38,9 @@ use it in a query or url.
params.host = { type = "mdns", service = "_switch-http._tcp.local", host = "switch2" } params.host = { type = "mdns", service = "_switch-http._tcp.local", host = "switch2" }
``` ```
Will attempt to lookup a host advertising itself under the `_switch-http._tcp.local` service with host name `switch2` Will attempt to lookup a host advertising itself under the
and return the ip address and port of the host. `_switch-http._tcp.local` service with host name `switch2` and return the ip
address and port of the host.
### Service ### Service
@ -47,5 +48,7 @@ and return the ip address and port of the host.
params.host = { type = "service", file = "services.json", key = "hostname", value = "switch2" } params.host = { type = "service", file = "services.json", key = "hostname", value = "switch2" }
``` ```
Will look for a host in a json file in [prometheus' file based service discovery format](https://prometheus.io/docs/guides/file-sd/) Will look for a host in a json file in
for an entry containing the label `hostname` with value `switch2` and return the first target. [prometheus' file based service discovery format](https://prometheus.io/docs/guides/file-sd/)
for an entry containing the label `hostname` with value `switch2` and return the
first target.

95
flake.lock generated
View file

@ -1,56 +1,103 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "crane": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1742394900,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-vVOAp9ahvnU+fQoKd4SEXB2JG2wbENkpqcwlkIXgUC0=",
"owner": "numtide", "owner": "ipetkov",
"repo": "flake-utils", "repo": "crane",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "rev": "70947c1908108c0c551ddfd73d4f750ff2ea67cd",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "ipetkov",
"repo": "flake-utils", "repo": "crane",
"type": "github" "type": "github"
} }
}, },
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1748868585,
"narHash": "sha256-DrrbahOQAwvNM8l5EuGxxkVS7X5/S59zcG0N9ZWQFhk=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "dfbecd12d99c1bf82906521a6a7d5b75d2aa1ca2",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1748205441,
"narHash": "sha256-W+UUBT/l1DSTZo5G43494mRNNspJ2i9jW2QELC9JuMQ=",
"ref": "refs/heads/main",
"rev": "dac3b74a89cebbeb21cc6602e4a346604adbee8b",
"revCount": 49,
"type": "git",
"url": "https://codeberg.org/icewind/mill-scale"
},
"original": {
"type": "git",
"url": "https://codeberg.org/icewind/mill-scale"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1707650010, "lastModified": 1748708770,
"narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=", "narHash": "sha256-q8jG2HJWgooWa9H0iatZqBPF3bp0504e05MevFmnFLY=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6", "rev": "a59eb7800787c926045d51b70982ae285faa2346",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.11", "ref": "nixos-25.05",
"type": "indirect" "type": "indirect"
} }
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "flakelight": "flakelight",
"mill-scale": "mill-scale",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
}, },
"systems": { "rust-overlay": {
"inputs": {
"nixpkgs": [
"mill-scale",
"flakelight",
"nixpkgs"
]
},
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1742697269,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Lpp0XyAtIl1oGJzNmTiTGLhTkcUjwSkEb0gOiNzYFGM=",
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "rev": "01973c84732f9275c50c5f075dd1f54cc04b3316",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
} }

View file

@ -1,36 +1,21 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs.url = "nixpkgs/nixos-25.05";
flake-utils.url = "github:numtide/flake-utils"; flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
}; };
mill-scale = {
url = "git+https://codeberg.org/icewind/mill-scale";
inputs.flakelight.follows = "flakelight";
};
};
outputs = {mill-scale, ...}:
mill-scale ./. {
packages.tasprompto = import ./package.nix;
outputs = { nixosModules = {outputs, ...}: {
self, default = {
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [
(import ./overlay.nix)
];
pkgs = (import nixpkgs) {
inherit system overlays;
};
in rec {
packages = rec {
prometheus-edge-trigger = pkgs.prometheus-edge-trigger;
default = prometheus-edge-trigger;
};
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy cargo-audit];
};
}
)
// {
overlays.default = import ./overlay.nix;
nixosModules.default = {
pkgs, pkgs,
config, config,
lib, lib,
@ -38,9 +23,10 @@
}: { }: {
imports = [./module.nix]; imports = [./module.nix];
config = lib.mkIf config.services.prometheus-edge-trigger.enable { config = lib.mkIf config.services.prometheus-edge-trigger.enable {
nixpkgs.overlays = [self.overlays.default]; nixpkgs.overlays = [outputs.overlays.default];
services.prometheus-edge-trigger.package = lib.mkDefault pkgs.prometheus-edge-trigger; services.prometheus-edge-trigger.package = lib.mkDefault pkgs.prometheus-edge-trigger;
}; };
}; };
}; };
};
} }