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 = ''
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"):
# --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 --impure")
deployer.succeed("cd /tmp/bundle && nix --experimental-features \"nix-command flakes\" flake lock")
with subtest("Deploy with a plain flake without git"):
deployer.succeed("cd /tmp/bundle && ${tools.colmenaExec} apply --on @target --evaluator ${evaluator}")

View file

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

View file

@ -4,5 +4,10 @@ in import flake.inputs.stable.outPath {
overlays = [
flake._evalJobsOverlay
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 = [
flake._evalJobsOverlay
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
# so it can build system profiles for the targets without
# network access.
deployerConfig = { lib, config, ... }: {
deployerConfig = { pkgs, lib, config, ... }: {
imports = [
extraDeployerConfig
];
nix.registry = lib.mkIf (pkgs ? _inputs) {
nixpkgs.flake = pkgs._inputs.nixpkgs;
};
nix.nixPath = [
"nixpkgs=${pkgs.path}"
];