nixos/nbd: remove `with lib;` (#343506)

Changed files
+10 -10
nixos
modules
services
networking
+10 -10
nixos/modules/services/networking/nbd.nix
···
{ config, lib, pkgs, ... }:
-
with lib;
-
let
+
inherit (lib) mkIf mkOption types optionalAttrs;
+
inherit (lib.types) nullOr listOf str attrsOf submodule;
cfg = config.services.nbd;
iniFields = with types; attrsOf (oneOf [ bool int float str ]);
# The `[generic]` section must come before all the others in the
···
}));
};
exportSections =
-
mapAttrs
+
lib.mapAttrs
(_: { path, allowAddresses, extraOptions }:
extraOptions // {
exportname = path;
} // (optionalAttrs (allowAddresses != null) {
-
authfile = pkgs.writeText "authfile" (concatStringsSep "\n" allowAddresses);
+
authfile = pkgs.writeText "authfile" (lib.concatStringsSep "\n" allowAddresses);
}))
cfg.server.exports;
serverConfig =
···
${lib.generators.toINI {} exportSections}
'';
splitLists =
-
partition
-
(path: hasPrefix "/dev/" path)
-
(mapAttrsToList (_: { path, ... }: path) cfg.server.exports);
+
lib.partition
+
(path: lib.hasPrefix "/dev/" path)
+
(lib.mapAttrsToList (_: { path, ... }: path) cfg.server.exports);
allowedDevices = splitLists.right;
boundPaths = splitLists.wrong;
in
···
options = {
services.nbd = {
server = {
-
enable = mkEnableOption "the Network Block Device (nbd) server";
+
enable = lib.mkEnableOption "the Network Block Device (nbd) server";
listenPort = mkOption {
type = types.port;
···
exports = mkOption {
description = "Files or block devices to make available over the network.";
default = { };
-
type = with types; attrsOf
+
type = attrsOf
(submodule {
options = {
path = mkOption {
···
};
listenAddress = mkOption {
-
type = with types; nullOr str;
+
type = nullOr str;
description = "Address to listen on. If not specified, the server will listen on all interfaces.";
default = null;
example = "10.10.0.1";