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>

Changed files
+92
maintainers
nixos
pkgs
servers
scaphandre
top-level
+10
maintainers/maintainer-list.nix
···
fingerprint = "0200 3EF8 8D2B CF2D 8F00 FFDC BBB3 E40E 5379 7FD9";
}];
};
GaetanLepage = {
email = "gaetan@glepage.com";
github = "GaetanLepage";
···
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";
+1
nixos/tests/all-tests.nix
···
samba = handleTest ./samba.nix {};
samba-wsdd = handleTest ./samba-wsdd.nix {};
sanoid = handleTest ./sanoid.nix {};
schleuder = handleTest ./schleuder.nix {};
sddm = handleTest ./sddm.nix {};
seafile = handleTest ./seafile.nix {};
···
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 {};
+18
nixos/tests/scaphandre.nix
···
···
+
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",
+
)
+
'';
+
}
+61
pkgs/servers/scaphandre/default.nix
···
···
+
{ 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 ];
+
};
+
}
+2
pkgs/top-level/all-packages.nix
···
scalr-cli = callPackage ../tools/admin/scalr-cli { };
shairplay = callPackage ../servers/shairplay { avahi = avahi-compat; };
shairport-sync = callPackage ../servers/shairport-sync { };
···
scalr-cli = callPackage ../tools/admin/scalr-cli { };
+
scaphandre = callPackage ../servers/scaphandre { };
+
shairplay = callPackage ../servers/shairplay { avahi = avahi-compat; };
shairport-sync = callPackage ../servers/shairport-sync { };