Skip to content

nix copies inputs already in the nix store #11228

Open
@yshui

Description

Describe the bug

I have this in the nix registry.json

    {
      "exact": true,
      "from": {
        "id": "nixpkgs",
        "type": "indirect"
      },
      "to": {
        "path": "/nix/store/<some path>",
        "type": "path"
      }
    },

Running nix eval 'nixpkgs#hello.meta produces output "copying /nix/store/<some path>" every time.

I notice this does not always happen. It happens if the "path" points to something that is built. In this case, my nixpkgs source is built by calling applyPatches. It does not happen if the "path" points to something that is fetched directly. e.g. if I use inputs.nixpkgs.url = github.com:nixos/nixpkgs, then points "path" to inputs.nixpkgs, then nix eval does not copy.

Expected behavior

nix should not copy if the input is already in the nix store.

Priorities

Add 👍 to issues you find important.

Metadata

Assignees

No one assigned

    Labels

    bugfetchingNetworking with the outside (non-Nix) world, input locking

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions