[Nix-dev] How to use a previous build from hydra-server

Teo Klestrup Röijezon teo at nullable.se
Tue Dec 8 10:54:20 CET 2015


I believe it tries all of them that are on the search path ($NIX_PATH), and
picks the one with the latest version of whatever package you're installing
(highest version number). All dependencies come from the same channel
(though that channel might, in turn, import them from another channel). By
default nix will only put nixpkgs=/path/to/your/downloaded/nixpkgs/channel
in $NIX_PATH, so you'll need to add custom channels to that, too, if you
want to use them.

For the imperative mode (nix-env), you can pick by specifying the -f flag.
So for example, "nix-env -i firefox -f '<nixpkgs>'" will install Firefox
from the channel named nixpkgs. For a channel that isn't on $NIX_PATH, use
"... -f $HOME/.nix-defexpr/channels/nixpkgs" instead.

For NixOS' declarative mode (nixos-rebuild)'s environment.systemPackages,
instead of adding pkgs.whatever, add myOtherChannel.pkgs.whatever, where
myOtherChannel might be defined earlier as "import <myOtherChannel> {}".

For NixOS service modules, the module's configuration typically include a
.pkg option, which you can change to a reference to wherever you want.

On 8 December 2015 at 09:29, Roger Qiu <roger.qiu at polycademy.com> wrote:

> If there are multiple channels (custom channels included) available, how
> does Nix choose from which to install, and is there a way for us to pick a
> preference?
> On 08/12/2015 5:52 PM, "Teo Klestrup Röijezon" <teo at nullable.se> wrote:
>
>> You can import a package from a specific version of nixpkgs, independent
>> of the rest of your build, though it's a bit of a manual process.
>>
>> First, check on Hydra which Git revision it is that you want to build
>> (you can see this on the Inputs tab,
>> 144d13cf2cc6de28f8abe9e9e8c98f28ccf8fc59 in this case). Then check what
>> Nix's hash of that revision is, (either by running nix-prefetch-git or by
>> looking at the store path in the Inputs tab, in this case
>> phb6bdyhvnsx92mh78jysaavgviwqpbr). Then replace the reference to the
>> package with a reference to the package in that version of nixpkgs. Now,
>> with most NixOS modules you could do this by setting something like
>>
>> services.mesos.pkg = (import (lib.fetchGit {
>>   url = https://github.com/NixOS/nixpkgs.git;
>>   rev = "144d13cf2cc6de28f8abe9e9e8c98f28ccf8fc59";
>>   sha256 = "phb6bdyhvnsx92mh78jysaavgviwqpbr";
>> }) {}).pkgs.mesos;
>>
>> However, from what I can tell, the mesos module (
>> https://github.com/NixOS/nixpkgs/blob/788800e437c4a0a25d95e217540bded68804b25e/nixos/modules/services/misc/mesos-slave.nix)
>> is one of the few modules that don't support replacing the package used.
>> So, uh, that's a problem that should probably be fixed, but won't really
>> help you right now. :/
>>
>> On 8 December 2015 at 05:08, rohit yadav <rohityadav7787 at gmail.com>
>> wrote:
>>
>>> Hi Rok,
>>>
>>> Thanks for reply. How should I fetch it? I mean how to tell the system
>>> to use that particular build? Currently, when I say nixos-rebuild {boot |
>>> switch} it assumes that that <nixpkgs> (which again I am not sure which one
>>> it refers to when I have to two channels listed) would tell it the right
>>> hash and it would fetch that from the server. I dunno know how to by-pass
>>> that and directly fetch any particular build from hydra. Could you please
>>> elaborate on this or refer to the documentation where it is described in
>>> more detail.
>>>
>>> Thanks,
>>> Rohit
>>>
>>> On Mon, Dec 7, 2015 at 9:45 PM, Rok Garbas <rok at garbas.si> wrote:
>>>
>>>> you can fetch mesos directly from hydra
>>>>
>>>>
>>>> http://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.mesos.x86_64-linux
>>>>
>>>> check latest successful build for instructions.
>>>>
>>>>
>>>>
>>>> Quoting rohit yadav (2015-12-08 03:54:05)
>>>> > One more question. Is it possible to add two channels? Say one
>>>> unstable and one
>>>> > previous stable channel and choose module from one of them?
>>>> >
>>>> > Thanks.
>>>> > Rohit
>>>> >
>>>> > On Mon, Dec 7, 2015 at 8:47 PM, rohit yadav <rohityadav7787 at gmail.com>
>>>> wrote:
>>>> >
>>>> >     Hi,
>>>> >
>>>> >     Currently Mesos package is broken on nixos-unstable channel,
>>>> therefore, I
>>>> >     cannot install it on my server. Is there a way to install a
>>>> previous
>>>> >     successful build?
>>>> >
>>>> >     Thanks,
>>>> >     Rohit
>>>> >
>>>> >
>>>>
>>>>
>>>> --
>>>> Rok Garbas - http://www.garbas.si
>>>>
>>>
>>>
>>> _______________________________________________
>>> nix-dev mailing list
>>> nix-dev at lists.science.uu.nl
>>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>>
>>>
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20151208/39cac5cb/attachment.html 


More information about the nix-dev mailing list