···
{ config, lib, pkgs, ... }:
4
+
inherit (lib) mkIf mkOption types optionalAttrs;
5
+
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
···
(_: { path, allowAddresses, extraOptions }:
} // (optionalAttrs (allowAddresses != null) {
27
-
authfile = pkgs.writeText "authfile" (concatStringsSep "\n" allowAddresses);
27
+
authfile = pkgs.writeText "authfile" (lib.concatStringsSep "\n" allowAddresses);
···
${lib.generators.toINI {} exportSections}
37
-
(path: hasPrefix "/dev/" path)
38
-
(mapAttrsToList (_: { path, ... }: path) cfg.server.exports);
37
+
(path: lib.hasPrefix "/dev/" path)
38
+
(lib.mapAttrsToList (_: { path, ... }: path) cfg.server.exports);
allowedDevices = splitLists.right;
boundPaths = splitLists.wrong;
···
46
-
enable = mkEnableOption "the Network Block Device (nbd) server";
46
+
enable = lib.mkEnableOption "the Network Block Device (nbd) server";
···
description = "Files or block devices to make available over the network.";
68
-
type = with types; attrsOf
···
listenAddress = mkOption {
100
-
type = with types; nullOr str;
description = "Address to listen on. If not specified, the server will listen on all interfaces.";