From 57fa81efce06f607aaa0c234714b9ba080eaf49e Mon Sep 17 00:00:00 2001 From: Felix Buehler Date: Sun, 29 Dec 2024 21:50:36 +0100 Subject: [PATCH] nixos/services.endlessh: remove `with lib;` --- nixos/modules/services/security/endlessh.nix | 23 +++++++++----------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/nixos/modules/services/security/endlessh.nix b/nixos/modules/services/security/endlessh.nix index 479e27d18ccd..cac6de5c3cf3 100644 --- a/nixos/modules/services/security/endlessh.nix +++ b/nixos/modules/services/security/endlessh.nix @@ -4,18 +4,15 @@ pkgs, ... }: - -with lib; - let cfg = config.services.endlessh; in { options.services.endlessh = { - enable = mkEnableOption "endlessh service"; + enable = lib.mkEnableOption "endlessh service"; - port = mkOption { - type = types.port; + port = lib.mkOption { + type = lib.types.port; default = 2222; example = 22; description = '' @@ -26,8 +23,8 @@ in ''; }; - extraOptions = mkOption { - type = with types; listOf str; + extraOptions = lib.mkOption { + type = with lib.types; listOf str; default = [ ]; example = [ "-6" @@ -39,8 +36,8 @@ in ''; }; - openFirewall = mkOption { - type = types.bool; + openFirewall = lib.mkOption { + type = lib.types.bool; default = false; description = '' Whether to open a firewall port for the SSH listener. @@ -48,7 +45,7 @@ in }; }; - config = mkIf cfg.enable { + config = lib.mkIf cfg.enable { systemd.services.endlessh = { description = "SSH tarpit"; requires = [ "network.target" ]; @@ -56,7 +53,7 @@ in serviceConfig = let needsPrivileges = cfg.port < 1024; - capabilities = [ "" ] ++ optionals needsPrivileges [ "CAP_NET_BIND_SERVICE" ]; + capabilities = [ "" ] ++ lib.optionals needsPrivileges [ "CAP_NET_BIND_SERVICE" ]; rootDirectory = "/run/endlessh"; in { @@ -115,5 +112,5 @@ in networking.firewall.allowedTCPPorts = with cfg; optionals openFirewall [ port ]; }; - meta.maintainers = with maintainers; [ azahi ]; + meta.maintainers = with lib.maintainers; [ azahi ]; }