Duplicate CUDA derivations with minor differences

My nix store is huge, even after nix-collect-garbage -d and nix-store --optimize.

I have 10 copies of xxxxsomehashxxxx-cudatoolkit-10.0.130, 2 copies of cudatoolkit-10.1.243, 7 copies of cudatoolkit-9.2.148.1, and 1 copy of cudatoolkit-9.1.85.1. Each folder ranges from 2.1GB to 3.4GB. I furthermore have 10 copies of cudatoolkit-10.0-cudnn-7.4.2 at 663MB, and 1 copy of cudatoolkit-9.2-cudnn-7.2.1.

What’s odd is when I do nix-diff on the derivations, all the versions are the same with small differences like:

nix-diff /nix/store/ijlk8lhcxx12wsjflabvl95x9nm45znz-cudatoolkit-10.0.130.drv /nix/store/s8kzkba97qhpp9nzfivdvf1jca7ldfy2-cudatoolkit-10.0.130.drv

• The input named `glib-2.62.1` differs
    - /nix/store/0v8yq6cfkn0bqv5wav0nmwwv6kv2v74d-glib-2.62.1.drv:{dev}
    + /nix/store/64z55s7xhfk334bmi86gjk7j47prj7nr-glib-2.62.1.drv:{dev}
    • The set of outputs do not match:
        + {debug}
    • The set of input sources do not match:
        + /nix/store/ciwp1yj92pvlyzx0zygv0nr653658pw6-separate-debug-info.sh

My entire system is pinned to the same nixpkgs checkout, and I have no overlays/overrides that modify cudatoolkit.

Any idea why / how this happens?

Edit: other info in Any default config for reproducible configurations? - #11 by tbenst

In the other thread, you said you had CUDA setup in home-manager? If I understand you correctly, the first thing I would do is try setting up CUDA entirely without home-manager, clean up all generations, and see if there is any difference. Hopefully, I’m not misunderstand the question.

Not sure how up to date it is but I found some CUDA stuff on the wiki.