Re: [Nix-dev] How to install specific version of a package?
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@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev -- Founder of Matrix AI https://matrix.ai/ +61420925975 ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] How to install specific version of a package?
Nix allows you to have multiple versions of one package, but each version can require it's specific build recipe. nixpkgs - is a place for latest versions of packages, and, pragmatically, for most used non-latest versions. The place for all packages of all versions is currently vacant. Given this, I can think of several ways to get non-latest version of package in Nix: - already mentioned install from binary cache - install from specific checkout of nixpkgs ( http://edwtjo.me/posts/2016-04-24-installing-older-pkgs-in-nixos/ and https://www.reddit.com/r/NixOS/comments/4itnth/installing_older_pkgs_in_nixos/d328l1v ) - install from overriden expression. This is the most unstable way, because many packages do require changes to recipe. But for certain simple kinds of packages it can be automated. Given the following oldversion.nix: { pkg, version }: let pkgs = import {}; inherit (builtins) trace; inherit (pkgs) lib; traceSeq = x: y: trace (builtins.deepSeq x x) y; oldversion = package: version: let getVersion = name: lib.last (lib.splitString "-" name); in package.overrideDerivation (super: { name = super.name + "-oldversion-" + version; inherit version; src = let upstreamUrls = super.src.urls; patchedUrls = map (x: builtins.replaceStrings [(getVersion super.name)] [version] x) upstreamUrls; in pkgs.fetchurl { urls = patchedUrls; sha256 = null; sha512 = null; md5 = null; sha1 = null; }; }); in oldversion pkg version you can install different versions of same package with the following monstruous command: danbst@iron ~/oldversion$ $ nix-env -f oldversion.nix --arg pkg "with import {}; siege" --argstr version "3.0.3" --install replacing old ‘siege-3.0.8-oldversion-3.0.3’ installing ‘siege-3.0.8-oldversion-3.0.3’ danbst@iron ~/oldversion$ $ nix-env -f oldversion.nix --arg pkg "with import {}; siege" --argstr version "4.0.2" --install replacing old ‘siege-3.0.8-oldversion-3.0.3’ installing ‘siege-3.0.8-oldversion-4.0.2’ 2016-08-12 20:06 GMT+00:00 Nick Sabalausky : > 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@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] How to install specific version of a package?
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@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] How to install specific version of a package?
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! However nixpkgs is a community effort in creating a standard default package set. This means the community decides to write nix expressions for the versions the community wants, and also prunes old versions because the community doesn't want to manage them, or have them take up space in the hydra CI system. However you can always write your own nix expression to install whatever version you want, 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. (You can have multiple nixpkgs revisions operating at the same time within the same configuration.nix) Thanks, Roger On 12/08/2016 5:12 AM, "Nick Sabalausky" wrote: > In general, how do you install a specific version of a package? It seems > that by default it will install the latest available version like other > distros, but for the most part installing "packagename-1.2.3"/etc doesn't > appear to work. > > One of the biggest killer features of NixOS for me is the ability to > sanely handle and manage different versions of the same package in > different environments. But that ability seems severely crippled if I can't > actually *install* any versions other than "latest" and "already previously > installed on this machine while it *was* the latest, and hasn't yet been > garbage collected". > ___ > 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] How to install specific version of a package?
Nick, I think the concept here is that: - in nixpkgs there are only latest versions (in few cases more) of the software, because it's hard to maintain huge set of packages with such a small community (comparing to debian, redhat or other distros) - nix is created to extend in mind, I find it lot lot easier to add packages than in other distros, as well as integrating them to the system. So for your specific use cases you can very easily create packages you need, or if you need specific version of a package you can just refer to older nix expression in nixpkgs and copy paste the file or refer to it using fetchgit or other nix method. I personally treat nixpkgs as a base for my specific use cases rather than something that should have everything I need. 2016-08-11 20:38 GMT+01:00 Kevin Cox : > If you know the path of the package the easiest way is `nix-env -i > /nix/store/...`. > > For installing a package by previous version number I don't think there > is an easy way to do it. (Except for some packages were different > versions are available in nixpkgs). This is partially because "version" > in nix includes all the versions of dependencies and build instructions. > > > ___ > nix-dev mailing list > nix-dev@lists.science.uu.nl > http://lists.science.uu.nl/mailman/listinfo/nix-dev > > -- Tomasz Czyż ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
Re: [Nix-dev] How to install specific version of a package?
If you know the path of the package the easiest way is `nix-env -i /nix/store/...`. For installing a package by previous version number I don't think there is an easy way to do it. (Except for some packages were different versions are available in nixpkgs). This is partially because "version" in nix includes all the versions of dependencies and build instructions. signature.asc Description: OpenPGP digital signature ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev
[Nix-dev] How to install specific version of a package?
In general, how do you install a specific version of a package? It seems that by default it will install the latest available version like other distros, but for the most part installing "packagename-1.2.3"/etc doesn't appear to work. One of the biggest killer features of NixOS for me is the ability to sanely handle and manage different versions of the same package in different environments. But that ability seems severely crippled if I can't actually *install* any versions other than "latest" and "already previously installed on this machine while it *was* the latest, and hasn't yet been garbage collected". ___ nix-dev mailing list nix-dev@lists.science.uu.nl http://lists.science.uu.nl/mailman/listinfo/nix-dev