[Nix-dev] Non-root packaging system + stdenvNative and replace-literal

Dag Sverre Seljebotn dagseljebotn at gmail.com
Wed Feb 23 11:13:34 CET 2011


On Tue, Feb 22, 2011 at 3:54 PM, Eelco Dolstra <e.dolstra at tudelft.nl> wrote:
> Hi,
>
> On 02/22/2011 02:21 PM, Dag Sverre Seljebotn wrote:
>
>> I'm currently looking into using nix to manage scientific
>> libraries. I'd like a non-root package management system in order to
>> use the same package system on my laptop and our cluster (without
>> pestering cluster administrators daily). Nix appears to be a very nice
>> foundation to build on for distributing scientific libraries
>> (reproducability etc.)
>
> Sounds cool!

I hope it will be. Package distribution is currently a total mess in
science currently, with everybody reinventing different poor solutions
every day. E.g., there's 3-4 non-root "Scientific Python
Distributions", but none are up to scratch in my opinion. So if this
is a success there could be a significant userbase waiting to pick it
up.

At the very least, there's a number of packages I need to write and
contribute to nixpkgs, if only I can get hooked on this :-)

>> For that purpose, while having the option of building the entire
>> tool-chain (binutils, gcc, ...) is certainly nice, it'd be great if a
>> lighter approach was more easily available.
>
> Indeed for this stdenvNative is the way to go.
>
>> I've been hacking around in that direction but need some assistance to
>> get going. First thing I tried was to play with patching
>> pkgs/stdenv/default.nix so that stdenv=stdenvNative or stdenvNix,
>
> Yes, that should work, assuming you mean changing this line:
>
>  if stdenvType == "i686-linux" then stdenvLinux else
>
> to
>
>  if stdenvType == "i686-linux" then stdenvNative else
>
> (or the same for x86_64-linux.)

Yes, though I just took the more radical approach.

BTW, would it be possible to make this a configurable option somehow?
Is there a "configuration system" at all? (In the sense of a
convention for making nix-env build certain options into its generated
expression). I'd need options for my packages as well; e.g., which
LAPACK/BLAS library to use (when multiple may be installed), which
Fortran compiler to use...

(master) ~/code/nix/nixpkgs $ git diff
diff --git a/pkgs/stdenv/default.nix b/pkgs/stdenv/default.nix
index 11af6d3..02d2c8d 100644
--- a/pkgs/stdenv/default.nix
+++ b/pkgs/stdenv/default.nix
@@ -51,14 +51,5 @@ rec {


   # Select the appropriate stdenv for the platform `system'.
-  stdenv =
-    if stdenvType == "i686-linux" then stdenvLinux else
-    if stdenvType == "x86_64-linux" then stdenvLinux else
-    if stdenvType == "armv5tel-linux" then stdenvLinux else
-    if stdenvType == "mips64-linux" then stdenvLinux else
-    if stdenvType == "powerpc-linux" then /* stdenvLinux */ stdenvNative else
-    if stdenvType == "i686-mingw" then stdenvMinGW else
-    if stdenvType == "i686-darwin" then stdenvNix else
-    if stdenvType == "x86_64-darwin" then stdenvNix else
-    stdenvNative;
+  stdenv = stdenvNative;
 }



>
>> however I get
>>
>> /home/dagss/nix/store/fhi1l63zy9fal45mybxri4f6glk4v8qs-stdenv-native/setup:
>> line 358: replace-literal: command not found
>
> Hm, what exactly are you doing?  stdenvNative should build the replace-literal
> command as part of its bootstrap (since it's the only command in stdenv that's
> not usually installed in the native system).

Well, it is not, when I have a clean /nix (well, /home/dagss/nix for
me). If I am using a /nix where I previously built an stdenvLinux,
then things seems to work (I guess replace-literal enters my PATH then
and leaks through, I don't really know). But upon cleaning out /nix, I
can't bootstrap it.

Here's what I do (with nix-0.16 and a recent trunk of nixpkgs with the
patch above):

$ (cd ~; sudo rm -rf nix) && (cd nix-0.16; make install)
$ nix-env -f nixpkgs -i perl
<...snip...dependencies include stdenv-native and gcc-native...>
<...downloads ...>
<...perl builds ...>
strip:/home/dagss/nix/store/5aj59gli85rrxhqh8w0xdjls02vnjqvq-perl-5.10.1/bin/pod2usage:
File format not recognized
strip:/home/dagss/nix/store/5aj59gli85rrxhqh8w0xdjls02vnjqvq-perl-5.10.1/bin/ptar:
File format not recognized
strip:/home/dagss/nix/store/5aj59gli85rrxhqh8w0xdjls02vnjqvq-perl-5.10.1/bin/psed:
File format not recognized
strip:/home/dagss/nix/store/5aj59gli85rrxhqh8w0xdjls02vnjqvq-perl-5.10.1/bin/h2ph:
File format not recognized
patching script interpreter paths
/home/dagss/nix/store/fhi1l63zy9fal45mybxri4f6glk4v8qs-stdenv-native/setup:
line 358: replace-literal: command not found
builder for
`/home/dagss/nix/store/3nsynm6mc7zqq972hqk3m0xsafrl39ca-perl-5.10.1.drv'
failed with exit code 127
cannot build derivation
`/home/dagss/nix/store/wdyp1x7nyfmq470kn5nsjjcqnf310bl1-openssl-1.0.0c.drv':
1 dependencies couldn't be built
cannot build derivation
`/home/dagss/nix/store/8v13x1i4yndjypd1y3nhn8nqjp0wi95f-curl-7.21.0.drv':
1 dependencies couldn't be built
cannot build derivation
`/home/dagss/nix/store/2lad3zdv9yg17mhglq1zr82nz5wgy3cg-replace-2.24-src-11.11.tar.gz.drv':
1 dependencies couldn't be built
cannot build derivation
`/home/dagss/nix/store/x3zn5n22if5pibaj03lgzl7scridnv3r-replace-2.24.drv':
1 dependencies couldn't be built
cannot build derivation
`/home/dagss/nix/store/wfqi0q7pp171iymb8h1kqgbcs557k7c3-stdenv-native.drv':
1 dependencies couldn't be built
cannot build derivation
`/home/dagss/nix/store/9nb2qvr8zsgpknnsyq48mzb9a59dvxa5-perl-5.10.1.drv':
1 dependencies couldn't be built
error: build of
`/home/dagss/nix/store/9nb2qvr8zsgpknnsyq48mzb9a59dvxa5-perl-5.10.1.drv'
failed

Dag Sverre



More information about the nix-dev mailing list