Re: [Nix-dev] duplicate packages?

2016-08-12 Thread Roland Koebler
Hi,

thanks for your explainations.

> You should look for duplicates in the output of
> nix-store -qR ~/.nix-profile, not in the store directly.
The output is identical in my case, since I use Nix on Debian with only
a single user.

> 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."
> [...]
> To avoid this, you can upgrade packages with other flags like --eq.
Ok, "nix-env -u --eq" /  "nix-env -u --leq":
- did remove some "duplicates" (e.g. I now only have two acl-2.2.52-entries
  instead of three) and some old versions
- but it also added some (e.g. two xcb-util-0.4.0 instead of one)

> >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.
Ok.

thanks,
Roland
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] duplicate packages?

2016-08-04 Thread Roland Koebler
Hi,

> Have you run sudo nix-collect-garbage -d ? Even If yes, you still have to
> check all gc roots to belong to system, and not to side nix-builds
yes.
I'm using Nix in single-user-mode on Debian, with only 1 profile and
only 1 generation (after nix-collect-garbage -d).

thanks,
Roland

___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] duplicate packages?

2016-08-04 Thread Guillaume Maudoux (Layus)


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

Re: [Nix-dev] duplicate packages?

2016-08-04 Thread Daniel Hlynskyi
Ah, you are not on NixOS, so collect garbage without sudo

4 серп. 2016 2:35 пп "Daniel Hlynskyi"  пише:

> Have you run sudo nix-collect-garbage -d ? Even If yes, you still have to
> check all gc roots to belong to system, and not to side nix-builds
>
> 4 серп. 2016 11:58 дп "Roland Koebler" 
> пише:
>
>> 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
>>
>>
>> 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.
>>
>>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?
>>
>> 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?
>>
>> 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?
>>
>>
>> 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


Re: [Nix-dev] duplicate packages?

2016-08-04 Thread Damien Cassou
Hi,

Roland Koebler  writes:
>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.
>
>Is this because I use nixpkgs-unstable, and everything is moving
>there

I think so. Each time a dependency of acl changes, you get a new acl.
And packages change a lot in nixpkgs-unstable.

> and is this reduced in the NixOS-release-channels?

I guess so

> 2. Is there a way to clean this up?


you can run garbage collection for everything you don't need anymore.
Here are 2 bash functions I use:

function nixos-cleanup-unsafe () {
sudo nix-collect-garbage --delete-older-than "$@"
nixos-cleanup-safe
}

function nixos-cleanup-safe () {
df -h /
nix-collect-garbage
df -h /
sudo nix-store --optimise
df -h /


To remove everything you don't need at all and reclaim hard disk space:
$ nixos-cleanup-safe

To remove everything older than 2 days you don't need anymore (you won't
be able to go back in time):
$ nixos-cleanup-unsafe 2d

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev


Re: [Nix-dev] duplicate packages?

2016-08-04 Thread Daniel Hlynskyi
Have you run sudo nix-collect-garbage -d ? Even If yes, you still have to
check all gc roots to belong to system, and not to side nix-builds

4 серп. 2016 11:58 дп "Roland Koebler"  пише:

> 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
>
>
> 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.
>
>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?
>
> 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?
>
> 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?
>
>
> 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


[Nix-dev] duplicate packages?

2016-08-04 Thread Roland Koebler
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


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.

   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?

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?

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?


thanks,
Roland
___
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev