maint: linux nix builds?

This commit is contained in:
Jeremy Wall 2024-02-19 16:56:14 -05:00
parent 2cee886fa2
commit 8dc243b9a1
3 changed files with 124 additions and 228 deletions

223
Cargo.lock generated
View File

@ -95,51 +95,13 @@ version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
[[package]]
name = "async-channel"
version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c"
dependencies = [
"concurrent-queue",
"event-listener 4.0.3",
"event-listener-strategy",
"futures-core",
"pin-project-lite",
]
[[package]]
name = "async-executor"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c"
dependencies = [
"async-lock 3.3.0",
"async-task",
"concurrent-queue",
"fastrand",
"futures-lite",
"slab",
]
[[package]]
name = "async-fs"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd1f344136bad34df1f83a47f3fd7f2ab85d75cb8a940af4ccf6d482a84ea01b"
dependencies = [
"async-lock 3.3.0",
"blocking",
"futures-lite",
]
[[package]]
name = "async-io"
version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f97ab0c5b00a7cdbe5a371b9a782ee7be1316095885c8a4ea1daf490eb0ef65"
dependencies = [
"async-lock 3.3.0",
"async-lock",
"cfg-if",
"concurrent-queue",
"futures-io",
@ -152,79 +114,17 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "async-lock"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b"
dependencies = [
"event-listener 2.5.3",
]
[[package]]
name = "async-lock"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b"
dependencies = [
"event-listener 4.0.3",
"event-listener",
"event-listener-strategy",
"pin-project-lite",
]
[[package]]
name = "async-net"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b948000fad4873c1c9339d60f2623323a0cfd3816e5181033c6a5cb68b2accf7"
dependencies = [
"async-io",
"blocking",
"futures-lite",
]
[[package]]
name = "async-process"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c1cd5d253ecac3d3cf15e390fd96bd92a13b1d14497d81abf077304794fb04"
dependencies = [
"async-channel",
"async-io",
"async-lock 3.3.0",
"async-signal",
"blocking",
"cfg-if",
"event-listener 4.0.3",
"futures-lite",
"rustix",
"windows-sys 0.52.0",
]
[[package]]
name = "async-signal"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5"
dependencies = [
"async-io",
"async-lock 2.8.0",
"atomic-waker",
"cfg-if",
"futures-core",
"futures-io",
"rustix",
"signal-hook-registry",
"slab",
"windows-sys 0.48.0",
]
[[package]]
name = "async-task"
version = "4.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799"
[[package]]
name = "async-trait"
version = "0.1.77"
@ -236,12 +136,6 @@ dependencies = [
"syn",
]
[[package]]
name = "atomic-waker"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0"
[[package]]
name = "autocfg"
version = "1.1.0"
@ -348,22 +242,6 @@ version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "blocking"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118"
dependencies = [
"async-channel",
"async-lock 3.3.0",
"async-task",
"fastrand",
"futures-io",
"futures-lite",
"piper",
"tracing",
]
[[package]]
name = "bumpalo"
version = "3.14.0"
@ -530,12 +408,6 @@ dependencies = [
"windows-sys 0.52.0",
]
[[package]]
name = "event-listener"
version = "2.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
[[package]]
name = "event-listener"
version = "4.0.3"
@ -553,7 +425,7 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3"
dependencies = [
"event-listener 4.0.3",
"event-listener",
"pin-project-lite",
]
@ -620,10 +492,7 @@ version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
@ -723,9 +592,6 @@ dependencies = [
"serde",
"serde_json",
"serde_yaml",
"smol",
"smol-axum",
"smol-macros",
"tokio",
"tower-http",
"tracing",
@ -1268,17 +1134,6 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[package]]
name = "piper"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4"
dependencies = [
"atomic-waker",
"fastrand",
"futures-io",
]
[[package]]
name = "pkg-config"
version = "0.3.29"
@ -1585,15 +1440,6 @@ dependencies = [
"lazy_static",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1"
dependencies = [
"libc",
]
[[package]]
name = "slab"
version = "0.4.9"
@ -1609,69 +1455,6 @@ version = "1.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7"
[[package]]
name = "smol"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e635339259e51ef85ac7aa29a1cd991b957047507288697a690e80ab97d07cad"
dependencies = [
"async-channel",
"async-executor",
"async-fs",
"async-io",
"async-lock 3.3.0",
"async-net",
"async-process",
"blocking",
"futures-lite",
]
[[package]]
name = "smol-axum"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5bc1f8f7464d1a4f3fe9c64b3bf9b19c195987aba2f02079879512ad6068c31d"
dependencies = [
"async-executor",
"async-io",
"axum-core",
"futures-lite",
"http 1.0.0",
"hyper 1.1.0",
"hyper-util",
"pin-project-lite",
"smol-hyper",
"tower",
"tower-service",
"tracing",
]
[[package]]
name = "smol-hyper"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7428a49d323867702cd12b97b08a6b0104f39ec13b49117911f101271321bc1a"
dependencies = [
"async-executor",
"async-io",
"futures-io",
"hyper 1.1.0",
"pin-project-lite",
]
[[package]]
name = "smol-macros"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ff34feaafdddfd721c606f06fd867a12d76f9612c36ab8dc55a103b43bf56b8"
dependencies = [
"async-executor",
"async-io",
"async-lock 3.3.0",
"event-listener 4.0.3",
"futures-lite",
]
[[package]]
name = "socket2"
version = "0.5.5"

View File

@ -19,9 +19,6 @@ prometheus-http-query = "0.8.2"
serde = { version = "1.0.196", features = ["derive"] }
serde_json = "1.0.113"
serde_yaml = "0.9.31"
smol = "2.0.0"
smol-axum = "0.1.0"
smol-macros = "0.1.0"
tokio = { version = "1.36.0", features = ["net", "rt", "rt-multi-thread"] }
tower-http = { version = "0.5.1", features = ["trace"] }
tracing = "0.1.40"

126
flake.nix
View File

@ -21,9 +21,7 @@
rustc = rust-bin;
cargo = rust-bin;
};
in
{
packages.default = naersk-lib.buildPackage {
heracles = naersk-lib.buildPackage {
name = "heracles";
verion = "0.0.1";
src = ./.;
@ -31,7 +29,125 @@
if pkgs.stdenv.isDarwin then
with pkgs.darwin.apple_sdk.frameworks; [ Security SystemConfiguration ]
else
[ ]) ++ [rust-bin];
[ pkgs.openssl ]) ++ [rust-bin];
};
});
in
{
packages.default = heracles;
}) // {
nixosModule = {config, pkgs, lib}: with lib; {
options = {
services.heracles.enable = mkEnableOption "enable heracles service";
services.heracles.listen = mkOption {
description = "[host]:port address for heracles to listen on";
default = "localhost:8080";
defaultText = "localhost:8080";
};
services.heracles.settings = mkOption {
description = "heracles dashboard Configuration";
default = [
{
title = "A dashboard";
graphs = [
{
title = "Graph title";
query_type = "Range";
# yaxis formatting default for this graph
d3_tick_format = "~s";
plots = [
{
source = "http://heimdall:9001";
query = ''
sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
'';
meta = {
name_label = "instance";
name_prefix = "trace name prefix";
name_suffix = "trace name suffix";
named_axis = "y";
# yaxis formatting for this subplot
d3_tick_format = "~s";
};
}
];
# span for this graph.
span = {
end = "now";
duration = "1d";
step_duration = "10min";
};
}
];
# default span for dashboard
span = {
end = "now";
duration = "1d";
step_duration = "10min";
};
}
];
defaultText = ''
[
{
title = "A dashboard";
graphs = [
{
title = "Graph title";
query_type = "Range";
# yaxis formatting default for this graph
d3_tick_format = "~s";
plots = [
{
source = "http://heimdall:9001";
query = \'\'
sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))
\'\';
meta = {
name_label = "instance";
name_prefix = "trace name prefix";
name_suffix = "trace name suffix";
named_axis = "y";
# yaxis formatting for this subplot
d3_tick_format = "~s";
};
}
];
# span for this graph.
span = {
end = "now";
duration = "1d";
step_duration = "10min";
};
}
];
# default span for dashboard
span = {
end = "now";
duration = "1d";
step_duration = "10min";
};
}
]
'';
};
};
config = mkIf config.services.heracles.enable {
environment.etc."heracles.yaml" = {
text = (generators.toYAML {} config.services.heracles.settings);
};
systemd.services.heracles = {
wantedBy = [ "multi-user.target" "default.target" ];
wants = [ "network.target" ];
after = [ "network-online.target" ];
serviceConfig = {
Restart = "on-failure";
RestartSec = "30s";
ExecStart = "${pkgs.heracles}/bin/heracles --listen ${config.services.heracles.listen} --config=${config.environment.etc."heracles.yaml".target}";
};
};
};
};
};
}