1
0
Fork 0
mirror of https://codeberg.org/icewind/prometheus-mdns-rs.git synced 2026-06-03 18:04:11 +02:00

flake reorg

This commit is contained in:
Robin Appelman 2024-12-15 14:35:27 +01:00
commit d7fde02c00
10 changed files with 140 additions and 140 deletions

View file

@ -1,34 +1,17 @@
on: [push, pull_request] name: "CI"
on:
name: CI pull_request:
push:
jobs: jobs:
build: checks:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: cachix/install-nix-action@v25 - uses: cachix/install-nix-action@v26
- uses: icewind1991/attic-action@v1 - uses: icewind1991/attic-action@v1
with: with:
name: ci name: ci
instance: https://cache.icewind.me instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}' authToken: "${{ secrets.ATTIC_TOKEN }}"
- run: nix build - run: nix flake check --keep-going
docker:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v3
- uses: cachix/install-nix-action@v25
- uses: icewind1991/attic-action@v1
with:
name: ci
instance: https://cache.icewind.me
authToken: '${{ secrets.ATTIC_TOKEN }}'
- run: nix build .#docker
- name: Push image
if: github.ref == 'refs/heads/master'
run: |
skopeo copy --dest-creds="${{ secrets.DOCKERHUB_USERNAME }}:${{ secrets.DOCKERHUB_TOKEN }}" "docker-archive:$(nix build .#docker --print-out-paths)" "docker://icewind1991/prometheus-mdns-sd"

View file

@ -1,6 +1,6 @@
# mDNS service discovery for Prometheus # mDNS service discovery for Prometheus
Discovers mDNS/ZeroConf/Bonjour service announcements under _prometheus-http._tcp for ad-hoc discovery of devices on LAN networks. Discovers mDNS/ZeroConf/Bonjour service announcements under \_prometheus-http.\_tcp for ad-hoc discovery of devices on LAN networks.
## Usage ## Usage

View file

@ -1,16 +0,0 @@
{
dockerTools,
prometheus-mdns-sd,
}:
dockerTools.buildLayeredImage {
name = "icewind1991/prometheus-mdns-sd";
tag = "latest";
maxLayers = 5;
contents = [
prometheus-mdns-sd
dockerTools.caCertificates
];
config = {
Cmd = ["prometheus-mdns-sd-rs"];
};
}

95
flake.lock generated
View file

