Merge pull request 'clan-cli: fix nix run clan-core failing inside direnv' (#2619) from Enzime/clan-core:push-slxswzoytzut into main
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
{
|
||||
# callPackage args
|
||||
argcomplete,
|
||||
gitMinimal,
|
||||
gnupg,
|
||||
installShellFiles,
|
||||
lib,
|
||||
@@ -34,11 +33,17 @@ let
|
||||
# load nixpkgs runtime dependencies from a json file
|
||||
# This file represents an allow list at the same time that is checked by the run_cmd
|
||||
# implementation in nix.py
|
||||
runtimeDependenciesAsSet = lib.filterAttrs (_name: pkg: !pkg.meta.unsupported or false) (
|
||||
lib.genAttrs (lib.importJSON ./clan_cli/nix/allowed-programs.json) (name: pkgs.${name})
|
||||
);
|
||||
allDependencies = lib.importJSON ./clan_cli/nix/allowed-programs.json;
|
||||
|
||||
runtimeDependencies = lib.attrValues runtimeDependenciesAsSet;
|
||||
generateRuntimeDependenciesMap =
|
||||
deps:
|
||||
lib.filterAttrs (_: pkg: !pkg.meta.unsupported or false) (lib.genAttrs deps (name: pkgs.${name}));
|
||||
|
||||
runtimeDependenciesMap = generateRuntimeDependenciesMap allDependencies;
|
||||
|
||||
runtimeDependencies = lib.attrValues runtimeDependenciesMap;
|
||||
|
||||
includedRuntimeDependenciesMap = generateRuntimeDependenciesMap includedRuntimeDeps;
|
||||
|
||||
testDependencies =
|
||||
runtimeDependencies
|
||||
@@ -102,27 +107,19 @@ python3.pkgs.buildPythonApplication {
|
||||
format = "pyproject";
|
||||
|
||||
# Arguments for the wrapper to unset LD_LIBRARY_PATH to avoid glibc version issues
|
||||
makeWrapperArgs =
|
||||
[
|
||||
makeWrapperArgs = [
|
||||
"--unset LD_LIBRARY_PATH"
|
||||
"--unset PYTHONPATH"
|
||||
|
||||
# TODO: remove gitMinimal here and use the one from runtimeDependencies
|
||||
"--suffix"
|
||||
"PATH"
|
||||
":"
|
||||
"${gitMinimal}/bin/git"
|
||||
]
|
||||
# include selected runtime dependencies in the PATH
|
||||
++ lib.concatMap (p: [
|
||||
"--prefix"
|
||||
"PATH"
|
||||
":"
|
||||
p
|
||||
]) includedRuntimeDeps
|
||||
++ [
|
||||
(lib.makeBinPath (lib.attrValues includedRuntimeDependenciesMap))
|
||||
|
||||
"--set"
|
||||
"CLAN_STATIC_PROGRAMS"
|
||||
(lib.concatStringsSep ":" includedRuntimeDeps)
|
||||
(lib.concatStringsSep ":" (lib.attrNames includedRuntimeDependenciesMap))
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
@@ -133,9 +130,7 @@ python3.pkgs.buildPythonApplication {
|
||||
propagatedBuildInputs = pythonDependencies;
|
||||
|
||||
# Define and expose the tests and checks to run in CI
|
||||
passthru.tests =
|
||||
(lib.mapAttrs' (n: lib.nameValuePair "clan-dep-${n}") runtimeDependenciesAsSet)
|
||||
// {
|
||||
passthru.tests = (lib.mapAttrs' (n: lib.nameValuePair "clan-dep-${n}") runtimeDependenciesMap) // {
|
||||
clan-pytest-without-core =
|
||||
runCommand "clan-pytest-without-core"
|
||||
{ nativeBuildInputs = [ pythonWithTestDeps ] ++ testDependencies; }
|
||||
@@ -191,7 +186,7 @@ python3.pkgs.buildPythonApplication {
|
||||
passthru.testDependencies = testDependencies;
|
||||
passthru.pythonWithTestDeps = pythonWithTestDeps;
|
||||
passthru.runtimeDependencies = runtimeDependencies;
|
||||
passthru.runtimeDependenciesAsSet = runtimeDependenciesAsSet;
|
||||
passthru.runtimeDependenciesMap = runtimeDependenciesMap;
|
||||
|
||||
postInstall = ''
|
||||
cp -r ${nixpkgs'} $out/${python3.sitePackages}/clan_cli/nixpkgs
|
||||
@@ -210,7 +205,7 @@ python3.pkgs.buildPythonApplication {
|
||||
'';
|
||||
|
||||
checkPhase = ''
|
||||
PYTHONPATH= $out/bin/clan --help
|
||||
$out/bin/clan --help
|
||||
'';
|
||||
|
||||
meta.mainProgram = "clan";
|
||||
|
||||
@@ -28,7 +28,7 @@ mkShell {
|
||||
inputsFrom = [ self'.devShells.default ];
|
||||
|
||||
CLAN_STATIC_PROGRAMS = lib.concatStringsSep ":" (
|
||||
lib.attrNames clan-cli-full.passthru.runtimeDependenciesAsSet
|
||||
lib.attrNames clan-cli-full.passthru.runtimeDependenciesMap
|
||||
);
|
||||
|
||||
shellHook = ''
|
||||
|
||||
Reference in New Issue
Block a user