Merge pull request 'nix-unit; update' (#540) from DavHau-jsonschema into main

This commit is contained in:
clan-bot
2023-11-20 10:07:03 +00:00
3 changed files with 28 additions and 42 deletions

View File

@@ -138,6 +138,15 @@ rec {
};
}
# parse list of unspecified
else if
(option.type.name == "listOf")
&& (option.type.functor.wrapped.name == "unspecified")
# return jsonschema property definition for list
then default // description // {
type = "array";
}
# parse attrsOf submodule
else if option.type.name == "attrsOf" && option.type.nestedTypes.elemType.name == "submodule"
# return jsonschema property definition for attrsOf submodule

View File

@@ -115,6 +115,18 @@ in
};
};
testListOfUnspacified =
let
default = [ 1 2 3 ];
in
{
expr = slib.parseOption (evalType (lib.types.listOf lib.types.unspecified) default);
expected = {
type = "array";
inherit default description;
};
};
testAttrsOfInt =
let
default = { foo = 1; bar = 2; baz = 3; };

View File

@@ -1,43 +1,8 @@
{ stdenv
, lib
, nixVersions
, fetchFromGitHub
, nlohmann_json
, boost
, meson
, pkg-config
, ninja
, cmake
, clang-tools
}:
stdenv.mkDerivation {
pname = "nix-unit";
version = "0.1";
src = fetchFromGitHub {
owner = "adisbladis";
repo = "nix-unit";
rev = "6389f27c0a13df001d790adfaa08ec4d971ba34a";
sha256 = "sha256-bwuiM+2sLrn+vvwW9fv/+s3oh0jN4y6gZV6Lx0pEEmM=";
{ callPackage }:
let
nix-unit-src = builtins.fetchGit {
url = "https://github.com/adisbladis/nix-unit";
rev = "7e2ee1c70f930b9b65b9fc33c3f3eca0dfae00d1";
};
buildInputs = [
nlohmann_json
nixVersions.stable
boost
];
nativeBuildInputs = [
meson
pkg-config
ninja
# nlohmann_json can be only discovered via cmake files
cmake
] ++ (lib.optional stdenv.cc.isClang [ clang-tools ]);
meta = {
description = "Nix unit test runner";
homepage = "https://github.com/adisbladis/nix-unit";
license = lib.licenses.gpl3;
maintainers = with lib.maintainers; [ adisbladis ];
platforms = lib.platforms.unix;
};
}
in
callPackage nix-unit-src { }