[Nix-dev] How to install specific version of a package?

Roger Qiu roger.qiu at matrix.ai
Tue Aug 16 11:55:37 CEST 2016


You can do thing like this in your configuration.nix:

```

let pkgs-16_03 = import (fetchTarball 
http://nixos.org/releases/nixos/16.03-beta-small/nixos-16.03.252.dc3073b/nixexprs.tar.xz) 
{}; in {

environment.systemPackages = [ pkgs-16_03.w3m ];

}

```

That basically brings in the nixpkgs expression at `dc3073b` content 
address, and then installs `w3m` from that package set.

In this case, we are content addressing `w3m` by proxy of content 
addressing nixpkgs. The nixpkgs in that content address would contain 
the `w3m` content address.

Beware that if you do it this way, the package may not be available in 
the binary cache, and it may result in a from source build.

At the same time, we still don't have a content-addressable upstream 
package sources, so I'm looking into fixing that with IPFS.


On 13/08/2016 6:06 AM, Nick Sabalausky wrote:
> On 08/12/2016 02:58 AM, Roger Qiu wrote:
>> Nix is based on content addressing. To install a specific version of a
>> package, just pick a version, fix the content address, and install it!
>> [...]
>> or if a previous (or newer) revision of nixpkgs had the
>> package, then you load that package set and point to a package there to
>> install it.
>>
>
> Can you point me to documentation for that? I only know of installing 
> via "environment.systemPackages", enabling a service, or "nix-env -i 
> ...".
>
> I did just now try following this:
>
> https://nixos.org/nixpkgs/manual/#sec-modify-via-packageOverrides
>
> And created a ~/.nixpkgs/config.nix containing (just to try things 
> out) this:
>
> {
>     packageOverrides = pkgs: rec {
>         firefox = pkgs.firefox.override {
>             common.version = "33.0";
>         };
>     };
> }
>
> But then I just get:
>
> $ nix-env -i firefox
> error: attribute ‘override’ missing, at 
> /home/nick/.nixpkgs/config.nix:3:13
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev

-- 
Founder of Matrix AI
https://matrix.ai/
+61420925975



More information about the nix-dev mailing list