lol

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

authored by misuzu.tngl.sh and committed by

GitHub b4837eea 6964ded4

+10 -10
+10 -10
nixos/modules/services/networking/nbd.nix
··· 1 1 { config, lib, pkgs, ... }: 2 2 3 - with lib; 4 - 5 3 let 4 + inherit (lib) mkIf mkOption types optionalAttrs; 5 + inherit (lib.types) nullOr listOf str attrsOf submodule; 6 6 cfg = config.services.nbd; 7 7 iniFields = with types; attrsOf (oneOf [ bool int float str ]); 8 8 # The `[generic]` section must come before all the others in the ··· 19 19 })); 20 20 }; 21 21 exportSections = 22 - mapAttrs 22 + lib.mapAttrs 23 23 (_: { path, allowAddresses, extraOptions }: 24 24 extraOptions // { 25 25 exportname = path; 26 26 } // (optionalAttrs (allowAddresses != null) { 27 - authfile = pkgs.writeText "authfile" (concatStringsSep "\n" allowAddresses); 27 + authfile = pkgs.writeText "authfile" (lib.concatStringsSep "\n" allowAddresses); 28 28 })) 29 29 cfg.server.exports; 30 30 serverConfig = ··· 33 33 ${lib.generators.toINI {} exportSections} 34 34 ''; 35 35 splitLists = 36 - partition 37 - (path: hasPrefix "/dev/" path) 38 - (mapAttrsToList (_: { path, ... }: path) cfg.server.exports); 36 + lib.partition 37 + (path: lib.hasPrefix "/dev/" path) 38 + (lib.mapAttrsToList (_: { path, ... }: path) cfg.server.exports); 39 39 allowedDevices = splitLists.right; 40 40 boundPaths = splitLists.wrong; 41 41 in ··· 43 43 options = { 44 44 services.nbd = { 45 45 server = { 46 - enable = mkEnableOption "the Network Block Device (nbd) server"; 46 + enable = lib.mkEnableOption "the Network Block Device (nbd) server"; 47 47 48 48 listenPort = mkOption { 49 49 type = types.port; ··· 65 65 exports = mkOption { 66 66 description = "Files or block devices to make available over the network."; 67 67 default = { }; 68 - type = with types; attrsOf 68 + type = attrsOf 69 69 (submodule { 70 70 options = { 71 71 path = mkOption { ··· 97 97 }; 98 98 99 99 listenAddress = mkOption { 100 - type = with types; nullOr str; 100 + type = nullOr str; 101 101 description = "Address to listen on. If not specified, the server will listen on all interfaces."; 102 102 default = null; 103 103 example = "10.10.0.1";