nix-config/lib/default.nix

24 lines
555 B
Nix
Raw Normal View History

2024-07-29 22:02:40 +02:00
{lib}: let
net = import ./net.nix {inherit lib;};
2024-07-29 22:02:40 +02:00
in {
dirToStrings = dir: (map (v: builtins.readFile "${dir}/${v}")
(builtins.filter (v:
(builtins.readFileType "${dir}/${v}") == "regular") (
if (builtins.pathExists dir && (builtins.readFileType dir) == "directory")
then
builtins.attrNames (
builtins.readDir dir
)
else []
)));
2024-07-29 22:02:40 +02:00
calcSystemdDhcpPoolOffset = {
base,
start,
end,
}: {
offset = net.lib.net.ip.diff start base;
size = net.lib.net.ip.diff end start;
};
}