clan-cli: fix clan-cli accidentally dependending on all packages

This commit is contained in:
Michael Hoang
2025-02-03 11:27:54 +07:00
committed by clan-bot
parent efcfae387f
commit 9458fdf7bc
2 changed files with 60 additions and 54 deletions

View File

@@ -94,6 +94,7 @@
self.nixosConfigurations.test-install-machine.config.system.clan.deployment.file self.nixosConfigurations.test-install-machine.config.system.clan.deployment.file
pkgs.stdenv.drvPath pkgs.stdenv.drvPath
pkgs.nixos-anywhere pkgs.nixos-anywhere
pkgs.bubblewrap
] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs); ] ++ builtins.map (i: i.outPath) (builtins.attrValues self.inputs);
closureInfo = pkgs.closureInfo { rootPaths = dependencies; }; closureInfo = pkgs.closureInfo { rootPaths = dependencies; };
in in

View File

@@ -42,11 +42,12 @@ let
generateRuntimeDependenciesMap = generateRuntimeDependenciesMap =
deps: deps:
lib.filterAttrs (_: pkg: !pkg.meta.unsupported or false) (lib.genAttrs deps (name: pkgs.${name})); lib.filterAttrs (_: pkg: !pkg.meta.unsupported or false) (lib.genAttrs deps (name: pkgs.${name}));
runtimeDependenciesMap = generateRuntimeDependenciesMap allDependencies; testRuntimeDependenciesMap = generateRuntimeDependenciesMap allDependencies;
runtimeDependencies = lib.attrValues runtimeDependenciesMap; testRuntimeDependencies = lib.attrValues testRuntimeDependenciesMap;
includedRuntimeDependenciesMap = generateRuntimeDependenciesMap includedRuntimeDeps; bundledRuntimeDependenciesMap = generateRuntimeDependenciesMap includedRuntimeDeps;
bundledRuntimeDependencies = lib.attrValues bundledRuntimeDependenciesMap;
testDependencies = runtimeDependencies ++ [ testDependencies = testRuntimeDependencies ++ [
gnupg gnupg
stdenv.cc # Compiler used for certain native extensions stdenv.cc # Compiler used for certain native extensions
(pythonRuntime.withPackages (ps: (pyTestDeps ps) ++ (pyDeps ps))) (pythonRuntime.withPackages (ps: (pyTestDeps ps) ++ (pyDeps ps)))
@@ -103,7 +104,7 @@ pythonRuntime.pkgs.buildPythonApplication {
"--prefix" "--prefix"
"PATH" "PATH"
":" ":"
(lib.makeBinPath (lib.attrValues includedRuntimeDependenciesMap)) (lib.makeBinPath (lib.attrValues bundledRuntimeDependenciesMap))
# We need this for templates to work # We need this for templates to work
"--set" "--set"
@@ -112,7 +113,7 @@ pythonRuntime.pkgs.buildPythonApplication {
"--set" "--set"
"CLAN_STATIC_PROGRAMS" "CLAN_STATIC_PROGRAMS"
(lib.concatStringsSep ":" (lib.attrNames includedRuntimeDependenciesMap)) (lib.concatStringsSep ":" (lib.attrNames bundledRuntimeDependenciesMap))
]; ];
nativeBuildInputs = [ nativeBuildInputs = [
@@ -120,10 +121,12 @@ pythonRuntime.pkgs.buildPythonApplication {
installShellFiles installShellFiles
]; ];
propagatedBuildInputs = [ pythonRuntimeWithDeps ] ++ runtimeDependencies; propagatedBuildInputs = [ pythonRuntimeWithDeps ] ++ bundledRuntimeDependencies;
# Define and expose the tests and checks to run in CI # Define and expose the tests and checks to run in CI
passthru.tests = (lib.mapAttrs' (n: lib.nameValuePair "clan-dep-${n}") runtimeDependenciesMap) // { passthru.tests =
(lib.mapAttrs' (n: lib.nameValuePair "clan-dep-${n}") testRuntimeDependenciesMap)
// {
clan-pytest-without-core = clan-pytest-without-core =
runCommand "clan-pytest-without-core" { nativeBuildInputs = testDependencies; } runCommand "clan-pytest-without-core" { nativeBuildInputs = testDependencies; }
'' ''
@@ -177,8 +180,10 @@ pythonRuntime.pkgs.buildPythonApplication {
passthru.nixpkgs = nixpkgs'; passthru.nixpkgs = nixpkgs';
passthru.devshellPyDeps = ps: (pyTestDeps ps) ++ (pyDeps ps) ++ (devDeps ps); passthru.devshellPyDeps = ps: (pyTestDeps ps) ++ (pyDeps ps) ++ (devDeps ps);
passthru.pythonRuntime = pythonRuntime; passthru.pythonRuntime = pythonRuntime;
passthru.runtimeDependencies = runtimeDependencies; passthru.runtimeDependencies = bundledRuntimeDependencies;
passthru.runtimeDependenciesMap = runtimeDependenciesMap; passthru.runtimeDependenciesMap = bundledRuntimeDependenciesMap;
passthru.testRuntimeDependencies = testRuntimeDependencies;
passthru.testRuntimeDependenciesMap = testRuntimeDependenciesMap;
postInstall = '' postInstall = ''
cp -r ${nixpkgs'} $out/${pythonRuntime.sitePackages}/clan_cli/nixpkgs cp -r ${nixpkgs'} $out/${pythonRuntime.sitePackages}/clan_cli/nixpkgs