summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/maintainers.nix1
-rw-r--r--lib/sources.nix2
-rw-r--r--lib/trivial.nix10
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index 8e97bac42ac..fbdeff3c073 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -547,6 +547,7 @@
   smironov = "Sergey Mironov <grrwlf@gmail.com>";
   snyh = "Xia Bin <snyh@snyh.org>";
   solson = "Scott Olson <scott@solson.me>";
+  sorpaas = "Wei Tang <hi@that.world>";
   spacefrogg = "Michael Raitza <spacefrogg-nixos@meterriblecrew.net>";
   spencerjanssen = "Spencer Janssen <spencerjanssen@gmail.com>";
   spinus = "Tomasz Czyż <tomasz.czyz@gmail.com>";
diff --git a/lib/sources.nix b/lib/sources.nix
index 8f312a9db5c..0ec4c020e54 100644
--- a/lib/sources.nix
+++ b/lib/sources.nix
@@ -17,6 +17,8 @@ rec {
     (type == "directory" && (baseName == ".git" || baseName == ".svn" || baseName == "CVS" || baseName == ".hg")) ||
     # Filter out backup files.
     lib.hasSuffix "~" baseName ||
+    builtins.match "^.*\.sw[a-z]$" baseName != null ||
+
     # Filter out generates files.
     lib.hasSuffix ".o" baseName ||
     lib.hasSuffix ".so" baseName ||
diff --git a/lib/trivial.nix b/lib/trivial.nix
index 9ee0549fc0f..a57cf30d171 100644
--- a/lib/trivial.nix
+++ b/lib/trivial.nix
@@ -70,6 +70,16 @@ rec {
   min = x: y: if x < y then x else y;
   max = x: y: if x > y then x else y;
 
+  /* Integer modulus
+
+     Example:
+       mod 11 10
+       => 1
+       mod 1 10
+       => 1
+  */
+  mod = base: int: base - (int * (builtins.div base int));
+
   /* Reads a JSON file. */
   importJSON = path:
     builtins.fromJSON (builtins.readFile path);