about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2006-12-13 14:23:24 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2006-12-13 14:23:24 +0000
commit5a7b2515e1dfd0b3fccf0b9220513827888a5d99 (patch)
tree621f4be688329ce6aa74208862ad80306f076e0f /pkgs
parente7304dcf486bb74acbfae80f3a1c4e71e11552f9 (diff)
downloadnixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar.gz
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar.bz2
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar.lz
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar.xz
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.tar.zst
nixlib-5a7b2515e1dfd0b3fccf0b9220513827888a5d99.zip
* Helper function `writeText' to write a plain text file to the Nix
  store.

* Helper function `cleanSource' to bring in a path as a source,
  filtering out all hidden Subversion directories.

svn path=/nixpkgs/trunk/; revision=7334
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/top-level/all-packages.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f28920efe091..8dd992db2a6f 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -192,10 +192,23 @@ rec {
 
   makeWrapper = ../build-support/make-wrapper/make-wrapper.sh;
 
+  # Run the shell command `buildCommand' to produce a store object
+  # named `name'.  The attributes in `env' are added to the
+  # environment prior to running the command.
   runCommand = name: env: buildCommand: stdenvNew.mkDerivation ({
     inherit name buildCommand;
   } // env);
 
+  # Write a plain text file to the Nix store.  (The advantage over
+  # plain sources is that `text' can refer to the output paths of
+  # derivations, e.g., "... ${somePkg}/bin/foo ...".
+  writeText = name: text: runCommand name {inherit text;} "echo \"$text\" > $out";
+
+  # Bring in a path as a source, filtering out all hidden Subversion
+  # directories.  TODO: filter out backup files (*~) etc.
+  cleanSource = builtins.filterSource
+    (name: baseNameOf (toString name) != ".svn");
+  
   # !!! obsolete
   substitute = ../build-support/substitute/substitute.sh;