scaphandre: init at 0.5.0 (#238462)

* scaphandre: init at 0.5.0

* Update pkgs/servers/scaphandre/default.nix

---------

Co-authored-by: Pol Dellaiera <pol.dellaiera@protonmail.com>
This commit is contained in:
Gaël Reyrol 2023-06-26 19:41:28 +02:00 committed by GitHub
parent 3d50c1d076
commit c7bb191426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 92 additions and 0 deletions

View File

@ -5691,6 +5691,16 @@
fingerprint = "0200 3EF8 8D2B CF2D 8F00 FFDC BBB3 E40E 5379 7FD9";
}];
};
gaelreyrol = {
email = "me@gaelreyrol.dev";
matrix = "@Zevran:matrix.org";
name = "Gaël Reyrol";
github = "gaelreyrol";
githubId = 498465;
keys = [{
fingerprint = "3492 D8FA ACFF 4C5F A56E 50B7 DFB9 B69A 2C42 7F61";
}];
};
GaetanLepage = {
email = "gaetan@glepage.com";
github = "GaetanLepage";

View File

@ -670,6 +670,7 @@ in {
samba = handleTest ./samba.nix {};
samba-wsdd = handleTest ./samba-wsdd.nix {};
sanoid = handleTest ./sanoid.nix {};
scaphandre = handleTest ./scaphandre.nix {};
schleuder = handleTest ./schleuder.nix {};
sddm = handleTest ./sddm.nix {};
seafile = handleTest ./seafile.nix {};

View File

@ -0,0 +1,18 @@
import ./make-test-python.nix {
name = "scaphandre";
nodes = {
scaphandre = { pkgs, ... } : {
boot.kernelModules = [ "intel_rapl_common" ];
environment.systemPackages = [ pkgs.scaphandre ];
};
};
testScript = { nodes, ... } : ''
scaphandre.start()
scaphandre.wait_until_succeeds(
"scaphandre stdout -t 4",
)
'';
}

View File

@ -0,0 +1,61 @@
{ stdenv
, lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, openssl
, powercap
, runCommand
, dieHook
, nixosTests
}:
rustPlatform.buildRustPackage rec {
pname = "scaphandre";
version = "0.5.0";
src = fetchFromGitHub {
owner = "hubblo-org";
repo = pname;
rev = "v${version}";
hash = "sha256-cXwgPYTgom4KrL/PH53Fk6ChtALuMYyJ/oTrUKHCrzE=";
};
cargoSha256 = "sha256-Vdkq9ShbHWepvIgHPjhKY+LmhjS+Pl84QelgEpen7Qs=";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ openssl ];
checkPhase = ''
runHook preCheck
# Work around to pass test due to non existing path
# https://github.com/hubblo-org/scaphandre/blob/v0.5.0/src/sensors/powercap_rapl.rs#L29
export SCAPHANDRE_POWERCAP_PATH="$(mktemp -d)/scaphandre"
mkdir -p "$SCAPHANDRE_POWERCAP_PATH"
runHook postCheck
'';
passthru.tests = {
stdout = self: runCommand "${pname}-test" {
buildInputs = [
self
dieHook
];
} ''
${self}/bin/scaphandre stdout -t 4 > $out || die "Scaphandre failed to measure consumption"
[ -s $out ]
'';
vm = nixosTests.scaphandre;
};
meta = with lib; {
description = "Electrical power consumption metrology agent";
homepage = "https://github.com/hubblo-org/scaphandre";
license = licenses.asl20;
platforms = platforms.linux;
maintainers = with maintainers; [ gaelreyrol ];
};
}

View File

@ -26551,6 +26551,8 @@ with pkgs;
scalr-cli = callPackage ../tools/admin/scalr-cli { };
scaphandre = callPackage ../servers/scaphandre { };
shairplay = callPackage ../servers/shairplay { avahi = avahi-compat; };
shairport-sync = callPackage ../servers/shairport-sync { };