overlays/nginx-test: drop

This commit is contained in:
Daniel Lovbrotte Olsen 2024-05-13 07:04:00 +02:00
parent a57b5f07f9
commit c267820426
2 changed files with 1 additions and 35 deletions

View File

@ -65,9 +65,7 @@
pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./overlays/nginx-test.nix
(builtins.attrNames self.nixosConfigurations.${name}.config.security.acme.certs)
)
# Global overlays go here
] ++ config.overlays or [ ];
};
}

View File

@ -1,32 +0,0 @@
acme-certs: final: prev:
let
problematicHosts = [ "matrix.pvv.ntnu.no" "tom.pvv.ntnu.no" ];
lib = final.lib;
crt = "${final.path}/nixos/tests/common/acme/server/acme.test.cert.pem";
key = "${final.path}/nixos/tests/common/acme/server/acme.test.key.pem";
in {
writers = prev.writers // {
writeNginxConfig = name: text: final.runCommandLocal name {
nginxConfig = prev.writers.writeNginxConfig name text;
nativeBuildInputs = [ final.bubblewrap ];
} ''
cat "$nginxConfig" > "$out"
substituteInPlace "$out" ${lib.concatMapStrings (host: "--replace ${host} \"localhost\" ") problematicHosts}
substituteInPlace "$out" --replace ":443" ":4443"
substituteInPlace "$out" --replace ":80" ":8808"
set +o pipefail
bwrap \
--ro-bind "${crt}" "/etc/certs/nginx.crt" \
--ro-bind "${key}" "/etc/certs/nginx.key" \
--ro-bind "/nix" "/nix" \
--ro-bind "/etc/hosts" "/etc/hosts" \
--dir "/run/nginx" \
--dir "/tmp" \
--dir "/var/log/nginx" \
${lib.concatMapStrings (name: "--ro-bind \"${crt}\" \"/var/lib/acme/${name}/fullchain.pem\" \\") acme-certs}
${lib.concatMapStrings (name: "--ro-bind \"${key}\" \"/var/lib/acme/${name}/key.pem\" \\") acme-certs}
${lib.concatMapStrings (name: "--ro-bind \"${crt}\" \"/var/lib/acme/${name}/chain.pem\" \\") acme-certs}
${lib.getExe' final.nginx "nginx"} -t -c "$out" |& grep "syntax is ok"
'';
};
}