What is "copying" in a devshell, and why does it take so long for this flake?

I have the following flake.nix for a course I am taking (based heavily on Python - NixOS WIki - Micromamba):

{
  inputs.nixpkgs.url = "github:nixos/nixpkgs";

  outputs = { self, nixpkgs }:
  let
    projname = "cv_proj2";
    forAllSystems = f: nixpkgs.lib.genAttrs [ "aarch64-linux" "x86_64-linux" ] (system: f system);
    fhs = pkgs: pkgs.buildFHSEnv {
      name = "fhs-shell";
      targetPkgs = pkgs: with pkgs; [ micromamba bash ];

      profile = ''
        set -e
        eval "$(micromamba shell hook --shell=posix)"
        export MAMBA_ROOT_PREFIX=./.mamba
        if ! test -d $MAMBA_ROOT_PREFIX/envs/${projname}; then
          micromamba -y create -n ${projname} python=3.11.0 -c conda-forge -f conda/environment.yml
        fi
        micromamba activate ${projname}
        pip install -e .
        set +e
      '';

      runScript = "bash";
    };
  in
  {
    devShell = forAllSystems (system: let pkgs = nixpkgs.legacyPackages.${system}; in
      (fhs pkgs).env
    );
  };
}

However, every time I enter the devShell (with nix develop), it takes just over one minute on just

copying /home/username/path/to/current/dir

This seems strange (and is pretty inconvenient). Is there a way for me to check what this is copying?

How does your .gitignore look like? Flakes get copied to the nix store before evaluation so it might be copying a larger folder that should be ignored every time.

1 Like

This directory isn’t in a git repository.

Then it will copy everything in the folder where this flake.nix is located.

1 Like

I did not realize this was the case. Thanks!