Confused about Nix copying nixpkgs

I’m running NixOS in an Incus container (I built the image using the lxc-container.nix module). It’s working fine but every time I use nix run in the container, it starts by copying the Nix repo from the store (to where?), which takes several seconds:

$ nix --extra-experimental-features flakes --extra-experimental-features nix-command run --offline nixpkgs#hello
copying '/nix/store/rpkc8xa3i7bli3pnrpyb4n9mmsqnggjz-nixos-24.05.20240925.759537f/nixos'

Rerunning the command 2 seconds later results in the same “copying…”. Does anyone know why Nix is doing this (and where it’s copying the files to) and if there’s anything I can do to avoid this? I already tried setting the following, which didn’t help:

nix.registry.nixpkgs.flake = inputs.nixpkgs;

nix.package = pkgs.nix;
nix.settings = {
  experimental-features = "nix-command flakes";
  nix-path = ["nixpkgs=${inputs.nixpkgs.outPath}"];
};

what does your inputs.nixpkgs look like? I think I may have seen something similar (though not sure if the same) when I pointed to nixpkgs using a path: url instead of using a git+file: url

inputs.nixpkgs was not set, but I tried setting it to "github:NixOS/nixpkgs/nixos-24.05" to see if it helped, but the problem is still present (I generated an LXC image with the new config and created a new container from it).

Note that the problem only appears when running Nix evaluations inside a container. Doing them on the host does not result in the “copying…” result (well actually it does, but only once).

Edit: maybe it’s related to this bug in Nix (but that doesn’t explain why this only happens inside LXC containers).