about summary refs log tree commit diff
path: root/corepkgs
diff options
context:
space:
mode:
Diffstat (limited to 'corepkgs')
-rw-r--r--corepkgs/Makefile.am12
-rw-r--r--corepkgs/buildenv.nix (renamed from corepkgs/buildenv/default.nix)7
-rw-r--r--[-rwxr-xr-x]corepkgs/buildenv.pl (renamed from corepkgs/buildenv/builder.pl.in)2
-rw-r--r--corepkgs/buildenv/Makefile.am11
-rw-r--r--corepkgs/nar.nix30
-rw-r--r--corepkgs/nar/Makefile.am11
-rw-r--r--corepkgs/nar/nar.nix7
-rw-r--r--corepkgs/nar/nar.sh.in12
8 files changed, 46 insertions, 46 deletions
diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am
index b303a30eba4a..7f43a700e734 100644
--- a/corepkgs/Makefile.am
+++ b/corepkgs/Makefile.am
@@ -1 +1,11 @@
-SUBDIRS = nar buildenv channels
+SUBDIRS = channels
+
+all-local: config.nix
+
+install-exec-local:
+	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
+	$(INSTALL_DATA) config.nix $(srcdir)/nar.nix $(srcdir)/buildenv.nix $(srcdir)/buildenv.pl $(DESTDIR)$(datadir)/nix/corepkgs
+
+include ../substitute.mk
+
+EXTRA_DIST = config.nix.in nar.nix buildenv.nix buildenv.pl
diff --git a/corepkgs/buildenv/default.nix b/corepkgs/buildenv.nix
index d76f5274099a..6e2bee10b1e7 100644
--- a/corepkgs/buildenv/default.nix
+++ b/corepkgs/buildenv.nix
@@ -1,9 +1,12 @@
-{system, derivations, manifest}:
+with import <nix/config.nix>;
+
+{ system, derivations, manifest }:
 
 derivation { 
   name = "user-environment";
   system = system;
-  builder = ./builder.pl;
+  builder = perl;
+  args = [ "-w" ./buildenv.pl ];
   
   manifest = manifest;
 
diff --git a/corepkgs/buildenv/builder.pl.in b/corepkgs/buildenv.pl
index 86abe0ca19ea..52a703c0668f 100755..100644
--- a/corepkgs/buildenv/builder.pl.in
+++ b/corepkgs/buildenv.pl
@@ -1,5 +1,3 @@
-#! @perl@ -w
-
 use strict;
 use Cwd;
 use IO::Handle;
diff --git a/corepkgs/buildenv/Makefile.am b/corepkgs/buildenv/Makefile.am
deleted file mode 100644
index eeab538abca7..000000000000
--- a/corepkgs/buildenv/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-all-local: builder.pl
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
-	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
-	$(INSTALL_DATA) $(srcdir)/default.nix $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
-	$(INSTALL_PROGRAM) builder.pl $(DESTDIR)$(datadir)/nix/corepkgs/buildenv
-
-include ../../substitute.mk
-
-EXTRA_DIST = default.nix builder.pl.in
diff --git a/corepkgs/nar.nix b/corepkgs/nar.nix
new file mode 100644
index 000000000000..70a4af2f9ddb
--- /dev/null
+++ b/corepkgs/nar.nix
@@ -0,0 +1,30 @@
+with import <nix/config.nix>;
+
+let
+
+  builder = builtins.toFile "nar.sh"
+    ''
+      export PATH=${nixBinDir}:${coreutils}
+
+      echo "packing ‘$storePath’..."
+      mkdir $out
+      dst=$out/tmp.nar.bz2
+
+      set -o pipefail
+      nix-store --dump "$storePath" | ${bzip2} > $dst
+
+      nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash
+
+      mv $out/tmp.nar.bz2 $out/$(cat $out/narbz2-hash).nar.bz2
+    '';
+
+in
+
+{ system, storePath, hashAlgo }:
+
+derivation {
+  name = "nar";
+  builder = shell;
+  args = [ "-e" builder ];
+  inherit system storePath hashAlgo;
+}
diff --git a/corepkgs/nar/Makefile.am b/corepkgs/nar/Makefile.am
deleted file mode 100644
index 103051e22537..000000000000
--- a/corepkgs/nar/Makefile.am
+++ /dev/null
@@ -1,11 +0,0 @@
-all-local: nar.sh
-
-install-exec-local:
-	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
-	$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/nar
-	$(INSTALL_DATA) $(srcdir)/nar.nix $(DESTDIR)$(datadir)/nix/corepkgs/nar
-	$(INSTALL_PROGRAM) nar.sh $(DESTDIR)$(datadir)/nix/corepkgs/nar
-
-include ../../substitute.mk
-
-EXTRA_DIST = nar.nix nar.sh.in
diff --git a/corepkgs/nar/nar.nix b/corepkgs/nar/nar.nix
deleted file mode 100644
index d3d799998f10..000000000000
--- a/corepkgs/nar/nar.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ system, storePath, hashAlgo }:
-
-derivation {
-  name = "nar";
-  builder = ./nar.sh;
-  inherit system storePath hashAlgo;
-}
diff --git a/corepkgs/nar/nar.sh.in b/corepkgs/nar/nar.sh.in
deleted file mode 100644
index 1369d3a21fb2..000000000000
--- a/corepkgs/nar/nar.sh.in
+++ /dev/null
@@ -1,12 +0,0 @@
-#! @shell@ -e
-
-echo "packing $storePath into $out..."
-@coreutils@/mkdir $out
-dst=$out/tmp.nar.bz2
-@bindir@/nix-store --dump "$storePath" > tmp
-
-@bzip2@ < tmp > $dst
-
-@bindir@/nix-hash --flat --type $hashAlgo --base32 $dst > $out/narbz2-hash
-
-@coreutils@/mv $out/tmp.nar.bz2 $out/$(@coreutils@/cat $out/narbz2-hash).nar.bz2