Le 04/08/16 à 10:57, Roland Koebler a écrit : > Hi, > > I have Nix running on Debian with the default channel [*], and I noticed, > that -- although I only have a few packages installed -- many dependencies > are installed several times. I would like to understand, why. > > [*] https://nixos.org/channels/nixpkgs-unstable nixpkgs First of all, there may be old derivations in the store. You should look for duplicates in the output of nix-store -qR ~/.nix-profile, not in the store directly.
Because there can exist many generation of you profile in the store. > > > 1. Many packages are installed several times with the same version > number, e.g.: > > 2pa9z1h2m0pyik4hr1ikfl6jvdg8j4pb-acl-2.2.52 > 8c5s33f5mzfn9z3yhjprxnxzl19dg7p2-acl-2.2.52 > sk0b1r840b686zc2m8mzyw8yyq1aymqh-acl-2.2.52 > > 4vgjwvgf24jl3czzksai6mwsklvhgs4k-attr-2.4.47 > 8z667vv1agvpd3iknmk94j0ix6bv413i-attr-2.4.47 > m8qi9jrz51lqn7x0mifa9kpwpsp3b7dq-attr-2.4.47 > > fxkm8r0vpv88ld82jz0a00sjvh342wfl-avahi-0.6.31 > p817p19niamk0f06r5wvqvdqnym96r7w-avahi-0.6.31 > 5wi7ja71s4wdjkzfghc4lkwrwc45fnf9-avahi-0.6.32 > > d20f169ryps7ds2qak0r5n1f4hhxr80h-bash-4.3-p42 > d44582rghk696yw704sh5nbvbpnm69iv-bash-4.3-p42 > xag5ayq906w9zhlxs8wayv4kvpiyqphq-bash-4.3-p42 > > 0y480sh5b4hny3iq8fy3ppha0zllxxaw-boehm-gc-7.2f > bw1p8rairfwv2yif2g1cc0yg8hv25mnl-boehm-gc-7.2f > f24zx1r39kalz01q9kw7zcg1ngj7w2db-boehm-gc-7.2f > > 98s2znxww6x7h2ch7cj1w5givahxmdna-glibc-2.23 > phffgv3pwihmpdyk8xsz3wv8ydysch8w-glibc-2.23 > > ... > > I know that different build-inputs result in different hashes, but I > would have expected a more homogeneous structure in nixpkgs (e.g. > only one acl-2.2.52 in nixpkgs and not several ones), so that > I don't need e.g. 3 times acl-2.2.52 or bash-4.3-p42. You only get an homogeneous structure if you update all your packages at the same time. Doing nix-env -u will "[o]nly upgrade a derivation to newer versions [as t]his is the default." >From a tree with +--- package a v1 | `--- 2pa9z1h2m0pyik4hr1ikfl6jvdg8j4pb-acl-2.2.52 `--- package b v1 `--- 2pa9z1h2m0pyik4hr1ikfl6jvdg8j4pb-acl-2.2.52 Running nix-env -u may update package a and not package b. As the new package a is built in the new nixpkgs, it comes with a new acl (same version, but different as probably one dependency changed). You get two different acl in your system. +--- package a *v2* | `--- *8c5s33f5mzfn9z3yhjprxnxzl19dg7p2*-acl-2.2.52 `+--- package b v1 `--- 2pa9z1h2m0pyik4hr1ikfl6jvdg8j4pb-acl-2.2.52 To avoid this, you can upgrade packages with other flags like --eq. Look an nix-env --upgrade manual section : --lt Only upgrade a derivation to newer versions. This is the default. --leq In addition to upgrading to newer versions, also “upgrade” to derivations that have the same version. Version are not a unique identification of a derivation, so there may be many derivations that have the same version. This flag may be useful to force “synchronisation” between the installed and available derivations. --eq Only “upgrade” to derivations that have the same version. This may not seem very useful, but it actually is, e.g., when there is a new release of Nixpkgs and you want to replace installed applications with the same versions built against newer dependencies (to reduce the number of dependencies floating around on your system). --always In addition to upgrading to newer versions, also “upgrade” to derivations that have the same or a lower version. I.e., derivations may actually be downgraded depending on what is available in the active Nix expression. > Is this because I use nixpkgs-unstable, and everything is moving > there, and is this reduced in the NixOS-release-channels? > Or is there some other reason? The problem comes from how nix-env updates packages, but is less visible if you follow a stable branch. > > 2. Is there a way to clean this up? > Either in the repository or locally? > Or is there a reason why this should not be cleaned up? See above flags. > > 3. Is there a simple way to find the nix-expression (e.g. > default.nix-file) of an installed package / a path in > the nix-store? > And is there a way to know which directory in the nix-store > belongs to which .drv-file? Not that I know of. There was a discussion at NixCon about that, but no implementation yet. Your best bet is to `grep` for the name in nixpkgs tree. To find the .drv of a derivation, provided it has not yet been garbage-collected, you can call `nix-store --query --deriver /nix/store/derivation` > > > thanks, > Roland > _______________________________________________ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev
_______________________________________________ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev