From fc019d789523ce5f89436b8dbc458cf3b79abf43 Mon Sep 17 00:00:00 2001 From: aristote Date: Tue, 29 Jul 2025 15:25:11 +0200 Subject: reformat everything with nixfmt --- modules/nixos/rss-bridge.nix | 91 ++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 41 deletions(-) (limited to 'modules/nixos/rss-bridge.nix') diff --git a/modules/nixos/rss-bridge.nix b/modules/nixos/rss-bridge.nix index 5a938d8..2f90af7 100644 --- a/modules/nixos/rss-bridge.nix +++ b/modules/nixos/rss-bridge.nix @@ -3,58 +3,67 @@ lib, pkgs, ... -}: let +}: +let cfg = config.services.rss-bridge; -in { +in +{ options.services.rss-bridge = { debug = lib.mkEnableOption "debug mode"; extraBridges = lib.mkOption { - type = lib.types.listOf (lib.types.submodule { - options = { - name = lib.mkOption { - type = lib.types.strMatching "[a-zA-Z0-9]*"; - description = '' - The name of the bridge. - It need not include 'Bridge' at the end, unlike required in RSS-Bridge. - ''; - example = "SomeAppWithANewsletter"; - }; - source = lib.mkOption { - type = lib.types.path; - description = '' - The path to a file whose contents is the PHP sourcecode of the bridge. - See also the RSS-Bridge documentation: https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html. - ''; + type = lib.types.listOf ( + lib.types.submodule { + options = { + name = lib.mkOption { + type = lib.types.strMatching "[a-zA-Z0-9]*"; + description = '' + The name of the bridge. + It need not include 'Bridge' at the end, unlike required in RSS-Bridge. + ''; + example = "SomeAppWithANewsletter"; + }; + source = lib.mkOption { + type = lib.types.path; + description = '' + The path to a file whose contents is the PHP sourcecode of the bridge. + See also the RSS-Bridge documentation: https://rss-bridge.github.io/rss-bridge/Bridge_API/index.html. + ''; + }; }; - }; - }); - default = []; + } + ); + default = [ ]; description = '' A list of additional bridges that aren't already included in RSS-Bridge. These bridges are automatically whitelisted''; }; }; - config.services.rss-bridge.config.system.enabled_bridges = - lib.mkIf cfg.enable - (map (bridge: bridge.name) cfg.extraBridges); + config.services.rss-bridge.config.system.enabled_bridges = lib.mkIf cfg.enable ( + map (bridge: bridge.name) cfg.extraBridges + ); config.services.nginx = lib.mkIf (cfg.virtualHost != null) { - virtualHosts.${cfg.virtualHost}.root = - lib.mkIf (cfg.extraBridges != []) - (lib.mkForce (pkgs.runCommand "rss-bridge" {} ('' - mkdir -p $out/bridges - cp -r ${cfg.package}/* $out/ - pushd $out/bridges - '' - + lib.concatStrings (map (bridge: '' - ln -sf ${bridge.source} "${bridge.name}Bridge.php" - '') - cfg.extraBridges) - + '' - popd - '' - + lib.optionalString cfg.debug '' - touch $out/DEBUG - ''))); + virtualHosts.${cfg.virtualHost}.root = lib.mkIf (cfg.extraBridges != [ ]) ( + lib.mkForce ( + pkgs.runCommand "rss-bridge" { } ( + '' + mkdir -p $out/bridges + cp -r ${cfg.package}/* $out/ + pushd $out/bridges + '' + + lib.concatStrings ( + map (bridge: '' + ln -sf ${bridge.source} "${bridge.name}Bridge.php" + '') cfg.extraBridges + ) + + '' + popd + '' + + lib.optionalString cfg.debug '' + touch $out/DEBUG + '' + ) + ) + ); }; } -- cgit v1.2.3