{ config, pkgs, lib, flake, flakeInputs, ... }: with lib; let dovecotSievePipeBin = pkgs.stdenv.mkDerivation { name = "dovecot-sieve-pipe-bin"; src = ./dovecot-pipe-bin; buildInputs = with pkgs; [ makeWrapper coreutils bash rspamd ]; buildCommand = '' mkdir -p $out/pipe/bin cp $src/* $out/pipe/bin/ chmod a+x $out/pipe/bin/* patchShebangs $out/pipe/bin for file in $out/pipe/bin/*; do wrapProgram $file \ --set PATH "${makeBinPath (with pkgs; [coreutils rspamd])}" done ''; }; ccert-policy-server = with pkgs.poetry2nix; mkPoetryApplication { python = pkgs.python311; projectDir = cleanPythonSources { src = ./ccert-policy-server; }; overrides = overrides.withDefaults (self: super: { systemd-python = super.systemd-python.overridePythonAttrs (oldAttrs: { buildInputs = (oldAttrs.buildInputs or []) ++ [ super.setuptools ]; }); }); }; internal-policy-server = let workspace = flakeInputs.uv2nix.lib.workspace.loadWorkspace { workspaceRoot = ./internal-policy-server; }; pythonSet = flake.lib.pythonSet { inherit pkgs; python = pkgs.python312; overlay = workspace.mkPyprojectOverlay { sourcePreference = "wheel"; }; }; virtualEnv = pythonSet.mkVirtualEnv "internal-policy-server-env" workspace.deps.default; in virtualEnv.overrideAttrs (oldAttrs: { meta = (oldAttrs.meta or {}) // { mainProgram = "internal-policy-server"; }; }); nftables-nologin-script = pkgs.resholve.writeScript "nftables-mail-nologin" { inputs = with pkgs; [inetutils nftables gnugrep findutils]; interpreter = lib.getExe pkgs.zsh; } '' set -e typeset -a as_sets mnt_bys route route6 as_sets=(${lib.escapeShellArgs config.services.email.nologin.ASSets}) mnt_bys=(${lib.escapeShellArgs config.services.email.nologin.MNTBys}) for as_set in $as_sets; do while IFS=$'\n' read line; do if [[ "''${line}" =~ "^route:\s+(.+)$" ]]; then route+=($match[1]) elif [[ "''${line}" =~ "^route6:\s+(.+)$" ]]; then route6+=($match[1]) fi done < <(whois -h whois.radb.net "!i''${as_set},1" | grep -Eo 'AS[0-9]+' | xargs whois -h whois.radb.net -- -i origin) done for mnt_by in $mnt_bys; do while IFS=$'\n' read line; do if [[ "''${line}" =~ "^route:\s+(.+)$" ]]; then route+=($match[1]) elif [[ "''${line}" =~ "^route6:\s+(.+)$" ]]; then route6+=($match[1]) fi done < <(whois -h whois.radb.net "!o''${mnt_by}") done printf -v elements4 '%s,' "''${route[@]}" elements4=''${elements4%,} printf -v elements6 '%s,' "''${route6[@]}" elements6=''${elements6%,} nft -f - <