From 2f62713d6a397a91fc03454af70b6d3193053976 Mon Sep 17 00:00:00 2001 From: Sense T <2174238+senseab@users.noreply.github.com> Date: Fri, 3 Jan 2025 01:18:15 +0000 Subject: [PATCH] reformat crproxy.nix with new rfc style --- nixos/modules/services/networking/crproxy.nix | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/nixos/modules/services/networking/crproxy.nix b/nixos/modules/services/networking/crproxy.nix index e6f808eeb3a8e2..2a0d8aebb2e41f 100644 --- a/nixos/modules/services/networking/crproxy.nix +++ b/nixos/modules/services/networking/crproxy.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.services.crproxy; @@ -13,9 +18,18 @@ let }; useBlockIPList = (lib.length cfg.blockIPList) != 0; inherit (lib) - mkIf mkEnableOption mkOption types concatStringsSep concatLists optionals - literalExpression mkPackageOption; -in { + mkIf + mkEnableOption + mkOption + types + concatStringsSep + concatLists + optionals + literalExpression + mkPackageOption + ; +in +{ options.services.crproxy = { enable = mkEnableOption "CRProxy, a generic Docker image proxy"; @@ -36,8 +50,7 @@ in { true ''; type = types.bool; - description = - "Behind the reverse proxy such as nginx or caddy, which can receive HTTP headers from fronted nginx or caddy. Enable it when enable nginx or caddy as a reverse proxy server."; + description = "Behind the reverse proxy such as nginx or caddy, which can receive HTTP headers from fronted nginx or caddy. Enable it when enable nginx or caddy as a reverse proxy server."; }; userpass = mkOption { @@ -97,15 +110,13 @@ in { example = literalExpression '' [ "user1:password" "user2:password" ] ''; - description = - "Users which may access the crproxy. An empty list disables simple authentication."; + description = "Users which may access the crproxy. An empty list disables simple authentication."; }; privilegedIPList = mkOption { default = [ ]; type = types.listOf types.str; - description = - "Privileged IP list, which can access the crproxy without limits."; + description = "Privileged IP list, which can access the crproxy without limits."; }; extraOptions = mkOption { @@ -136,12 +147,9 @@ in { "--address=${cfg.listenAddress}" ] (optionals cfg.behindProxy [ "--behind" ]) - (optionals useAllowImageList - [ "--allow-image-list-from-file=${allowImageListFile}" ]) - (optionals useAllowImageList - [ "--block-message=${cfg.blockMessage}" ]) - (optionals useBlockIPList - [ "--block-ip-list-from-file=${blockIPListFile}" ]) + (optionals useAllowImageList [ "--allow-image-list-from-file=${allowImageListFile}" ]) + (optionals useAllowImageList [ "--block-message=${cfg.blockMessage}" ]) + (optionals useBlockIPList [ "--block-ip-list-from-file=${blockIPListFile}" ]) (optionals (cfg.simpleAuthUser != [ ]) [ "--simple-auth" ]) (map (e: "--simple-auth-user=${e}") cfg.simpleAuthUser) (map (e: "--allow-host-list=${e}") cfg.allowHostList)