clan-cli: symlink cli into an otherwise empty package
This avoids propagating unneeded python libraries
This commit is contained in:
parent
8467457283
commit
0f1b7cf916
|
@ -21,7 +21,7 @@
|
|||
|
||||
treefmt.programs.mypy.enable = true;
|
||||
treefmt.programs.mypy.directories = {
|
||||
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.pytestDependencies;
|
||||
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli-unwrapped.pytestDependencies;
|
||||
};
|
||||
|
||||
treefmt.settings.formatter.nix = {
|
||||
|
|
|
@ -146,11 +146,6 @@ python3.pkgs.buildPythonApplication {
|
|||
installShellCompletion --fish --name clan.fish \
|
||||
<(${argcomplete}/bin/register-python-argcomplete --shell fish clan)
|
||||
'';
|
||||
# Don't leak python packages into a devshell.
|
||||
# It can be very confusing if you `nix run` than than load the cli from the devshell instead.
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
checkPhase = ''
|
||||
PYTHONPATH= $out/bin/clan --help
|
||||
if grep --include \*.py -Rq "breakpoint()" $out; then
|
||||
|
|
|
@ -2,14 +2,20 @@
|
|||
{
|
||||
perSystem = { self', pkgs, ... }: {
|
||||
devShells.clan-cli = pkgs.callPackage ./shell.nix {
|
||||
inherit (self'.packages) clan-cli ui-assets nix-unit;
|
||||
inherit (self'.packages) clan-cli-unwrapped ui-assets nix-unit;
|
||||
};
|
||||
packages = {
|
||||
clan-cli = pkgs.python3.pkgs.callPackage ./default.nix {
|
||||
clan-cli-unwrapped = pkgs.python3.pkgs.callPackage ./default.nix {
|
||||
inherit (self'.packages) ui-assets;
|
||||
inherit (inputs) nixpkgs;
|
||||
};
|
||||
clan-openapi = self'.packages.clan-cli.clan-openapi;
|
||||
# Don't leak python packages into a devshell.
|
||||
# It can be very confusing if you `nix run` than than load the cli from the devshell instead.
|
||||
clan-cli = pkgs.runCommand "clan-cli" { } ''
|
||||
mkdir $out
|
||||
ln -s ${self'.packages.clan-cli-unwrapped}/bin $out
|
||||
'';
|
||||
inherit (self'.packages.clan-cli-unwrapped) clan-openapi;
|
||||
default = self'.packages.clan-cli;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ nix-unit, clan-cli, ui-assets, system, mkShell, writeScriptBin, openssh }:
|
||||
{ nix-unit, clan-cli-unwrapped, ui-assets, system, mkShell, writeScriptBin, openssh }:
|
||||
let
|
||||
checkScript = writeScriptBin "check" ''
|
||||
nix build .#checks.${system}.{treefmt,clan-pytest} -L "$@"
|
||||
|
@ -8,14 +8,14 @@ mkShell {
|
|||
packages = [
|
||||
nix-unit
|
||||
openssh
|
||||
clan-cli.checkPython
|
||||
clan-cli-unwrapped.checkPython
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
tmp_path=$(realpath ./.direnv)
|
||||
|
||||
rm -f clan_cli/nixpkgs clan_cli/webui/assets
|
||||
ln -sf ${clan-cli.nixpkgs} clan_cli/nixpkgs
|
||||
ln -sf ${clan-cli-unwrapped.nixpkgs} clan_cli/nixpkgs
|
||||
ln -sf ${ui-assets} clan_cli/webui/assets
|
||||
|
||||
export PATH="$tmp_path/bin:${checkScript}/bin:$PATH"
|
||||
|
|
Loading…
Reference in New Issue
Block a user