clan-cli: stop propagating build inputs, remove wrapper
All checks were successful
checks-impure / test (pull_request) Successful in 17s
checks / test (pull_request) Successful in 1m26s

This commit is contained in:
DavHau 2023-10-04 10:34:32 +02:00
parent c0e2bfbcb8
commit 017221febb
4 changed files with 13 additions and 14 deletions

View File

@ -21,7 +21,7 @@
treefmt.programs.mypy.enable = true;
treefmt.programs.mypy.directories = {
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli-unwrapped.pytestDependencies;
"pkgs/clan-cli".extraPythonPackages = self'.packages.clan-cli.pytestDependencies;
};
treefmt.settings.formatter.nix = {

View File

@ -152,6 +152,11 @@ 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 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

View File

@ -2,24 +2,18 @@
{
perSystem = { self', pkgs, ... }: {
devShells.clan-cli = pkgs.callPackage ./shell.nix {
inherit (self'.packages) clan-cli-unwrapped ui-assets nix-unit;
inherit (self'.packages) clan-cli ui-assets nix-unit;
};
packages = {
clan-cli-unwrapped = pkgs.python3.pkgs.callPackage ./default.nix {
clan-cli = pkgs.python3.pkgs.callPackage ./default.nix {
inherit (self'.packages) ui-assets;
inherit (inputs) nixpkgs;
};
# 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" { } ''
mkdir $out
ln -s ${self'.packages.clan-cli-unwrapped}/bin $out
'';
inherit (self'.packages.clan-cli-unwrapped) clan-openapi;
inherit (self'.packages.clan-cli) clan-openapi;
default = self'.packages.clan-cli;
};
checks = self'.packages.clan-cli-unwrapped.tests;
checks = self'.packages.clan-cli.tests;
};
}

View File

@ -1,4 +1,4 @@
{ nix-unit, clan-cli-unwrapped, ui-assets, system, mkShell, writeScriptBin, openssh }:
{ nix-unit, clan-cli, 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-unwrapped.checkPython
clan-cli.checkPython
];
shellHook = ''
tmp_path=$(realpath ./.direnv)
rm -f clan_cli/nixpkgs clan_cli/webui/assets
ln -sf ${clan-cli-unwrapped.nixpkgs} clan_cli/nixpkgs
ln -sf ${clan-cli.nixpkgs} clan_cli/nixpkgs
ln -sf ${ui-assets} clan_cli/webui/assets
export PATH="$tmp_path/bin:${checkScript}/bin:$PATH"