integration-tests/flakes: Eliminate slow nixpkgs copy

This commit is contained in:
Zhaofeng Li 2022-08-17 01:09:43 -06:00
parent 7aa1607a3c
commit 4cdb21be0b
5 changed files with 18 additions and 5 deletions

View file

@ -14,11 +14,10 @@ in tools.makeTest {
testScript = '' testScript = ''
import re import re
deployer.succeed("sed -i \"s @nixpkgs@ $(readlink /nixpkgs) g\" /tmp/bundle/flake.nix") deployer.succeed("sed -i 's @nixpkgs@ path:${pkgs._inputs.nixpkgs.outPath}?narHash=${pkgs._inputs.nixpkgs.narHash} g' /tmp/bundle/flake.nix")
with subtest("Lock flake dependencies"): with subtest("Lock flake dependencies"):
# --impure required for path:/nixpkgs which is a symlink to a store path deployer.succeed("cd /tmp/bundle && nix --experimental-features \"nix-command flakes\" flake lock")
deployer.succeed("cd /tmp/bundle && nix --experimental-features \"nix-command flakes\" flake lock --impure")
with subtest("Deploy with a plain flake without git"): with subtest("Deploy with a plain flake without git"):
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply --on @target --evaluator ${evaluator}") deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply --on @target --evaluator ${evaluator}")

View file

@ -2,7 +2,7 @@
description = "A simple deployment"; description = "A simple deployment";
inputs = { inputs = {
nixpkgs.url = "path:@nixpkgs@"; nixpkgs.url = "@nixpkgs@";
}; };
outputs = { self, nixpkgs }: let outputs = { self, nixpkgs }: let

View file

@ -4,5 +4,10 @@ in import flake.inputs.stable.outPath {
overlays = [ overlays = [
flake._evalJobsOverlay flake._evalJobsOverlay
flake.overlay flake.overlay
# Pass through original flake inputs
(final: prev: {
_inputs = flake.inputs;
})
]; ];
} }

View file

@ -4,5 +4,10 @@ in import flake.inputs.nixpkgs.outPath {
overlays = [ overlays = [
flake._evalJobsOverlay flake._evalJobsOverlay
flake.overlay flake.overlay
# Pass through original flake inputs
(final: prev: {
_inputs = flake.inputs;
})
]; ];
} }

View file

@ -38,11 +38,15 @@ let
# We include the input closure of a prebuilt system profile # We include the input closure of a prebuilt system profile
# so it can build system profiles for the targets without # so it can build system profiles for the targets without
# network access. # network access.
deployerConfig = { lib, config, ... }: { deployerConfig = { pkgs, lib, config, ... }: {
imports = [ imports = [
extraDeployerConfig extraDeployerConfig
]; ];
nix.registry = lib.mkIf (pkgs ? _inputs) {
nixpkgs.flake = pkgs._inputs.nixpkgs;
};
nix.nixPath = [ nix.nixPath = [
"nixpkgs=${pkgs.path}" "nixpkgs=${pkgs.path}"
]; ];