lib: _: rec { my = import ./my.nix lib; dns = import ./dns.nix; isEven = number: assert (builtins.isInt number) || (builtins.isFloat number); builtins.div number 2 == 0; isOdd = !isEven; pow = base: exponent: assert (builtins.isInt base) && (builtins.isInt exponent); assert exponent > 0; builtins.foldl' (x: _: x * base) 1 (builtins.genList (_: _) exponent); mapListToAttrs = f: attrs: builtins.listToAttrs (map (name: { name = if builtins.isList name then builtins.elemAt name (builtins.length name - 1) else name; value = f name; }) attrs); mkTcpMem = min: ini: max: assert min <= ini && ini <= max; lib.concatMapStrings (x: toString x + " ") (map (pow 2) [min ini max]); moduleFromRef = module: ref: sha256: { disabledModules = [module]; imports = [ (let src = builtins.fetchTarball { url = let cons = lib.splitString ":" ref; owner = lib.head cons; branch = lib.last cons; in "https://github.com/${owner}/nixpkgs/archive/refs/heads/${branch}.tar.gz"; inherit sha256; }; in "${src}/nixos/modules/${module}") ]; }; }