[Nix-dev] Some beginner Nix/nixpkgs questions

Luca Bruno lethalman88 at gmail.com
Wed Aug 5 12:13:01 CEST 2015


On 05/08/2015 12:05, Alex Dean wrote:
> Hi,
>
> I’m currently evaluating Nix (the package manager) for use at Snowplow
> - I really like what I see but I have some questions, particularly
> around private artifacts and package repositories.
>
> As a bit of background, our primary goal in adopting Nix would be to
> move a lot of bespoke app/data installation logic currently in Ansible
> into Nix.
>
> Questions as follows:
>
> 1. I am a little confused by the role of Nixpkgs. If we take e.g.:
>
> https://github.com/NixOS/nixpkgs/tree/master/pkgs/servers/apache-kafka
>
> Nixpkgs seems to offer only a single version of Kafka. What if I want
> to install other versions of Kafka? It feels like the hierarchy is
> Nixpkgs -> package-some-version, rather than Nixpkgs -> package ->
> version. What am I missing?
You can just package your own version. Evidently people is not
interested in maintaining older versions. We prefer having only the
latest version when possible.

E.g. if you check postgresql, we have lots of versions in nixpkgs.

>
> 2. Is there a way to fetchurl with authentication? I’m looking to
> reproduce this (Ansible):
>
> - name: Install {{ binary }} | Download {{ binary }} into staging
> directory
> get_url: url="{{ binaries[binary]['download_url'] }}/{{
> binaries[binary]['download_file_name'] }}"
> dest={{ download_location }}
> url_username={{ bintray_username }}
> url_password={{ bintray_api_key }}
> sudo: yes
Private stuff with authentication in nix is tricky, but doable. You
should be able to set NIX_CURL_FLAGS when using fetchurl, which is an
impure variable that is passed through the derivation. There you should
be able to set http auth with curl options.
>
> 3. How do I operate a private repository of packages? I’ve seen this
> blog post:
>
> http://sandervanderburg.blogspot.co.uk/2014/07/managing-private-nix-packages-outside.html
>
> But this seems to refer to private packages on the local filesystem.
> How do I run a centralized but private repository of packages that
> 100s of machines can download from?
Check fetchgitPrivate, that might help.



More information about the nix-dev mailing list