Skip to content
Snippets Groups Projects
  1. Dec 11, 2014
  2. Dec 10, 2014
  3. Dec 09, 2014
  4. Dec 08, 2014
  5. Dec 05, 2014
  6. Dec 02, 2014
  7. Nov 25, 2014
    • Eelco Dolstra's avatar
      Intro: Mention binary caches · 5f04da90
      Eelco Dolstra authored
      5f04da90
    • Eelco Dolstra's avatar
    • Eelco Dolstra's avatar
      Add a primop for regular expression pattern matching · 976df480
      Eelco Dolstra authored
      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 ./.)
      976df480
    • Eelco Dolstra's avatar
      forceString(): Accept pos argument · 4e340a98
      Eelco Dolstra authored
      4e340a98
  8. Nov 24, 2014
  9. Nov 21, 2014
    • Shea Levy's avatar
      import derivation: cleanup · b0c5c2ac
      Shea Levy authored
      Before this there was a bug where a `find` was being called on a
      not-yet-sorted set. The code was just a mess before anyway, so I cleaned
      it up while fixing it.
      b0c5c2ac
Loading