{ pkgs, extraModules, vhack, ... }: vhack.runTest { name = "sharkey-cpu"; nodes = { server = {config, ...}: { imports = extraModules ++ [ ../../../../modules ]; vhack = { persist.enable = true; nginx.enable = true; sharkey = { enable = true; fqdn = "sharkey.server"; }; }; systemd.services = { # Avoid an error from this service. "acme-sharkey.server".enable = false; # Test that sharkey's hardening still allows access to the CPUs. sharkey.serviceConfig.ExecStart = let nodejs = pkgs.lib.getExe pkgs.nodejs; script = pkgs.writeTextFile { name = "script.js"; text = # js '' import * as os from 'node:os'; var cpus = os.cpus() if (cpus.length != 0) { console.log(cpus[0].model) } else { // Fail? } while (true) { } ''; }; in pkgs.lib.mkForce "${nodejs} ${script}"; }; }; }; services = [ {server = "sharkey.service";} ]; testScript = {...}: # Python '' from time import sleep # Give the service time to run. sleep(3) ''; }