From aefc9586ec71c0e91d4b025e34423ca0ff11a793 Mon Sep 17 00:00:00 2001 From: Armijn Hemel Date: Wed, 2 Aug 2006 10:43:27 +0000 Subject: [PATCH] statically linked Nix. This should come in handy for installers...I hope... svn path=/nixpkgs/trunk/; revision=6016 --- pkgs/misc/nix-static/builder.sh | 14 +++++ pkgs/misc/nix-static/default.nix | 23 ++++++++ pkgs/misc/nix-static/nix-0.10pre5679.patch | 25 +++++++++ .../nix-static/nix-0.10pre5896-static.patch | 55 +++++++++++++++++++ 4 files changed, 117 insertions(+) create mode 100644 pkgs/misc/nix-static/builder.sh create mode 100644 pkgs/misc/nix-static/default.nix create mode 100644 pkgs/misc/nix-static/nix-0.10pre5679.patch create mode 100644 pkgs/misc/nix-static/nix-0.10pre5896-static.patch diff --git a/pkgs/misc/nix-static/builder.sh b/pkgs/misc/nix-static/builder.sh new file mode 100644 index 00000000000..604f90db18f --- /dev/null +++ b/pkgs/misc/nix-static/builder.sh @@ -0,0 +1,14 @@ +source $stdenv/setup + +configureFlags="\ + --with-store-dir=$storeDir --localstatedir=$stateDir \ + --with-aterm=$aterm --with-bdb=$bdb \ + --disable-init-state" + +preConfigure() { + autoreconf +} + +preConfigure=preConfigure + +genericBuild diff --git a/pkgs/misc/nix-static/default.nix b/pkgs/misc/nix-static/default.nix new file mode 100644 index 00000000000..e0380652def --- /dev/null +++ b/pkgs/misc/nix-static/default.nix @@ -0,0 +1,23 @@ +{ stdenv, fetchurl, aterm, bdb, perl, curl, autoconf, automake, libtool +, storeDir ? "/nix/store" +, stateDir ? "/nix/var" +}: + +assert aterm != null && bdb != null && perl != null; +# assert bdb.version >= 4.2 +# assert aterm.version >= 2.0 + +stdenv.mkDerivation { + name = "nix-0.10pre5896"; + builder = ./builder.sh; + src = fetchurl { + url = http://nix.cs.uu.nl/dist/nix/nix-0.10pre5896/nix-0.10pre5896.tar.bz2; + md5 = "509d4a452cbf2894a86184b5eaf45abd"; + }; + buildInputs = [aterm bdb perl curl autoconf automake libtool]; + inherit storeDir stateDir aterm bdb; + + # uncomment if you want to be able to use nix-prefetch-url when NIX_ROOT + # is set + patches = [./nix-0.10pre5679.patch ./nix-0.10pre5896-static.patch]; +} diff --git a/pkgs/misc/nix-static/nix-0.10pre5679.patch b/pkgs/misc/nix-static/nix-0.10pre5679.patch new file mode 100644 index 00000000000..4d72c198941 --- /dev/null +++ b/pkgs/misc/nix-static/nix-0.10pre5679.patch @@ -0,0 +1,25 @@ +diff -ruN nix-0.10pre5679/scripts/nix-prefetch-url.in nix-0.10pre5679.new/scripts/nix-prefetch-url.in +--- nix-0.10pre5679/scripts/nix-prefetch-url.in 2006-07-11 13:24:20.000000000 +0200 ++++ nix-0.10pre5679.new/scripts/nix-prefetch-url.in 2006-08-01 11:54:02.000000000 +0200 +@@ -39,10 +39,10 @@ + + tmpPath=/tmp/nix-prefetch-url-$$ # !!! security? + tmpFile=$tmpPath/$name +- mkdir $tmpPath ++ mkdir -p $NIX_ROOT/$tmpPath + + # Perform the download. +- @curl@ --fail --location --max-redirs 20 "$url" > $tmpFile ++ @curl@ --fail --location --max-redirs 20 "$url" > $NIX_ROOT/$tmpFile + + # Compute the hash. + hash=$(@bindir@/nix-hash --type "$hashType" $hashFormat --flat $tmpFile) +@@ -51,7 +51,7 @@ + # Add the downloaded file to the Nix store. + finalPath=$(@bindir@/nix-store --add-fixed "$hashType" $tmpFile) + +- if test -n "$tmpPath"; then rm -rf $tmpPath || true; fi ++ if test -n "$NIX_ROOT/$tmpPath"; then rm -rf $NIX_ROOT/$tmpPath || true; fi + + if test -n "$expHash" -a "$expHash" != "$hash"; then + echo "hash mismatch for URL \`$url'" diff --git a/pkgs/misc/nix-static/nix-0.10pre5896-static.patch b/pkgs/misc/nix-static/nix-0.10pre5896-static.patch new file mode 100644 index 00000000000..749ee53bacd --- /dev/null +++ b/pkgs/misc/nix-static/nix-0.10pre5896-static.patch @@ -0,0 +1,55 @@ +diff -ruN nix-0.10pre5896/src/nix-env/Makefile.am nix-0.10pre5896.new/src/nix-env/Makefile.am +--- nix-0.10pre5896/src/nix-env/Makefile.am 2006-07-24 20:39:47.000000000 +0200 ++++ nix-0.10pre5896.new/src/nix-env/Makefile.am 2006-08-02 12:16:34.000000000 +0200 +@@ -5,6 +5,7 @@ + nix_env_LDADD = ../libmain/libmain.la ../libexpr/libexpr.la \ + ../libstore/libstore.la ../libutil/libutil.la \ + ../boost/format/libformat.la ${bdb_lib} ${aterm_lib} ++nix_env_LDFLAGS = -all-static + + main.o: help.txt.hh + +diff -ruN nix-0.10pre5896/src/nix-hash/Makefile.am nix-0.10pre5896.new/src/nix-hash/Makefile.am +--- nix-0.10pre5896/src/nix-hash/Makefile.am 2006-07-24 20:39:47.000000000 +0200 ++++ nix-0.10pre5896.new/src/nix-hash/Makefile.am 2006-08-02 12:16:50.000000000 +0200 +@@ -3,6 +3,7 @@ + nix_hash_SOURCES = nix-hash.cc help.txt + nix_hash_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ + ../boost/format/libformat.la ${bdb_lib} ${aterm_lib} ++nix_hash_LDFLAGS = -all-static + + nix-hash.o: help.txt.hh + +diff -ruN nix-0.10pre5896/src/nix-instantiate/Makefile.am nix-0.10pre5896.new/src/nix-instantiate/Makefile.am +--- nix-0.10pre5896/src/nix-instantiate/Makefile.am 2006-07-24 20:39:47.000000000 +0200 ++++ nix-0.10pre5896.new/src/nix-instantiate/Makefile.am 2006-08-02 12:17:09.000000000 +0200 +@@ -4,6 +4,7 @@ + nix_instantiate_LDADD = ../libmain/libmain.la ../libexpr/libexpr.la \ + ../libstore/libstore.la ../libutil/libutil.la \ + ../boost/format/libformat.la ${bdb_lib} ${aterm_lib} ++nix_instantiate_LDFLAGS = -all-static + + main.o: help.txt.hh + +diff -ruN nix-0.10pre5896/src/nix-log2xml/Makefile.am nix-0.10pre5896.new/src/nix-log2xml/Makefile.am +--- nix-0.10pre5896/src/nix-log2xml/Makefile.am 2006-07-24 20:39:47.000000000 +0200 ++++ nix-0.10pre5896.new/src/nix-log2xml/Makefile.am 2006-08-02 12:17:26.000000000 +0200 +@@ -1,6 +1,7 @@ + bin_PROGRAMS = nix-log2xml + + nix_log2xml_SOURCES = log2xml.cc ++nix_log2xml_LDFLAGS = -all-static + + %.xml: %.log nix-log2xml + ./nix-log2xml < $< > $@ +diff -ruN nix-0.10pre5896/src/nix-store/Makefile.am nix-0.10pre5896.new/src/nix-store/Makefile.am +--- nix-0.10pre5896/src/nix-store/Makefile.am 2006-07-24 20:39:47.000000000 +0200 ++++ nix-0.10pre5896.new/src/nix-store/Makefile.am 2006-08-02 12:17:45.000000000 +0200 +@@ -3,6 +3,7 @@ + nix_store_SOURCES = main.cc dotgraph.cc dotgraph.hh help.txt + nix_store_LDADD = ../libmain/libmain.la ../libstore/libstore.la ../libutil/libutil.la \ + ../boost/format/libformat.la ${bdb_lib} ${aterm_lib} ++nix_store_LDFLAGS = -all-static + + main.o: help.txt.hh +