2023-08-27 08:21:02 +00:00
|
|
|
{ nix-unit, clan-cli, ui-assets, python3, system, ruff, mkShell, writeScriptBin }:
|
2023-07-20 16:07:27 +00:00
|
|
|
let
|
2023-08-27 08:21:02 +00:00
|
|
|
pythonWithDeps = python3.withPackages (
|
2023-07-20 16:07:27 +00:00
|
|
|
ps:
|
2023-08-08 12:11:04 +00:00
|
|
|
clan-cli.propagatedBuildInputs
|
|
|
|
++ clan-cli.devDependencies
|
2023-07-20 16:07:27 +00:00
|
|
|
++ [
|
|
|
|
ps.pip
|
|
|
|
]
|
|
|
|
);
|
2023-08-27 08:21:02 +00:00
|
|
|
checkScript = writeScriptBin "check" ''
|
|
|
|
nix build .#checks.${system}.{treefmt,clan-pytest} -L "$@"
|
2023-07-20 16:07:27 +00:00
|
|
|
'';
|
2023-07-26 06:29:34 +00:00
|
|
|
in
|
2023-08-27 08:21:02 +00:00
|
|
|
mkShell {
|
2023-07-26 06:29:34 +00:00
|
|
|
packages = [
|
2023-08-27 08:21:02 +00:00
|
|
|
ruff
|
|
|
|
nix-unit
|
2023-07-26 06:29:34 +00:00
|
|
|
pythonWithDeps
|
|
|
|
];
|
2023-08-25 19:26:30 +00:00
|
|
|
# sets up an editable install and add enty points to $PATH
|
2023-08-22 21:15:34 +00:00
|
|
|
# This provides dummy options for testing clan config and prevents it from
|
|
|
|
# evaluating the flake .#
|
|
|
|
CLAN_OPTIONS_FILE = ./clan_cli/config/jsonschema/options.json;
|
2023-08-26 09:23:15 +00:00
|
|
|
PYTHONPATH = "${pythonWithDeps}/${pythonWithDeps.sitePackages}";
|
2023-07-26 06:29:34 +00:00
|
|
|
shellHook = ''
|
2023-08-26 07:25:14 +00:00
|
|
|
tmp_path=$(realpath ./.direnv)
|
2023-09-06 12:40:00 +00:00
|
|
|
|
2023-08-25 15:08:39 +00:00
|
|
|
rm -f clan_cli/nixpkgs clan_cli/assets
|
2023-09-06 15:29:49 +00:00
|
|
|
ln -sf ${clan-cli.nixpkgs} clan_cli/nixpkgs
|
2023-08-25 15:08:39 +00:00
|
|
|
ln -sf ${ui-assets} clan_cli/webui/assets
|
2023-09-06 12:40:00 +00:00
|
|
|
|
2023-07-26 06:29:34 +00:00
|
|
|
export PATH="$tmp_path/bin:${checkScript}/bin:$PATH"
|
2023-08-26 09:23:15 +00:00
|
|
|
export PYTHONPATH="$PYTHONPATH:$(pwd)"
|
2023-09-06 12:40:00 +00:00
|
|
|
|
2023-07-26 06:29:34 +00:00
|
|
|
export XDG_DATA_DIRS="$tmp_path/share''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
|
|
|
|
export fish_complete_path="$tmp_path/share/fish/vendor_completions.d''${fish_complete_path:+:$fish_complete_path}"
|
|
|
|
mkdir -p \
|
|
|
|
$tmp_path/share/fish/vendor_completions.d \
|
|
|
|
$tmp_path/share/bash-completion/completions \
|
|
|
|
$tmp_path/share/zsh/site-functions
|
|
|
|
register-python-argcomplete --shell fish clan > $tmp_path/share/fish/vendor_completions.d/clan.fish
|
|
|
|
register-python-argcomplete --shell bash clan > $tmp_path/share/bash-completion/completions/clan
|
2023-09-07 11:42:48 +00:00
|
|
|
|
|
|
|
${clan-cli}/bin/clan machines create example
|
2023-07-26 06:29:34 +00:00
|
|
|
'';
|
|
|
|
}
|