Skip to content

Commit

Permalink
misc: update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcelCoding committed Dec 22, 2024
1 parent cb6023b commit eb15d8c
Show file tree
Hide file tree
Showing 8 changed files with 235 additions and 340 deletions.
489 changes: 189 additions & 300 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ description = "Serving sflow traffic metrics as Prometheus endpoints."

[dependencies]
clap = { version = "4.5", default-features = false, features = ["std", "color", "help", "usage", "error-context", "suggestions", "derive", "env"] }
tokio = { version = "1.38", default-features = false, features = ["macros", "rt-multi-thread", "net", "signal", "fs", "sync"] }
tokio = { version = "1.42", default-features = false, features = ["macros", "rt-multi-thread", "net", "signal", "fs", "sync"] }
tracing = { version = "0.1", default-features = false, features = ["release_max_level_info"] }
tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "ansi"] }
axum = { version = "0.7", default-features = false, features = ["tokio", "http1"] }
inotify = { version = "0.10", default-features = false, features = ["stream"] }
inotify = { version = "0.11", default-features = false, features = ["stream"] }
serde = { version = "1.0", default-features = false, features = ["derive"] }
binrw = { version = "0.14", default-features = false, features = ["std"] }
anyhow = { version = "1.0", default-features = false, features = ["std"] }
Expand Down
18 changes: 9 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ ENV USER=sflow_exporter
ENV UID=10001

RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"

RUN cargo new --bin sflow_exporter

Expand All @@ -22,7 +22,7 @@ COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml

RUN cargo build --release \
&& rm src/*.rs target/release/deps/sflow_exporter*
&& rm src/*.rs target/release/deps/sflow_exporter*

COPY ./src ./src
RUN cargo build --release
Expand All @@ -38,4 +38,4 @@ COPY --from=builder /sflow_exporter/target/release/sflow_exporter ./sflow_export

USER sflow_exporter:sflow_exporter

CMD ["/sflow_exporter/sflow_exporter"]
CMD ["/sflow_exporter/sflow_exporter", "listen"]
11 changes: 0 additions & 11 deletions derivation.nix

This file was deleted.

14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
flake-utils.url = "github:numtide/flake-utils";
};

Expand All @@ -14,15 +14,13 @@
in
{
packages = rec {
sflow-exporter = pkgs.callPackage ./derivation.nix {
cargoToml = ./Cargo.toml;
};
sflow-exporter = pkgs.callPackage ./package.nix { };
default = sflow-exporter;
};
}
) // {
overlays.default = _: prev: {
sflow-exporter = self.packages."${prev.system}".default;
inherit (self.packages."${prev.system}") sflow-exporter;
};

nixosModules = rec {
Expand Down
12 changes: 6 additions & 6 deletions module.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ in
defaultText = lib.literalExpression "pkgs.sflow-exporter";
description = lib.mdDoc "Which sflow_exporzer derivation to use.";
};
enable = lib.mkEnableOption (lib.mdDoc "sflow_exporter");
enable = lib.mkEnableOption "sflow_exporter";
listen = {
sflow = {
addr = lib.mkOption {
type = lib.types.str;
description = lib.mdDoc "The ip address the sflow listener shuld be listening on.";
description = lib.mdDoc "The ip address the sflow listener should be listening on.";
default = "::";
};
port = lib.mkOption {
type = lib.types.port;
description = lib.mdDoc "The port the sflow listener shuld be listening on.";
description = lib.mdDoc "The port the sflow listener should be listening on.";
default = 6343;
};
};
metrics = {
addr = lib.mkOption {
type = lib.types.str;
description = lib.mdDoc "The ip address the metrics listener shuld be listening on.";
description = lib.mdDoc "The ip address the metrics listener should be listening on.";
default = "::";
};
port = lib.mkOption {
type = lib.types.port;
description = lib.mdDoc "The port the metrics listener shuld be listening on.";
description = lib.mdDoc "The port the metrics listener should be listening on.";
default = 9144;
};
};
Expand All @@ -54,7 +54,7 @@ in
after = [ "network.target" ];

serviceConfig = {
ExecStart = "${cfg.package}/bin/sflow_exporter listen";
ExecStart = "${lib.getExe cfg.package} listen";
DynamicUser = true;
User = "sflow_exporter";

Expand Down
19 changes: 19 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{ lib, rustPlatform, ... }:

let
manifest = (lib.importTOML ./Cargo.toml).package;
in
rustPlatform.buildRustPackage rec {
pname = manifest.name;
inherit (manifest) version;

src = lib.cleanSource ./.;
cargoLock.lockFile = ./Cargo.lock;

cargoBuildFlags = "-p ${pname}";
cargoTestFlags = "-p ${pname}";

meta = {
mainProgram = "sflow_exporter";
};
}

0 comments on commit eb15d8c

Please sign in to comment.