reformat with treefmt

This commit is contained in:
Jörg Thalheim 2024-08-18 18:03:11 +02:00
parent b208b7169c
commit ac08d34e1d
6 changed files with 48 additions and 32 deletions

View File

@ -1,6 +1,17 @@
{ python311, makeWrapper, nix-eval-jobs, nix-output-monitor, lib, bashInteractive }:
{
python311,
makeWrapper,
nix-eval-jobs,
nix-output-monitor,
lib,
bashInteractive,
}:
let
path = lib.makeBinPath [ nix-eval-jobs nix-eval-jobs.nix nix-output-monitor ];
path = lib.makeBinPath [
nix-eval-jobs
nix-eval-jobs.nix
nix-output-monitor
];
in
python311.pkgs.buildPythonApplication {
pname = "nix-fast-build";

View File

@ -10,8 +10,10 @@
treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } ({ lib, ... }:
outputs =
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } (
{ lib, ... }:
let
officialPlatforms = [
"aarch64-linux"
@ -24,28 +26,28 @@
{
imports = [ ./treefmt.nix ];
systems = officialPlatforms ++ [ "riscv64-linux" ];
perSystem = { pkgs, self', ... }: {
packages.nix-fast-build = pkgs.callPackage ./default.nix {
# we don't want to compile ghc otherwise
nix-output-monitor =
if lib.elem pkgs.hostPlatform.system officialPlatforms then
pkgs.nix-output-monitor
else
null;
};
legacyPackages = {
hello-broken = pkgs.hello.overrideAttrs (_old: {
meta.broken = true;
});
};
packages.default = self'.packages.nix-fast-build;
perSystem =
{ pkgs, self', ... }:
{
packages.nix-fast-build = pkgs.callPackage ./default.nix {
# we don't want to compile ghc otherwise
nix-output-monitor =
if lib.elem pkgs.hostPlatform.system officialPlatforms then pkgs.nix-output-monitor else null;
};
legacyPackages = {
hello-broken = pkgs.hello.overrideAttrs (_old: {
meta.broken = true;
});
};
packages.default = self'.packages.nix-fast-build;
checks =
let
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
in
packages // devShells;
};
});
checks =
let
packages = lib.mapAttrs' (n: lib.nameValuePair "package-${n}") self'.packages;
devShells = lib.mapAttrs' (n: lib.nameValuePair "devShell-${n}") self'.devShells;
in
packages // devShells;
};
}
);
}

View File

@ -387,7 +387,10 @@ def nix_shell(fallback_package: str, wanted_command: str) -> list[str]:
@asynccontextmanager
async def ensure_stop(
proc: Process, cmd: list[str], timeout: float = 3.0, signal_no: int = signal.SIGTERM
proc: Process,
cmd: list[str],
wait_timeout: float = 3.0,
signal_no: int = signal.SIGTERM,
) -> AsyncIterator[Process]:
try:
yield proc
@ -396,7 +399,7 @@ async def ensure_stop(
with contextlib.suppress(ProcessLookupError):
proc.send_signal(signal_no)
try:
await asyncio.wait_for(proc.wait(), timeout=timeout)
await asyncio.wait_for(proc.wait(), timeout=wait_timeout)
except TimeoutError:
print(f"Failed to stop process {shlex.join(cmd)}. Killing it.")
proc.kill()

View File

@ -48,7 +48,7 @@ class Command:
os.killpg(os.getpgid(p.pid), signal.SIGKILL)
@pytest.fixture()
@pytest.fixture
def command() -> Iterator[Command]:
"""
Starts a background command. The process is automatically terminated in the end.

View File

@ -37,6 +37,6 @@ class Ports:
raise OSError(msg)
@pytest.fixture()
@pytest.fixture
def ports() -> Ports:
return Ports()

View File

@ -76,7 +76,7 @@ def sshd_config(project_root: Path, test_root: Path) -> Iterator[SshdConfig]:
yield SshdConfig(str(sshd_config), str(host_key), lib_path)
@pytest.fixture()
@pytest.fixture
def sshd(sshd_config: SshdConfig, command: Command, ports: Ports) -> Iterator[Sshd]:
port = ports.allocate(1)
sshd = shutil.which("sshd")