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}"];
};