about summary refs log tree commit diff
path: root/lib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/default.nix54
1 files changed, 27 insertions, 27 deletions
diff --git a/lib/default.nix b/lib/default.nix
index e06b7ec..fbb6086 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -4,7 +4,7 @@
   system,
   ...
 }:
-rec {
+{
   my = import ./my.nix { inherit lib inputs system; };
 
   dns = import ./dns.nix { inherit lib inputs system; };
@@ -18,7 +18,7 @@ rec {
     assert (builtins.isInt number) || (builtins.isFloat number);
     builtins.div number 2 == 0;
 
-  isOdd = number: !isEven number;
+  isOdd = number: !lib.isEven number;
 
   pow =
     base: exponent:
@@ -29,20 +29,21 @@ rec {
   mkTcpMem =
     min: ini: max:
     assert min <= ini && ini <= max;
-    lib.concatMapStrings (x: toString x + " ") (
-      map (pow 2) [
-        min
-        ini
-        max
-      ]
-    );
+    [
+      min
+      ini
+      max
+    ]
+    |> map (lib.pow 2)
+    |> map toString
+    |> lib.concatStringsSep " ";
 
   # Load all files from directory (partially recursively).
   #
   # Usage: Assuming other Nix files are present in a directory:
   # ```
   # { ... }: {
-  #   imports = attrValue (modulesIn ./.);
+  #   imports = modulesIn ./. |> attrValues;
   #
   #   services.foobar.enable = true;
   # }
@@ -50,23 +51,22 @@ rec {
   #
   modulesIn =
     dir:
-    lib.pipe dir [
-      builtins.readDir
-      (lib.mapAttrsToList (
-        name: type:
-        let
-          modulePath = dir + "/${name}";
-        in
-        if type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix" then
-          [ (lib.nameValuePair (lib.removeSuffix ".nix" name) modulePath) ]
-        else if type == "directory" && lib.pathExists (modulePath + "/default.nix") then
-          [ (lib.nameValuePair name modulePath) ]
-        else
-          [ ]
-      ))
-      lib.concatLists
-      lib.listToAttrs
-    ];
+    dir
+    |> builtins.readDir
+    |> (lib.mapAttrsToList (
+      name: type:
+      let
+        modulePath = dir + "/${name}";
+      in
+      if type == "regular" && lib.hasSuffix ".nix" name && name != "default.nix" then
+        [ (lib.nameValuePair (lib.removeSuffix ".nix" name) modulePath) ]
+      else if type == "directory" && lib.pathExists (modulePath + "/default.nix") then
+        [ (lib.nameValuePair name modulePath) ]
+      else
+        [ ]
+    ))
+    |> lib.concatLists
+    |> lib.listToAttrs;
 
   # Override a module using another Nixpkgs source tree.
   #

Consider giving Nix/NixOS a try! <3