aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix5
-rw-r--r--lib/ipv4.nix7
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 76eb693..d6024bc 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,5 +1,6 @@
-final: _:
-with final; {
+final: _: let
+ inherit (final) pow foldl genList id reverseList bitAnd pow2 length add zipListsWith;
+in {
# Generic power of number
pow = base: e:
if e == 0
diff --git a/lib/ipv4.nix b/lib/ipv4.nix
index c843cb6..537525f 100644
--- a/lib/ipv4.nix
+++ b/lib/ipv4.nix
@@ -1,6 +1,7 @@
-lib:
-with builtins;
-with lib; rec {
+lib: let
+ inherit (lib) int2bits toInt splitString flatten bits2int sublist genList zipListsWith;
+ inherit (lib.ipv4) ip2bits bits2ip netmaskBits int2ip ip2int prefix2ip;
+in {
# Converts string representation of IPv4 address to 32 bits
ip2bits = ip: let
perBits = map (x: int2bits 8 (toInt x)) (splitString "." ip);