diff --git a/lib/jsonschema/default.nix b/lib/jsonschema/default.nix index 646200044..0872893d6 100644 --- a/lib/jsonschema/default.nix +++ b/lib/jsonschema/default.nix @@ -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 diff --git a/lib/jsonschema/test_parseOption.nix b/lib/jsonschema/test_parseOption.nix index 7adb3d660..2934dc8e4 100644 --- a/lib/jsonschema/test_parseOption.nix +++ b/lib/jsonschema/test_parseOption.nix @@ -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; }; diff --git a/pkgs/nix-unit/default.nix b/pkgs/nix-unit/default.nix index 505f044d0..8d0e1e6f6 100644 --- a/pkgs/nix-unit/default.nix +++ b/pkgs/nix-unit/default.nix @@ -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 { }