@philiptaron's lix workspace
Find a file
Eelco Dolstra 976df480c9 Add a primop for regular expression pattern matching
The function ‘builtins.match’ takes a POSIX extended regular
expression and an arbitrary string. It returns ‘null’ if the string
does not match the regular expression. Otherwise, it returns a list
containing substring matches corresponding to parenthesis groups in
the regex. The regex must match the entire string (i.e. there is an
implied "^<pat>$" around the regex).  For example:

  match "foo" "foobar" => null
  match "foo" "foo" => []
  match "f(o+)(.*)" "foooobar" => ["oooo" "bar"]
  match "(.*/)?([^/]*)" "/dir/file.nix" => ["/dir/" "file.nix"]
  match "(.*/)?([^/]*)" "file.nix" => [null "file.nix"]

The following example finds all regular files with extension .nix or
.patch underneath the current directory:

  let

    findFiles = pat: dir: concatLists (mapAttrsToList (name: type:
      if type == "directory" then
        findFiles pat (dir + "/" + name)
      else if type == "regular" && match pat name != null then
        [(dir + "/" + name)]
      else []) (readDir dir));

  in findFiles ".*\\.(nix|patch)" (toString ./.)
2014-11-25 11:47:06 +01:00
config Add config.guess, config.sub and install-sh 2013-11-25 11:26:02 +00:00
corepkgs Use proper quotes everywhere 2014-08-20 18:03:48 +02:00
doc More build-cache-failures -> build-cache-failure 2014-11-24 16:52:13 +01:00
misc Typo 2014-11-04 10:31:17 +01:00
mk Merge commit '2aa93858afee22e0c32d8f4366970976374091ac' 2014-08-20 18:44:26 +02:00
perl Fix bad operator 2014-11-20 11:45:01 +01:00
scripts Add a test for the binary tarball installer 2014-11-18 14:50:05 +01:00
src Add a primop for regular expression pattern matching 2014-11-25 11:47:06 +01:00
tests Add a primop for regular expression pattern matching 2014-11-25 11:47:06 +01:00
.gitignore Install some pkgconfig files 2014-09-18 12:00:40 +02:00
bootstrap.sh bootstrap: Simplify & make more robust. 2011-09-06 12:11:05 +00:00
configure.ac configure: Force regeneration of Makefile.config 2014-09-22 13:00:58 +02:00
COPYING * Change this to LGPL to keep the government happy. 2006-04-25 16:41:06 +00:00
dev-shell Make dev-shell script work on Darwin 2014-07-16 11:53:47 +02:00
INSTALL * Autoconf / Automake configuration and building. 2003-04-04 16:14:56 +00:00
local.mk Install config.h only once 2014-08-20 18:33:07 +02:00
Makefile Add a launchd configuration file to run nix-daemon 2014-11-04 10:30:22 +01:00
Makefile.config.in Remove unused w3m dependency 2014-09-17 17:42:00 +02:00
nix.spec.in Update spec file 2014-09-18 15:42:01 +02:00
README * Install documentation in $(docdir) (i.e. share/doc/nix). 2008-11-19 13:19:09 +00:00
release.nix Remove Hydra scheduling priorities 2014-11-20 13:26:10 +01:00
version Bump version to 1.8 2014-04-11 11:15:24 +02:00

Nix is a purely functional package manager.  For installation and
usage instructions, please read the manual, which can be found in
`docs/manual/manual.html', and additionally at the Nix website at
<http://nixos.org/>.


Acknowledgments

This product includes software developed by the OpenSSL Project for
use in the OpenSSL Toolkit (http://www.OpenSSL.org/).