@ -1,56 +1,103 @@
{ {
"nodes": { "nodes": {
"flake-utils": { "crane": {
"inputs": {
"systems": "systems"
},
"locked": { "locked": {
"lastModified": 1701680307, "lastModified": 1733688869,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=",
"owner": "numtide", "owner": "ipetkov",
"repo": "flake-utils", "repo": "crane",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "rev": "604637106e420ad99907cae401e13ab6b452e7d9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "numtide", "owner": "ipetkov",
"repo": "flake-utils", "repo": "crane",
"type": "github"
}
},
"flakelight": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1733748390,
"narHash": "sha256-UqTETFjEkwu7WAtlRJPoM7rZpkMnvM9LeupKes+Breg=",
"owner": "nix-community",
"repo": "flakelight",
"rev": "3b6d1f0651f7cf4f4dc17c45e12782778a11520b",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "flakelight",
"type": "github"
}
},
"mill-scale": {
"inputs": {
"crane": "crane",
"flakelight": [
"flakelight"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1734188451,
"narHash": "sha256-bLsT74oXirSNn2oaSRd61/V/+OZ4jRKEkdBpzSZkBbM=",
"owner": "icewind1991",
"repo": "mill-scale",
"rev": "d8e263916aa788a98e28fce06e26940001f38d5b",
"type": "github"
},
"original": {
"owner": "icewind1991",
"repo": "mill-scale",
"type": "github" "type": "github"
} }
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1705183652, "lastModified": 1734083684,
"narHash": "sha256-rnfkyUH0x72oHfiSDhuCHDHg3gFgF+lF8zkkg5Zihsw=", "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "428544ae95eec077c7f823b422afae5f174dee4b", "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84",
"type": "github" "type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
"ref": "nixos-23.11", "ref": "nixos-24.11",
"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": 1733884434,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-8GXR9kC07dyOIshAyfZhG11xfvBRSZzYghnZ2weOKJU=",
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "rev": "d0483df44ddf0fd1985f564abccbe568e020ddf2",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-systems", "owner": "oxalica",
"repo": "default", "repo": "rust-overlay",
"type": "github" "type": "github"
} }
} }

View file

@ -1,47 +1,29 @@
{ {
inputs = { inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11"; nixpkgs.url = "nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils"; flakelight = {
url = "github:nix-community/flakelight";
inputs.nixpkgs.follows = "nixpkgs";
}; };
mill-scale = {
outputs = { url = "github:icewind1991/mill-scale";
self, inputs.flakelight.follows = "flakelight";
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system: let
overlays = [
(import ./overlay.nix)
];
pkgs = (import nixpkgs) {
inherit system overlays;
}; };
in rec {
packages = rec {
prometheus-mdns-sd = pkgs.prometheus-mdns-sd;
docker = pkgs.callPackage ./docker.nix {};
default = prometheus-mdns-sd;
}; };
outputs = { mill-scale, ... }: mill-scale ./. {
devShell = pkgs.mkShell { nixosModules = { outputs, ... }: {
nativeBuildInputs = with pkgs; [rustc cargo bacon cargo-edit cargo-outdated clippy]; default =
}; { pkgs
} , config
) , lib
// { , ...
overlays.default = import ./overlay.nix;
nixosModules.default = {
pkgs,
config,
lib,
...
}: { }: {
imports = [ ./module.nix ]; imports = [ ./module.nix ];
config = lib.mkIf config.services.prometheus-mdns-sd.enable { config = lib.mkIf config.services.prometheus-mdns-sd.enable {
nixpkgs.overlays = [self.overlays.default]; nixpkgs.overlays = [ outputs.overlays.default ];
services.prometheus-mdns-sd.package = lib.mkDefault pkgs.prometheus-mdns-sd; services.prometheus-mdns-sd.package = lib.mkDefault pkgs.prometheus-mdns-sd;
}; };
}; };
}; };
};
} }

View file

@ -1,12 +1,12 @@
{ { config
config, , lib
lib, , pkgs
pkgs, , ...
...
}: }:
with lib; let with lib; let
cfg = config.services.prometheus-mdns-sd; cfg = config.services.prometheus-mdns-sd;
in { in
{
options.services.prometheus-mdns-sd = { options.services.prometheus-mdns-sd = {
enable = mkEnableOption "WiFi prometheus exporter"; enable = mkEnableOption "WiFi prometheus exporter";

3
nix/overlay.nix Normal file
View file

@ -0,0 +1,3 @@
final: prev: {
prometheus-mdns-sd = final.callPackage ./package.nix { };
}

22
nix/package.nix Normal file
View file

@ -0,0 +1,22 @@
{ stdenv
, rustPlatform
, lib
,
}:
let
inherit (lib.sources) sourceByRegex;
inherit (builtins) fromTOML readFile;
src = sourceByRegex ../. [ "Cargo.*" "(src)(/.*)?" ];
cargoPackage = (fromTOML (readFile ../Cargo.toml)).package;
in
rustPlatform.buildRustPackage rec {
inherit (cargoPackage) version;
pname = cargoPackage.name;
inherit src;
cargoLock = {
lockFile = ../Cargo.lock;
};
}

View file

@ -1,3 +0,0 @@
final: prev: {
prometheus-mdns-sd = final.callPackage ./package.nix {};
}

View file

@ -1,18 +0,0 @@
{
stdenv,
rustPlatform,
lib,
}: let
inherit (lib.sources) sourceByRegex;
src = sourceByRegex ./. ["Cargo.*" "(src)(/.*)?"];
in
rustPlatform.buildRustPackage rec {
pname = "prometheus-mdns-sd";
version = "0.1.0";
inherit src;
cargoLock = {
lockFile = ./Cargo.lock;
};
}