5 inherit (pkgs) buildPackages callPackage;
7 libconfig-generator = buildPackages.rustPlatform.buildRustPackage {
8 name = "libconfig-generator";
12 passthru.updateScript = ./update.sh;
14 cargoLock.lockFile = ./src/Cargo.lock;
17 libconfig-validator = buildPackages.runCommandCC "libconfig-validator"
19 buildInputs = with buildPackages; [ libconfig ];
23 $CC -lconfig -x c - -o "$out/bin/libconfig-validator" ${./validator.c}
27 format = { generator ? libconfig-generator, validator ? libconfig-validator }: {
30 type = with lib.types;
41 description = "libconfig value";
69 generate = name: value:
76 }: stdenvNoCC.mkDerivation rec {
80 preferLocalBuild = true;
82 json = builtins.toJSON value;
83 passAsFile = [ "json" ];
86 nativeBuildInputs = [ libconfig-generator ];
89 libconfig-generator < $jsonPath > output.cfg
94 nativeCheckInputs = [ libconfig-validator ];
97 libconfig-validator output.cfg
107 passthru.json = writeText "${name}.json" json;
110 libconfig-generator = generator;
111 libconfig-validator = validator;