From 54c6d3166c4c0f9464fbfd317eb03d164978277c Mon Sep 17 00:00:00 2001 From: Karel Kočí Date: Mon, 1 Dec 2025 11:22:23 +0100 Subject: lib: remove with usage --- flake.lock | 12 ++++++------ lib/default.nix | 5 +++-- lib/ipv4.nix | 7 ++++--- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/flake.lock b/flake.lock index bdd07f7..ecc947a 100644 --- a/flake.lock +++ b/flake.lock @@ -193,11 +193,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1764080039, - "narHash": "sha256-b1MtLQsQc4Ji1u08f+C6g5XrmLPkJQ1fhNkCt+0AERQ=", + "lastModified": 1764440730, + "narHash": "sha256-ZlJTNLUKQRANlLDomuRWLBCH5792x+6XUJ4YdFRjtO4=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "da17006633ca9cda369be82893ae36824a2ddf1a", + "rev": "9154f4569b6cdfd3c595851a6ba51bfaa472d9f3", "type": "github" }, "original": { @@ -326,11 +326,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1763966396, - "narHash": "sha256-6eeL1YPcY1MV3DDStIDIdy/zZCDKgHdkCmsrLJFiZf0=", + "lastModified": 1764517877, + "narHash": "sha256-pp3uT4hHijIC8JUK5MEqeAWmParJrgBVzHLNfJDZxg4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5ae3b07d8d6527c42f17c876e404993199144b6a", + "rev": "2d293cbfa5a793b4c50d17c05ef9e385b90edf6c", "type": "github" }, "original": { 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); -- cgit v1.3