clan-cli: fix clan-cli accidentally dependending on all packages
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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,65 +121,69 @@ 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 =
|
||||||
clan-pytest-without-core =
|
(lib.mapAttrs' (n: lib.nameValuePair "clan-dep-${n}") testRuntimeDependenciesMap)
|
||||||
runCommand "clan-pytest-without-core" { nativeBuildInputs = testDependencies; }
|
// {
|
||||||
''
|
clan-pytest-without-core =
|
||||||
cp -r ${source} ./src
|
runCommand "clan-pytest-without-core" { nativeBuildInputs = testDependencies; }
|
||||||
chmod +w -R ./src
|
''
|
||||||
cd ./src
|
cp -r ${source} ./src
|
||||||
|
chmod +w -R ./src
|
||||||
|
cd ./src
|
||||||
|
|
||||||
export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error
|
export NIX_STATE_DIR=$TMPDIR/nix IN_NIX_SANDBOX=1 PYTHONWARNINGS=error
|
||||||
python -m pytest -m "not impure and not with_core" ./tests
|
python -m pytest -m "not impure and not with_core" ./tests
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
clan-pytest-with-core =
|
clan-pytest-with-core =
|
||||||
runCommand "clan-pytest-with-core"
|
runCommand "clan-pytest-with-core"
|
||||||
{
|
{
|
||||||
nativeBuildInputs = testDependencies;
|
nativeBuildInputs = testDependencies;
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
pkgs.bash
|
|
||||||
pkgs.coreutils
|
|
||||||
pkgs.nix
|
|
||||||
];
|
|
||||||
closureInfo = pkgs.closureInfo {
|
|
||||||
rootPaths = [
|
|
||||||
pkgs.bash
|
pkgs.bash
|
||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
pkgs.jq.dev
|
pkgs.nix
|
||||||
pkgs.stdenv
|
|
||||||
pkgs.stdenvNoCC
|
|
||||||
];
|
];
|
||||||
};
|
closureInfo = pkgs.closureInfo {
|
||||||
}
|
rootPaths = [
|
||||||
''
|
pkgs.bash
|
||||||
cp -r ${source} ./src
|
pkgs.coreutils
|
||||||
chmod +w -R ./src
|
pkgs.jq.dev
|
||||||
cd ./src
|
pkgs.stdenv
|
||||||
|
pkgs.stdenvNoCC
|
||||||
|
];
|
||||||
|
};
|
||||||
|
}
|
||||||
|
''
|
||||||
|
cp -r ${source} ./src
|
||||||
|
chmod +w -R ./src
|
||||||
|
cd ./src
|
||||||
|
|
||||||
export CLAN_CORE=${clan-core-path}
|
export CLAN_CORE=${clan-core-path}
|
||||||
export NIX_STATE_DIR=$TMPDIR/nix
|
export NIX_STATE_DIR=$TMPDIR/nix
|
||||||
export IN_NIX_SANDBOX=1
|
export IN_NIX_SANDBOX=1
|
||||||
export PYTHONWARNINGS=error
|
export PYTHONWARNINGS=error
|
||||||
export CLAN_TEST_STORE=$TMPDIR/store
|
export CLAN_TEST_STORE=$TMPDIR/store
|
||||||
# required to prevent concurrent 'nix flake lock' operations
|
# required to prevent concurrent 'nix flake lock' operations
|
||||||
export LOCK_NIX=$TMPDIR/nix_lock
|
export LOCK_NIX=$TMPDIR/nix_lock
|
||||||
mkdir -p "$CLAN_TEST_STORE/nix/store"
|
mkdir -p "$CLAN_TEST_STORE/nix/store"
|
||||||
xargs cp --recursive --target "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
|
xargs cp --recursive --target "$CLAN_TEST_STORE/nix/store" < "$closureInfo/store-paths"
|
||||||
nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration"
|
nix-store --load-db --store "$CLAN_TEST_STORE" < "$closureInfo/registration"
|
||||||
python -m pytest -m "not impure and with_core" ./tests
|
python -m pytest -m "not impure and with_core" ./tests
|
||||||
touch $out
|
touch $out
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user