Files
lix/subprojects/nix-eval-jobs/default.nix
T
K900 8f27c09a08 nix-eval-jobs: set meta.mainProgram
Change-Id: I77c645a4ddec4e90884942f1919a41e1e3cd66aa
2025-12-22 09:43:02 +03:00

98 lines
2.1 KiB
Nix

{
stdenv,
lib,
nix,
srcDir ? ./.,
callPackage,
meson,
pkg-config,
ninja,
cmake,
capnproto,
clang-tools,
nlohmann_json,
boost,
}:
# gcc ICEs on coroutines at least until 14.3, possibly longer
assert stdenv.cc.isClang;
let
sourceBase = if srcDir == null then ./. else srcDir;
package = stdenv.mkDerivation (finalAttrs: {
pname = "nix-eval-jobs";
version = "2.93.0-dev";
src = lib.fileset.toSource {
root = sourceBase;
fileset = lib.fileset.unions [
./meson.build
./src
];
};
buildInputs = [
nlohmann_json
nix
boost
capnproto
];
nativeBuildInputs = [
meson
pkg-config
ninja
# nlohmann_json can be only discovered via cmake files
cmake
capnproto
]
++ (lib.optional stdenv.cc.isClang [ clang-tools ]);
passthru = {
inherit nix;
tests.nix-eval-jobs = callPackage (
{
stdenv,
python3Packages,
path,
}:
let
nejAttrs = finalAttrs;
in
stdenv.mkDerivation (finalAttrs: {
pname = "nix-eval-jobs-tests";
inherit (nejAttrs) version;
src = lib.fileset.toSource {
root = sourceBase;
fileset = lib.fileset.unions [
./pyproject.toml
./tests
];
};
nativeBuildInputs = [
python3Packages.pytest
package
];
env.NEJ_NIXPKGS_PATH = "${path}";
dontConfigure = true;
buildPhase = ''
export NIX_REMOTE="$NIX_BUILD_TOP"
export HOME="$(mktemp -d)"
pytest -v
'';
installPhase = "touch $out";
})
) { };
};
meta = {
description = "Hydra's builtin hydra-eval-jobs as a standalone";
homepage = "https://git.lix.systems/lix-project/lix/src/branch/main/subprojects/nix-eval-jobs";
license = lib.licenses.gpl3;
platforms = lib.platforms.unix;
mainProgram = "nix-eval-jobs";
};
});
in
package