clan-config: move jsonschema lib to clanLib
This commit is contained in:
parent
6b71f0c75e
commit
9438a9eb5f
@ -1,6 +1,5 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
let
|
{
|
||||||
clanLib = {
|
|
||||||
findNixFiles = folder:
|
findNixFiles = folder:
|
||||||
lib.mapAttrs'
|
lib.mapAttrs'
|
||||||
(name: type:
|
(name: type:
|
||||||
@ -12,6 +11,6 @@ let
|
|||||||
lib.nameValuePair (lib.removeSuffix ".nix" name) "${folder}/${name}"
|
lib.nameValuePair (lib.removeSuffix ".nix" name) "${folder}/${name}"
|
||||||
)
|
)
|
||||||
(builtins.readDir folder);
|
(builtins.readDir folder);
|
||||||
};
|
|
||||||
in
|
jsonschema = import ./jsonschema.nix { inherit lib; };
|
||||||
clanLib
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# !/usr/bin/env python3
|
# !/usr/bin/env python3
|
||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@ -8,6 +9,8 @@ from typing import Any, Optional, Type, Union
|
|||||||
|
|
||||||
from clan_cli.errors import ClanError
|
from clan_cli.errors import ClanError
|
||||||
|
|
||||||
|
CLAN_FLAKE = os.getenv("CLAN_FLAKE")
|
||||||
|
|
||||||
|
|
||||||
class Kwargs:
|
class Kwargs:
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
@ -27,7 +30,7 @@ def schema_from_module_file(
|
|||||||
nix_expr = f"""
|
nix_expr = f"""
|
||||||
let
|
let
|
||||||
lib = import <nixpkgs/lib>;
|
lib = import <nixpkgs/lib>;
|
||||||
slib = import {__file__}/../schema-lib.nix {{inherit lib;}};
|
slib = import {CLAN_FLAKE}/lib/jsonschema.nix {{inherit lib;}};
|
||||||
in
|
in
|
||||||
slib.parseModule {absolute_path}
|
slib.parseModule {absolute_path}
|
||||||
"""
|
"""
|
||||||
|
@ -9,7 +9,7 @@ let
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
checkScript = pkgs.writeScriptBin "check" ''
|
checkScript = pkgs.writeScriptBin "check" ''
|
||||||
nix build -f . tests -L "$@"
|
nix build .#checks.${pkgs.system}.{treefmt,clan-mypy,clan-pytest} -L "$@"
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# tests for the nixos options to jsonschema converter
|
# tests for the nixos options to jsonschema converter
|
||||||
# run these tests via `nix-unit ./test.nix`
|
# run these tests via `nix-unit ./test.nix`
|
||||||
{ lib ? (import <nixpkgs> { }).lib
|
{ lib ? (import <nixpkgs> { }).lib
|
||||||
, slib ? import ../../clan_cli/config/schema-lib.nix { inherit lib; }
|
, slib ? import ../../../../lib/jsonschema.nix { inherit lib; }
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
description = "Test Description";
|
description = "Test Description";
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# tests for the nixos options to jsonschema converter
|
# tests for the nixos options to jsonschema converter
|
||||||
# run these tests via `nix-unit ./test.nix`
|
# run these tests via `nix-unit ./test.nix`
|
||||||
{ lib ? (import <nixpkgs> { }).lib
|
{ lib ? (import <nixpkgs> { }).lib
|
||||||
, slib ? import ../../clan_cli/config/schema-lib.nix { inherit lib; }
|
, slib ? import ../../../../lib/jsonschema.nix { inherit lib; }
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
evaledOptions =
|
evaledOptions =
|
||||||
|
Loading…
Reference in New Issue
Block a user