Skip to content

Instantly share code, notes, and snippets.

@rickynils
Created June 4, 2026 16:28
Show Gist options
  • Select an option

  • Save rickynils/b76f83a3b195e9a052996af4e0f16118 to your computer and use it in GitHub Desktop.

Select an option

Save rickynils/b76f83a3b195e9a052996af4e0f16118 to your computer and use it in GitHub Desktop.
ssh-ng:// excessive `QueryPathInfo` on `nix copy --from`

ssh-ng:// excessive QueryPathInfo on nix copy --from

The NixOS config in this repos is just used to produce a non-trivial derivation graph that can demonstrate the slowness introduced by the many sequential QueryPathInfo ops that nix copy --from ssh-ng://... results in.

$ nix path-info --derivation .#nixosConfigurations.test.config.system.build.toplevel
/nix/store/q4bjy0j6jfs2ydp3d8xqx5g8giv5v9mq-nixos-system-test-26.11.20260531.331800d.drv

$ nix --version
nix (Nix) 2.31.5

$ ssh wisteria nix --version
nix (Nix) 2.31.5



$ nix copy --to ssh-ng://wisteria /nix/store/q4bjy0j6jfs2ydp3d8xqx5g8giv5v9mq-nixos-system-test-26.11.20260531.331800d.drv

$ time nix copy --from ssh-ng://wisteria /nix/store/q4bjy0j6jfs2ydp3d8xqx5g8giv5v9mq-nixos-system-test-26.11.20260531.331800d.drv

real	0m9.988s
user	0m0.763s
sys	0m0.599s

$ time nix copy --from ssh-ng://wisteria /nix/store/q4bjy0j6jfs2ydp3d8xqx5g8giv5v9mq-nixos-system-test-26.11.20260531.331800d.drv

real	0m11.494s
user	0m0.874s
sys	0m0.601s

$ time nix copy --from ssh://wisteria /nix/store/q4bjy0j6jfs2ydp3d8xqx5g8giv5v9mq-nixos-system-test-26.11.20260531.331800d.drv

real	0m0.546s
user	0m0.073s
sys	0m0.056s
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1780243769,
"narHash": "sha256-x5UQuRsH3MqI0U9afaXSNqzTPSeZlRLvFAav2Ux1pNw=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "331800de5053fcebacf6813adb5db9c9dca22a0c",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
{
description = "Simple NixOS configuration for testing large derivation evaluation";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
outputs = { self, nixpkgs, ... }: {
nixosConfigurations.test = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ lib, pkgs, modulesPath, ... }: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
# Minimal bootloader/filesystem so the config evaluates as a buildable system.
boot.loader.grub.device = "/dev/sda";
fileSystems."/" = {
device = "/dev/sda1";
fsType = "ext4";
};
networking.hostName = "test";
# Pull in a reasonably large derivation tree so evaluation has some weight.
environment.systemPackages = with pkgs; [
git
vim
curl
wget
htop
tmux
python3
gcc
gnumake
];
system.stateVersion = "24.05";
})
];
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment