about summary refs log tree commit diff
path: root/users/sterni/nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/sterni/nix')
-rw-r--r--users/sterni/nix/char/default.nix32
-rw-r--r--users/sterni/nix/char/tests/default.nix6
-rw-r--r--users/sterni/nix/flow/default.nix9
-rw-r--r--users/sterni/nix/flow/tests/default.nix8
-rw-r--r--users/sterni/nix/fun/tests/default.nix6
-rw-r--r--users/sterni/nix/html/default.nix19
-rw-r--r--users/sterni/nix/html/tests/default.nix73
-rw-r--r--users/sterni/nix/int/default.nix20
-rw-r--r--users/sterni/nix/int/tests/default.nix386
-rw-r--r--users/sterni/nix/string/default.nix40
-rw-r--r--users/sterni/nix/string/tests/default.nix14
-rw-r--r--users/sterni/nix/url/default.nix41
-rw-r--r--users/sterni/nix/url/tests/default.nix18
-rw-r--r--users/sterni/nix/utf8/default.nix200
-rw-r--r--users/sterni/nix/utf8/tests/default.nix57
15 files changed, 626 insertions, 303 deletions
diff --git a/users/sterni/nix/char/default.nix b/users/sterni/nix/char/default.nix
index aacfc9dcbe..9c6ce2fb25 100644
--- a/users/sterni/nix/char/default.nix
+++ b/users/sterni/nix/char/default.nix
@@ -53,17 +53,20 @@ let
   asciiAlpha = c:
     let
       v = ord c;
-    in (v >= 65 && v <= 90)
+    in
+    (v >= 65 && v <= 90)
     || (v >= 97 && v <= 122);
 
   asciiNum = c:
     let
       v = ord c;
-    in v >= 48 && v <= 57;
+    in
+    v >= 48 && v <= 57;
 
   asciiAlphaNum = c: asciiAlpha c || asciiNum c;
 
-in {
+in
+{
   inherit
     allChars
     char
@@ -78,18 +81,19 @@ in {
   # originally I generated a nix file containing a list of
   # characters, but infinisil uses a better way which I adapt
   # which is using builtins.readFile instead of import.
-  __generateAllChars = pkgs.runCommandCC "generate-all-chars" {
-    source = ''
-      #include <stdio.h>
-
-      int main(void) {
-        for(int i = 1; i <= 0xff; i++) {
-          putchar(i);
+  __generateAllChars = pkgs.runCommandCC "generate-all-chars"
+    {
+      source = ''
+        #include <stdio.h>
+
+        int main(void) {
+          for(int i = 1; i <= 0xff; i++) {
+            putchar(i);
+          }
         }
-      }
-    '';
-    passAsFile = [ "source" ];
-  } ''
+      '';
+      passAsFile = [ "source" ];
+    } ''
     $CC -o "$out" -x c "$sourcePath"
   '';
 }
diff --git a/users/sterni/nix/char/tests/default.nix b/users/sterni/nix/char/tests/default.nix
index 49b439adbb..313df47451 100644
--- a/users/sterni/nix/char/tests/default.nix
+++ b/users/sterni/nix/char/tests/default.nix
@@ -26,6 +26,6 @@ let
   ];
 
 in
-  runTestsuite "char" [
-    testAllCharConversion
-  ]
+runTestsuite "char" [
+  testAllCharConversion
+]
diff --git a/users/sterni/nix/flow/default.nix b/users/sterni/nix/flow/default.nix
index b5783bd86d..4bef0abb91 100644
--- a/users/sterni/nix/flow/default.nix
+++ b/users/sterni/nix/flow/default.nix
@@ -68,13 +68,14 @@ let
           then s x
           else x == s;
       in
-        if b
-        then builtins.elemAt c 1
-        else switch x (builtins.tail conds);
+      if b
+      then builtins.elemAt c 1
+      else switch x (builtins.tail conds);
 
 
 
-in {
+in
+{
   inherit
     cond
     switch
diff --git a/users/sterni/nix/flow/tests/default.nix b/users/sterni/nix/flow/tests/default.nix
index 54cea01858..9f974a61c7 100644
--- a/users/sterni/nix/flow/tests/default.nix
+++ b/users/sterni/nix/flow/tests/default.nix
@@ -21,7 +21,7 @@ let
       (cond [ [ true 1 2 ] [ false 1 ] ]))
     (assertEq "last is true" "last"
       (cond [
-        [ false dontEval]
+        [ false dontEval ]
         [ false dontEval ]
         [ true "last" ]
       ]))
@@ -34,6 +34,6 @@ let
   ];
 
 in
-  runTestsuite "nix.flow" [
-    testCond
-  ]
+runTestsuite "nix.flow" [
+  testCond
+]
diff --git a/users/sterni/nix/fun/tests/default.nix b/users/sterni/nix/fun/tests/default.nix
index 6492554306..f02f199433 100644
--- a/users/sterni/nix/fun/tests/default.nix
+++ b/users/sterni/nix/fun/tests/default.nix
@@ -24,6 +24,6 @@ let
       (fun.hasEllipsis ({ depot, pkgs, ... }: 42)))
   ];
 in
-  runTestsuite "nix.fun" [
-    hasEllipsisTests
-  ]
+runTestsuite "nix.fun" [
+  hasEllipsisTests
+]
diff --git a/users/sterni/nix/html/default.nix b/users/sterni/nix/html/default.nix
index 2498d832aa..d25a7ab8da 100644
--- a/users/sterni/nix/html/default.nix
+++ b/users/sterni/nix/html/default.nix
@@ -20,7 +20,7 @@ let
      => "&lt;hello&gt;"
   */
   escapeMinimal = builtins.replaceStrings
-    [ "<"    ">"    "&"     "\""     "'"      ]
+    [ "<" ">" "&" "\"" "'" ]
     [ "&lt;" "&gt;" "&amp;" "&quot;" "&#039;" ];
 
   /* Return a string with a correctly rendered tag of the given name,
@@ -87,18 +87,20 @@ let
   renderTag = tag: attrs: content:
     let
       attrs' = builtins.concatStringsSep "" (
-        builtins.map (n:
-          " ${escapeMinimal n}=\"${escapeMinimal (toString attrs.${n})}\""
-        ) (builtins.attrNames attrs)
+        builtins.map
+          (n:
+            " ${escapeMinimal n}=\"${escapeMinimal (toString attrs.${n})}\""
+          )
+          (builtins.attrNames attrs)
       );
       content' =
         if builtins.isList content
         then builtins.concatStringsSep "" content
         else content;
     in
-      if content == null
-      then "<${tag}${attrs'}/>"
-      else "<${tag}${attrs'}>${content'}</${tag}>";
+    if content == null
+    then "<${tag}${attrs'}/>"
+    else "<${tag}${attrs'}>${content'}</${tag}>";
 
   /* Prepend "<!DOCTYPE html>" to a string.
 
@@ -111,7 +113,8 @@ let
   */
   withDoctype = doc: "<!DOCTYPE html>" + doc;
 
-in {
+in
+{
   inherit escapeMinimal renderTag withDoctype;
 
   __findFile = _: renderTag;
diff --git a/users/sterni/nix/html/tests/default.nix b/users/sterni/nix/html/tests/default.nix
index 8688b69371..0d80f2f1cd 100644
--- a/users/sterni/nix/html/tests/default.nix
+++ b/users/sterni/nix/html/tests/default.nix
@@ -8,15 +8,17 @@ let
     ;
 
   exampleDocument = withDoctype (<html> { lang = "en"; } [
-    (<head> {} [
+    (<head> { } [
       (<meta> { charset = "utf-8"; } null)
-      (<title> {} "html.nix example document")
-      (<link> {
-        rel = "license";
-        href = "https://code.tvl.fyi/about/LICENSE";
-        type = "text/html";
-      } null)
-      (<style> {}  (esc ''
+      (<title> { } "html.nix example document")
+      (<link>
+        {
+          rel = "license";
+          href = "https://code.tvl.fyi/about/LICENSE";
+          type = "text/html";
+        }
+        null)
+      (<style> { } (esc ''
         hgroup h2 {
           font-weight: normal;
         }
@@ -26,39 +28,45 @@ let
         }
       ''))
     ])
-    (<body> {} [
-      (<main> {} [
-        (<hgroup> {} [
-          (<h1> {} (esc "html.nix"))
-          (<h2> {} [
-            (<em> {} "the")
+    (<body> { } [
+      (<main> { } [
+        (<hgroup> { } [
+          (<h1> { } (esc "html.nix"))
+          (<h2> { } [
+            (<em> { } "the")
             (esc " most cursed HTML DSL ever!")
           ])
         ])
-        (<dl> {} [
-          (<dt> {} [
+        (<dl> { } [
+          (<dt> { } [
             (esc "Q: Wait, it's all ")
-            (<a> {
-              href = "https://cl.tvl.fyi/q/hashtag:cursed";
-            } (esc "cursed"))
+            (<a>
+              {
+                href = "https://cl.tvl.fyi/q/hashtag:cursed";
+              }
+              (esc "cursed"))
             (esc " nix hacks?")
           ])
-          (<dd> {} (esc "A: Always has been. ๐Ÿ”ซ"))
-          (<dt> {} (esc "Q: Why does this work?"))
-          (<dd> {} [
+          (<dd> { } (esc "A: Always has been. ๐Ÿ”ซ"))
+          (<dt> { } (esc "Q: Why does this work?"))
+          (<dd> { } [
             (esc "Because nix ")
-            (<a> {
-              href = "https://github.com/NixOS/nix/blob/293220bed5a75efc963e33c183787e87e55e28d9/src/libexpr/parser.y#L410-L416";
-            } (esc "translates "))
-            (<a> {
-              href = "https://github.com/NixOS/nix/blob/293220bed5a75efc963e33c183787e87e55e28d9/src/libexpr/lexer.l#L100";
-            } (esc "SPATH tokens"))
+            (<a>
+              {
+                href = "https://github.com/NixOS/nix/blob/293220bed5a75efc963e33c183787e87e55e28d9/src/libexpr/parser.y#L410-L416";
+              }
+              (esc "translates "))
+            (<a>
+              {
+                href = "https://github.com/NixOS/nix/blob/293220bed5a75efc963e33c183787e87e55e28d9/src/libexpr/lexer.l#L100";
+              }
+              (esc "SPATH tokens"))
             (esc " like ")
-            (<code> {} (esc "<nixpkgs>"))
+            (<code> { } (esc "<nixpkgs>"))
             (esc " into calls to ")
-            (<code> {} (esc "__findFile"))
+            (<code> { } (esc "__findFile"))
             (esc " in the ")
-            (<em> {} (esc "current"))
+            (<em> { } (esc "current"))
             (esc " scope.")
           ])
         ])
@@ -67,7 +75,8 @@ let
   ]);
 in
 
-pkgs.runCommandNoCC "html.nix.html" {
+pkgs.runCommandNoCC "html.nix.html"
+{
   passAsFile = [ "exampleDocument" ];
   inherit exampleDocument;
   nativeBuildInputs = [ pkgs.html5validator ];
diff --git a/users/sterni/nix/int/default.nix b/users/sterni/nix/int/default.nix
index b315757127..54b5596472 100644
--- a/users/sterni/nix/int/default.nix
+++ b/users/sterni/nix/int/default.nix
@@ -47,12 +47,12 @@ let
         if i == 0
         then ""
         else go (bitShiftR i 4)
-           + string.charAt (bitAnd i 15) hexdigits;
+          + string.charAt (bitAnd i 15) hexdigits;
       sign = lib.optionalString (int < 0) "-";
     in
-      if int == 0
-      then "0"
-      else "${sign}${go (abs int)}";
+    if int == 0
+    then "0"
+    else "${sign}${go (abs int)}";
 
   fromHexMap = builtins.listToAttrs
     (lib.imap0 (i: c: { name = c; value = i; })
@@ -72,11 +72,12 @@ let
           val = v.val + (fromHexMap."${d}" * v.mul);
           mul = v.mul * 16;
         })
-        { val = 0; mul = 1; } digits;
+        { val = 0; mul = 1; }
+        digits;
     in
-      if negative
-      then -parsed.val
-      else parsed.val;
+    if negative
+    then -parsed.val
+    else parsed.val;
 
   # A nix integer is a 64bit signed integer
   maxBound = 9223372036854775807;
@@ -99,7 +100,8 @@ let
 
   inRange = a: b: x: x >= a && x <= b;
 
-in {
+in
+{
   inherit
     maxBound
     minBound
diff --git a/users/sterni/nix/int/tests/default.nix b/users/sterni/nix/int/tests/default.nix
index fac45dd251..8d2263b421 100644
--- a/users/sterni/nix/int/tests/default.nix
+++ b/users/sterni/nix/int/tests/default.nix
@@ -31,22 +31,262 @@ let
   ];
 
   expectedBytes = [
-    "00" "01" "02" "03" "04" "05" "06" "07" "08" "09" "0A" "0B" "0C" "0D" "0E" "0F"
-    "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "1A" "1B" "1C" "1D" "1E" "1F"
-    "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "2A" "2B" "2C" "2D" "2E" "2F"
-    "30" "31" "32" "33" "34" "35" "36" "37" "38" "39" "3A" "3B" "3C" "3D" "3E" "3F"
-    "40" "41" "42" "43" "44" "45" "46" "47" "48" "49" "4A" "4B" "4C" "4D" "4E" "4F"
-    "50" "51" "52" "53" "54" "55" "56" "57" "58" "59" "5A" "5B" "5C" "5D" "5E" "5F"
-    "60" "61" "62" "63" "64" "65" "66" "67" "68" "69" "6A" "6B" "6C" "6D" "6E" "6F"
-    "70" "71" "72" "73" "74" "75" "76" "77" "78" "79" "7A" "7B" "7C" "7D" "7E" "7F"
-    "80" "81" "82" "83" "84" "85" "86" "87" "88" "89" "8A" "8B" "8C" "8D" "8E" "8F"
-    "90" "91" "92" "93" "94" "95" "96" "97" "98" "99" "9A" "9B" "9C" "9D" "9E" "9F"
-    "A0" "A1" "A2" "A3" "A4" "A5" "A6" "A7" "A8" "A9" "AA" "AB" "AC" "AD" "AE" "AF"
-    "B0" "B1" "B2" "B3" "B4" "B5" "B6" "B7" "B8" "B9" "BA" "BB" "BC" "BD" "BE" "BF"
-    "C0" "C1" "C2" "C3" "C4" "C5" "C6" "C7" "C8" "C9" "CA" "CB" "CC" "CD" "CE" "CF"
-    "D0" "D1" "D2" "D3" "D4" "D5" "D6" "D7" "D8" "D9" "DA" "DB" "DC" "DD" "DE" "DF"
-    "E0" "E1" "E2" "E3" "E4" "E5" "E6" "E7" "E8" "E9" "EA" "EB" "EC" "ED" "EE" "EF"
-    "F0" "F1" "F2" "F3" "F4" "F5" "F6" "F7" "F8" "F9" "FA" "FB" "FC" "FD" "FE" "FF"
+    "00"
+    "01"
+    "02"
+    "03"
+    "04"
+    "05"
+    "06"
+    "07"
+    "08"
+    "09"
+    "0A"
+    "0B"
+    "0C"
+    "0D"
+    "0E"
+    "0F"
+    "10"
+    "11"
+    "12"
+    "13"
+    "14"
+    "15"
+    "16"
+    "17"
+    "18"
+    "19"
+    "1A"
+    "1B"
+    "1C"
+    "1D"
+    "1E"
+    "1F"
+    "20"
+    "21"
+    "22"
+    "23"
+    "24"
+    "25"
+    "26"
+    "27"
+    "28"
+    "29"
+    "2A"
+    "2B"
+    "2C"
+    "2D"
+    "2E"
+    "2F"
+    "30"
+    "31"
+    "32"
+    "33"
+    "34"
+    "35"
+    "36"
+    "37"
+    "38"
+    "39"
+    "3A"
+    "3B"
+    "3C"
+    "3D"
+    "3E"
+    "3F"
+    "40"
+    "41"
+    "42"
+    "43"
+    "44"
+    "45"
+    "46"
+    "47"
+    "48"
+    "49"
+    "4A"
+    "4B"
+    "4C"
+    "4D"
+    "4E"
+    "4F"
+    "50"
+    "51"
+    "52"
+    "53"
+    "54"
+    "55"
+    "56"
+    "57"
+    "58"
+    "59"
+    "5A"
+    "5B"
+    "5C"
+    "5D"
+    "5E"
+    "5F"
+    "60"
+    "61"
+    "62"
+    "63"
+    "64"
+    "65"
+    "66"
+    "67"
+    "68"
+    "69"
+    "6A"
+    "6B"
+    "6C"
+    "6D"
+    "6E"
+    "6F"
+    "70"
+    "71"
+    "72"
+    "73"
+    "74"
+    "75"
+    "76"
+    "77"
+    "78"
+    "79"
+    "7A"
+    "7B"
+    "7C"
+    "7D"
+    "7E"
+    "7F"
+    "80"
+    "81"
+    "82"
+    "83"
+    "84"
+    "85"
+    "86"
+    "87"
+    "88"
+    "89"
+    "8A"
+    "8B"
+    "8C"
+    "8D"
+    "8E"
+    "8F"
+    "90"
+    "91"
+    "92"
+    "93"
+    "94"
+    "95"
+    "96"
+    "97"
+    "98"
+    "99"
+    "9A"
+    "9B"
+    "9C"
+    "9D"
+    "9E"
+    "9F"
+    "A0"
+    "A1"
+    "A2"
+    "A3"
+    "A4"
+    "A5"
+    "A6"
+    "A7"
+    "A8"
+    "A9"
+    "AA"
+    "AB"
+    "AC"
+    "AD"
+    "AE"
+    "AF"
+    "B0"
+    "B1"
+    "B2"
+    "B3"
+    "B4"
+    "B5"
+    "B6"
+    "B7"
+    "B8"
+    "B9"
+    "BA"
+    "BB"
+    "BC"
+    "BD"
+    "BE"
+    "BF"
+    "C0"
+    "C1"
+    "C2"
+    "C3"
+    "C4"
+    "C5"
+    "C6"
+    "C7"
+    "C8"
+    "C9"
+    "CA"
+    "CB"
+    "CC"
+    "CD"
+    "CE"
+    "CF"
+    "D0"
+    "D1"
+    "D2"
+    "D3"
+    "D4"
+    "D5"
+    "D6"
+    "D7"
+    "D8"
+    "D9"
+    "DA"
+    "DB"
+    "DC"
+    "DD"
+    "DE"
+    "DF"
+    "E0"
+    "E1"
+    "E2"
+    "E3"
+    "E4"
+    "E5"
+    "E6"
+    "E7"
+    "E8"
+    "E9"
+    "EA"
+    "EB"
+    "EC"
+    "ED"
+    "EE"
+    "EF"
+    "F0"
+    "F1"
+    "F2"
+    "F3"
+    "F4"
+    "F5"
+    "F6"
+    "F7"
+    "F8"
+    "F9"
+    "FA"
+    "FB"
+    "FC"
+    "FD"
+    "FE"
+    "FF"
   ];
 
   hexByte = i: string.fit { width = 2; char = "0"; } (int.toHex i);
@@ -64,14 +304,18 @@ let
   ];
 
   testHex = it "checks conversion to hex" (lib.flatten [
-    (lib.imap0 (i: hex: [
-      (assertEq "hexByte ${toString i} == ${hex}" (hexByte i) hex)
-      (assertEq "${toString i} == fromHex ${hex}" i (int.fromHex hex))
-    ]) expectedBytes)
-    (builtins.map ({ left, right }: [
-      (assertEq "toHex ${toString left} == ${right}" (int.toHex left) right)
-      (assertEq "${toString left} == fromHex ${right}" left (int.fromHex right))
-    ]) hexInts)
+    (lib.imap0
+      (i: hex: [
+        (assertEq "hexByte ${toString i} == ${hex}" (hexByte i) hex)
+        (assertEq "${toString i} == fromHex ${hex}" i (int.fromHex hex))
+      ])
+      expectedBytes)
+    (builtins.map
+      ({ left, right }: [
+        (assertEq "toHex ${toString left} == ${right}" (int.toHex left) right)
+        (assertEq "${toString left} == fromHex ${right}" left (int.fromHex right))
+      ])
+      hexInts)
   ]);
 
   testBasic = it "checks basic int operations" [
@@ -94,20 +338,23 @@ let
   ];
 
   testExp = it "checks exponentiation"
-    (builtins.map ({ left, right }:
-      assertEq
-        "2 ^ ${toString left} == ${toString right}"
-        (int.exp 2 left) right) expNumbers);
+    (builtins.map
+      ({ left, right }:
+        assertEq
+          "2 ^ ${toString left} == ${toString right}"
+          (int.exp 2 left)
+          right)
+      expNumbers);
 
   shifts = [
-    { a =   2; b = 5; c =   64; op = "<<"; }
-    { a =  -2; b = 5; c =  -64; op = "<<"; }
+    { a = 2; b = 5; c = 64; op = "<<"; }
+    { a = -2; b = 5; c = -64; op = "<<"; }
     { a = 123; b = 4; c = 1968; op = "<<"; }
-    { a =   1; b = 8; c =  256; op = "<<"; }
-    { a = 256; b = 8; c =    1; op = ">>"; }
-    { a = 374; b = 2; c =   93; op = ">>"; }
-    { a =   2; b = 2; c =    0; op = ">>"; }
-    { a =  99; b = 9; c =    0; op = ">>"; }
+    { a = 1; b = 8; c = 256; op = "<<"; }
+    { a = 256; b = 8; c = 1; op = ">>"; }
+    { a = 374; b = 2; c = 93; op = ">>"; }
+    { a = 2; b = 2; c = 0; op = ">>"; }
+    { a = 99; b = 9; c = 0; op = ">>"; }
   ];
 
   checkShift = { a, b, c, op }@args:
@@ -116,15 +363,18 @@ let
         "<<" = int.bitShiftL;
         ">>" = int.bitShiftR;
       };
-    in assertEq "${toString a} ${op} ${toString b} == ${toString c}" (f a b) c;
+    in
+    assertEq "${toString a} ${op} ${toString b} == ${toString c}" (f a b) c;
 
   checkShiftRDivExp = n:
     assertEq "${toString n} >> 5 == ${toString n} / 2 ^ 5"
-      (int.bitShiftR n 5) (int.div n (int.exp 2 5));
+      (int.bitShiftR n 5)
+      (int.div n (int.exp 2 5));
 
   checkShiftLMulExp = n:
     assertEq "${toString n} >> 6 == ${toString n} * 2 ^ 6"
-      (int.bitShiftL n 5) (int.mul n (int.exp 2 5));
+      (int.bitShiftL n 5)
+      (int.mul n (int.exp 2 5));
 
   testBit = it "checks bitwise operations" (lib.flatten [
     (builtins.map checkShift shifts)
@@ -160,11 +410,11 @@ let
   ]);
 
   divisions = [
-    { a =  2; b =  1; c = 2; mod = 0;}
-    { a =  2; b =  2; c = 1; mod = 0;}
-    { a = 20; b = 10; c = 2; mod = 0;}
-    { a = 12; b =  5; c = 2; mod = 2;}
-    { a = 23; b =  4; c = 5; mod = 3;}
+    { a = 2; b = 1; c = 2; mod = 0; }
+    { a = 2; b = 2; c = 1; mod = 0; }
+    { a = 20; b = 10; c = 2; mod = 0; }
+    { a = 12; b = 5; c = 2; mod = 2; }
+    { a = 23; b = 4; c = 5; mod = 3; }
   ];
 
   checkDiv = n: { a, b, c, mod }: [
@@ -176,28 +426,34 @@ let
   testDivMod = it "checks integer division and modulo"
     (lib.flatten [
       (builtins.map (checkDiv "+a / +b") divisions)
-      (builtins.map (fun.rl (checkDiv "-a / +b") (x: x // {
-        a = -x.a;
-        c = -x.c;
-        mod = -x.mod;
-      })) divisions)
-      (builtins.map (fun.rl (checkDiv "+a / -b") (x: x // {
-        b = -x.b;
-        c = -x.c;
-      })) divisions)
-      (builtins.map (fun.rl (checkDiv "-a / -b") (x: x // {
-        a = -x.a;
-        b = -x.b;
-        mod = -x.mod;
-      })) divisions)
+      (builtins.map
+        (fun.rl (checkDiv "-a / +b") (x: x // {
+          a = -x.a;
+          c = -x.c;
+          mod = -x.mod;
+        }))
+        divisions)
+      (builtins.map
+        (fun.rl (checkDiv "+a / -b") (x: x // {
+          b = -x.b;
+          c = -x.c;
+        }))
+        divisions)
+      (builtins.map
+        (fun.rl (checkDiv "-a / -b") (x: x // {
+          a = -x.a;
+          b = -x.b;
+          mod = -x.mod;
+        }))
+        divisions)
     ]);
 
 in
-  runTestsuite "nix.int" [
-    testBounds
-    testHex
-    testBasic
-    testExp
-    testBit
-    testDivMod
-  ]
+runTestsuite "nix.int" [
+  testBounds
+  testHex
+  testBasic
+  testExp
+  testBit
+  testDivMod
+]
diff --git a/users/sterni/nix/string/default.nix b/users/sterni/nix/string/default.nix
index 19d2cec243..852ef2538f 100644
--- a/users/sterni/nix/string/default.nix
+++ b/users/sterni/nix/string/default.nix
@@ -21,7 +21,8 @@ let
   charAt = i: s:
     let
       r = builtins.substring i 1 s;
-    in if r == "" then null else r;
+    in
+    if r == "" then null else r;
 
   charIndex = char: s:
     let
@@ -32,7 +33,8 @@ let
           [ (charAt i s == char) i ]
           [ true (go (i + 1)) ]
         ];
-    in go 0;
+    in
+    go 0;
 
   toChars = lib.stringToCharacters;
   fromChars = lib.concatStrings;
@@ -46,15 +48,16 @@ let
     let
       leftS = fromChars (builtins.genList (_: char) left);
       rightS = fromChars (builtins.genList (_: char) right);
-    in "${leftS}${s}${rightS}";
+    in
+    "${leftS}${s}${rightS}";
 
   fit = { char ? " ", width, side ? "left" }: s:
     let
       diff = width - builtins.stringLength s;
     in
-      if diff <= 0
-      then s
-      else pad { inherit char; "${side}" = diff; } s;
+    if diff <= 0
+    then s
+    else pad { inherit char; "${side}" = diff; } s;
 
   # pattern matching for strings only
   match = val: matcher: matcher."${val}";
@@ -80,23 +83,28 @@ let
       tokens = lib.flatten (builtins.split "(%.)" formatString);
       argsNeeded = builtins.length (builtins.filter specifierWithArg tokens);
 
-      format = args: (builtins.foldl' ({ out ? "", argIndex ? 0 }: token: {
-        argIndex = argIndex + (if specifierWithArg token then 1 else 0);
-        out =
-          /**/ if token == "%s" then out + builtins.elemAt args argIndex
-          else if token == "%%" then out + "%"
-          else if isSpecifier token then throw "Unsupported format specifier ${token}"
-          else out + token;
-      }) {} tokens).out;
+      format = args: (builtins.foldl'
+        ({ out ? "", argIndex ? 0 }: token: {
+          argIndex = argIndex + (if specifierWithArg token then 1 else 0);
+          out =
+            /**/
+            if token == "%s" then out + builtins.elemAt args argIndex
+            else if token == "%%" then out + "%"
+            else if isSpecifier token then throw "Unsupported format specifier ${token}"
+            else out + token;
+        })
+        { }
+        tokens).out;
 
       accumulateArgs = argCount: args:
         if argCount > 0
         then arg: accumulateArgs (argCount - 1) (args ++ [ arg ])
         else format args;
     in
-      accumulateArgs argsNeeded [];
+    accumulateArgs argsNeeded [ ];
 
-in {
+in
+{
   inherit
     take
     drop
diff --git a/users/sterni/nix/string/tests/default.nix b/users/sterni/nix/string/tests/default.nix
index c8aec94640..e9015e95dc 100644
--- a/users/sterni/nix/string/tests/default.nix
+++ b/users/sterni/nix/string/tests/default.nix
@@ -63,10 +63,10 @@ let
   ];
 
 in
-  runTestsuite "nix.string" [
-    testTakeDrop
-    testIndexing
-    testFinding
-    testMatch
-    testPrintf
-  ]
+runTestsuite "nix.string" [
+  testTakeDrop
+  testIndexing
+  testFinding
+  testMatch
+  testPrintf
+]
diff --git a/users/sterni/nix/url/default.nix b/users/sterni/nix/url/default.nix
index 37bd0de66a..4a401873a1 100644
--- a/users/sterni/nix/url/default.nix
+++ b/users/sterni/nix/url/default.nix
@@ -10,9 +10,24 @@ let
     ;
 
   reserved = c: builtins.elem c [
-    "!" "#" "$" "&" "'" "(" ")"
-    "*" "+" "," "/" ":" ";" "="
-    "?" "@" "[" "]"
+    "!"
+    "#"
+    "$"
+    "&"
+    "'"
+    "("
+    ")"
+    "*"
+    "+"
+    ","
+    "/"
+    ":"
+    ";"
+    "="
+    "?"
+    "@"
+    "["
+    "]"
   ];
 
   unreserved = c: char.asciiAlphaNum c
@@ -21,11 +36,13 @@ let
   percentEncode = c:
     if unreserved c
     then c
-    else "%" + (string.fit {
-      width = 2;
-      char = "0";
-      side = "left";
-    } (int.toHex (char.ord c)));
+    else "%" + (string.fit
+      {
+        width = 2;
+        char = "0";
+        side = "left";
+      }
+      (int.toHex (char.ord c)));
 
   encode = { leaveReserved ? false }: s:
     let
@@ -34,7 +51,8 @@ let
         if leaveReserved && reserved c
         then c
         else percentEncode c;
-    in lib.concatStrings (builtins.map tr chars);
+    in
+    lib.concatStrings (builtins.map tr chars);
 
   decode = s:
     let
@@ -71,9 +89,10 @@ let
         ];
 
     in
-      (builtins.foldl' decodeStep {} tokens).result;
+    (builtins.foldl' decodeStep { } tokens).result;
 
-in {
+in
+{
   inherit
     encode
     decode
diff --git a/users/sterni/nix/url/tests/default.nix b/users/sterni/nix/url/tests/default.nix
index 7cf53cde15..4eb6f95ccd 100644
--- a/users/sterni/nix/url/tests/default.nix
+++ b/users/sterni/nix/url/tests/default.nix
@@ -14,11 +14,13 @@ let
 
   checkEncoding = args: { left, right }:
     assertEq "encode ${builtins.toJSON left} == ${builtins.toJSON right}"
-      (url.encode args left) right;
+      (url.encode args left)
+      right;
 
   checkDecoding = { left, right }:
-  assertEq "${builtins.toJSON left} == decode ${builtins.toJSON right}"
-    (url.decode left) right;
+    assertEq "${builtins.toJSON left} == decode ${builtins.toJSON right}"
+      (url.decode left)
+      right;
 
   unreserved = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-_~";
 
@@ -33,7 +35,7 @@ let
   ];
 
   testEncode = it "checks url.encode"
-    (builtins.map (checkEncoding {}) encodeExpected);
+    (builtins.map (checkEncoding { }) encodeExpected);
 
   testDecode = it "checks url.decode"
     (builtins.map checkDecoding encodeExpected);
@@ -50,7 +52,7 @@ let
       "urn:oasis:names:specification:docbook:dtd:xml:4.1.2"
     ]);
 in
-  runTestsuite "nix.url" [
-    testEncode
-    testLeaveReserved
-  ]
+runTestsuite "nix.url" [
+  testEncode
+  testLeaveReserved
+]
diff --git a/users/sterni/nix/utf8/default.nix b/users/sterni/nix/utf8/default.nix
index 270da934b6..71c846c042 100644
--- a/users/sterni/nix/utf8/default.nix
+++ b/users/sterni/nix/utf8/default.nix
@@ -25,7 +25,7 @@ let
      Type: integer -> integer
   */
   byteCount = i: flow.cond [
-    [ (int.bitAnd i 128 == 0)   1 ]
+    [ (int.bitAnd i 128 == 0) 1 ]
     [ (int.bitAnd i 224 == 192) 2 ]
     [ (int.bitAnd i 240 == 224) 3 ]
     [ (int.bitAnd i 248 == 240) 4 ]
@@ -45,30 +45,30 @@ let
     first:
     # byte position as an index starting with 0
     pos:
-      let
-        defaultRange = int.inRange 128 191;
-
-        secondBytePredicate = flow.switch first [
-          [ (int.inRange 194 223) defaultRange          ] # C2..DF
-          [ 224                   (int.inRange 160 191) ] # E0
-          [ (int.inRange 225 236) defaultRange          ] # E1..EC
-          [ 237                   (int.inRange 128 159) ] # ED
-          [ (int.inRange 238 239) defaultRange          ] # EE..EF
-          [ 240                   (int.inRange 144 191) ] # F0
-          [ (int.inRange 241 243) defaultRange          ] # F1..F3
-          [ 244                   (int.inRange 128 143) ] # F4
-          [ (fun.const true)      null                  ]
-        ];
+    let
+      defaultRange = int.inRange 128 191;
+
+      secondBytePredicate = flow.switch first [
+        [ (int.inRange 194 223) defaultRange ] # C2..DF
+        [ 224 (int.inRange 160 191) ] # E0
+        [ (int.inRange 225 236) defaultRange ] # E1..EC
+        [ 237 (int.inRange 128 159) ] # ED
+        [ (int.inRange 238 239) defaultRange ] # EE..EF
+        [ 240 (int.inRange 144 191) ] # F0
+        [ (int.inRange 241 243) defaultRange ] # F1..F3
+        [ 244 (int.inRange 128 143) ] # F4
+        [ (fun.const true) null ]
+      ];
 
-        firstBytePredicate = byte: assert first == byte;
-          first < 128 || secondBytePredicate != null;
-      in
-        # Either ASCII or in one of the byte ranges of Table 3-6.
-        if pos == 0 then firstBytePredicate
-        # return predicate according to Table 3-6.
-        else if pos == 1 then assert secondBytePredicate != null; secondBytePredicate
-        # 3rd and 4th byte have only one validity rule
-        else defaultRange;
+      firstBytePredicate = byte: assert first == byte;
+        first < 128 || secondBytePredicate != null;
+    in
+    # Either ASCII or in one of the byte ranges of Table 3-6.
+    if pos == 0 then firstBytePredicate
+    # return predicate according to Table 3-6.
+    else if pos == 1 then assert secondBytePredicate != null; secondBytePredicate
+    # 3rd and 4th byte have only one validity rule
+    else defaultRange;
 
   /* Iteration step for decoding an UTF-8 byte sequence.
      It decodes incrementally, i. e. it has to be fed
@@ -128,23 +128,24 @@ let
             # the current value by the amount of bytes left.
             offset = (count - (pos + 1)) * 6;
           in
-            code + (int.bitShiftL (int.bitAnd mask value) offset);
+          code + (int.bitShiftL (int.bitAnd mask value) offset);
       illFormedMsg =
         "Ill-formed byte ${int.toHex value} at position ${toString pos} in ${toString count} byte UTF-8 sequence";
     in
-      if !(wellFormedByte first pos value) then builtins.throw illFormedMsg
-      else if pos + 1 == count
-      then (builtins.removeAttrs args [ # allow extra state being passed through
-        "count"
-        "code"
-        "pos"
-        "first"
-      ]) // { result = newCode; }
-      else (builtins.removeAttrs args [ "result" ]) // {
-        inherit count first;
-        code = newCode;
-        pos  = pos + 1;
-      };
+    if !(wellFormedByte first pos value) then builtins.throw illFormedMsg
+    else if pos + 1 == count
+    then (builtins.removeAttrs args [
+      # allow extra state being passed through
+      "count"
+      "code"
+      "pos"
+      "first"
+    ]) // { result = newCode; }
+    else (builtins.removeAttrs args [ "result" ]) // {
+      inherit count first;
+      code = newCode;
+      pos = pos + 1;
+    };
 
   /* Decode an UTF-8 string into a list of codepoints.
 
@@ -161,7 +162,7 @@ let
           {
             key = "start";
             stringIndex = -1;
-            state = {};
+            state = { };
             codepoint = null;
           }
         ];
@@ -170,7 +171,8 @@ let
             # updated values for current iteration step
             newIndex = stringIndex + 1;
             newState = step state (builtins.substring newIndex 1 s);
-          in lib.optional (newIndex < stringLength) {
+          in
+          lib.optional (newIndex < stringLength) {
             # unique keys to make genericClosure happy
             key = toString newIndex;
             # carryover state for the next step
@@ -183,35 +185,39 @@ let
     in
     # extract all steps that yield a code point into a list
     builtins.map (v: v.codepoint) (
-      builtins.filter (
-        { codepoint, stringIndex, state, ... }:
-
-        let
-          # error message in case we are missing bytes at the end of input
-          earlyEndMsg =
-            if state ? count && state ? pos
-            then "Missing ${toString (with state; count - pos)} bytes at end of input"
-            else "Unexpected end of input";
-        in
-
-        # filter out all iteration steps without a codepoint value
-        codepoint != null
+      builtins.filter
+        (
+          { codepoint, stringIndex, state, ... }:
+
+          let
+            # error message in case we are missing bytes at the end of input
+            earlyEndMsg =
+              if state ? count && state ? pos
+              then "Missing ${toString (with state; count - pos)} bytes at end of input"
+              else "Unexpected end of input";
+          in
+
+          # filter out all iteration steps without a codepoint value
+          codepoint != null
           # if we are at the iteration step of a non-empty input string, throw
           # an error if no codepoint was returned, as it indicates an incomplete
           # UTF-8 sequence.
           || (stringLength > 0 && stringIndex == stringLength - 1 && throw earlyEndMsg)
 
-      ) iterResult
+        )
+        iterResult
     );
 
   /* Pretty prints a Unicode codepoint in the U+<HEX> notation.
 
      Type: integer -> string
   */
-  formatCodepoint = cp: "U+" + string.fit {
-    width = 4;
-    char = "0";
-  } (int.toHex cp);
+  formatCodepoint = cp: "U+" + string.fit
+    {
+      width = 4;
+      char = "0";
+    }
+    (int.toHex cp);
 
   encodeCodepoint = cp:
     let
@@ -219,11 +225,11 @@ let
       # Note that this doesn't check if the Unicode codepoint is allowed,
       # but rather allows all theoretically UTF-8-encodeable ones.
       count = flow.switch cp [
-        [ (int.inRange 0 127)         1 ] # 00000000 0xxxxxxx
-        [ (int.inRange 128 2047)      2 ] # 00000yyy yyxxxxxx
-        [ (int.inRange 2048 65535)    3 ] # zzzzyyyy yyxxxxxx
+        [ (int.inRange 0 127) 1 ] # 00000000 0xxxxxxx
+        [ (int.inRange 128 2047) 2 ] # 00000yyy yyxxxxxx
+        [ (int.inRange 2048 65535) 3 ] # zzzzyyyy yyxxxxxx
         [ (int.inRange 65536 1114111) 4 ] # 000uuuuu zzzzyyyy yyxxxxxx,
-                                          # capped at U+10FFFF
+        # capped at U+10FFFF
 
         [ (fun.const true) (builtins.throw invalidCodepointMsg) ]
       ];
@@ -234,32 +240,34 @@ let
       # according to Table 3-6. from The Unicode Standard, Version 13.0,
       # section 3.9. u is split into uh and ul since they are used in
       # different bytes in the end.
-      components = lib.mapAttrs (_: { mask, offset }:
-        int.bitAnd (int.bitShiftR cp offset) mask
-      ) {
-        x = {
-          mask = if count > 1 then 63 else 127;
-          offset = 0;
-        };
-        y = {
-          mask = if count > 2 then 63 else 31;
-          offset = 6;
-        };
-        z = {
-          mask = 15;
-          offset = 12;
-        };
-        # u which belongs into the second byte
-        ul = {
-          mask = 3;
-          offset = 16;
-        };
-        # u which belongs into the first byte
-        uh = {
-          mask = 7;
-          offset = 18;
+      components = lib.mapAttrs
+        (_: { mask, offset }:
+          int.bitAnd (int.bitShiftR cp offset) mask
+        )
+        {
+          x = {
+            mask = if count > 1 then 63 else 127;
+            offset = 0;
+          };
+          y = {
+            mask = if count > 2 then 63 else 31;
+            offset = 6;
+          };
+          z = {
+            mask = 15;
+            offset = 12;
+          };
+          # u which belongs into the second byte
+          ul = {
+            mask = 3;
+            offset = 16;
+          };
+          # u which belongs into the first byte
+          uh = {
+            mask = 7;
+            offset = 18;
+          };
         };
-      };
       inherit (components) x y z ul uh;
 
       # Finally construct the byte sequence for the given codepoint. This is
@@ -286,15 +294,18 @@ let
 
       unableToEncodeMessage = "Can't encode ${formatCodepoint cp} as UTF-8";
 
-    in string.fromBytes (
-      builtins.genList (i:
-        let
-          byte = builtins.elemAt bytes i;
-        in
+    in
+    string.fromBytes (
+      builtins.genList
+        (i:
+          let
+            byte = builtins.elemAt bytes i;
+          in
           if wellFormedByte firstByte i byte
           then byte
           else builtins.throw unableToEncodeMessage
-      ) count
+        )
+        count
     );
 
   /* Encode a list of Unicode codepoints into an UTF-8 string.
@@ -303,7 +314,8 @@ let
   */
   encode = lib.concatMapStrings encodeCodepoint;
 
-in {
+in
+{
   inherit
     encode
     decode
diff --git a/users/sterni/nix/utf8/tests/default.nix b/users/sterni/nix/utf8/tests/default.nix
index ddcd34208a..40783eab24 100644
--- a/users/sterni/nix/utf8/tests/default.nix
+++ b/users/sterni/nix/utf8/tests/default.nix
@@ -25,9 +25,10 @@ let
     char
     ;
 
-  rustDecoder = rustSimple {
-    name = "utf8-decode";
-  } ''
+  rustDecoder = rustSimple
+    {
+      name = "utf8-decode";
+    } ''
     use std::io::{self, Read};
     fn main() -> std::io::Result<()> {
       let mut buffer = String::new();
@@ -47,10 +48,11 @@ let
 
   rustDecode = s:
     let
-      expr = runCommandLocal "${s}-decoded" {} ''
+      expr = runCommandLocal "${s}-decoded" { } ''
         printf '%s' ${lib.escapeShellArg s} | ${rustDecoder} > $out
       '';
-    in import expr;
+    in
+    import expr;
 
   hexDecode = l:
     utf8.decode (string.fromBytes (builtins.map int.fromHex l));
@@ -65,23 +67,27 @@ let
     (assertEq "well-formed: F4 80 83 92" (hexDecode [ "F4" "80" "83" "92" ]) [ 1048786 ])
     (assertThrows "Codepoint out of range: 0xFFFFFF" (hexEncode [ "FFFFFF" ]))
     (assertThrows "Codepoint out of range: -0x02" (hexEncode [ "-02" ]))
-  ] ++ builtins.genList (i:
-    let
-      cp = i + int.fromHex "D800";
-    in
+  ] ++ builtins.genList
+    (i:
+      let
+        cp = i + int.fromHex "D800";
+      in
       assertThrows "Can't encode UTF-16 reserved characters: ${utf8.formatCodepoint cp}"
         (utf8.encode [ cp ])
-  ) (int.fromHex "07FF"));
+    )
+    (int.fromHex "07FF"));
 
   testAscii = it "checks decoding of ascii strings"
-    (builtins.map (s: assertEq "ASCII decoding is equal to UTF-8 decoding for \"${s}\""
-      (string.toBytes s) (utf8.decode s)) [
-        "foo bar"
-        "hello\nworld"
-        "carriage\r\nreturn"
-        "1238398494829304 []<><>({})[]!!)"
-        (string.take 127 char.allChars)
-      ]);
+    (builtins.map
+      (s: assertEq "ASCII decoding is equal to UTF-8 decoding for \"${s}\""
+        (string.toBytes s)
+        (utf8.decode s)) [
+      "foo bar"
+      "hello\nworld"
+      "carriage\r\nreturn"
+      "1238398494829304 []<><>({})[]!!)"
+      (string.take 127 char.allChars)
+    ]);
 
   randomUnicode = [
     "" # empty string should yield empty list
@@ -126,16 +132,17 @@ let
   testDecodingEncoding = it "checks that decoding and then encoding forms an identity"
     (builtins.map
       (s: assertEq "Decoding and then encoding โ€œ${s}โ€ yields itself"
-        (utf8.encode (utf8.decode s)) s)
+        (utf8.encode (utf8.decode s))
+        s)
       (lib.flatten [
         glassSentences
         randomUnicode
       ]));
 
 in
-  runTestsuite "nix.utf8" [
-    testFailures
-    testAscii
-    testDecoding
-    testDecodingEncoding
-  ]
+runTestsuite "nix.utf8" [
+  testFailures
+  testAscii
+  testDecoding
+  testDecodingEncoding
+]