nixpkgs/nixos/tests/ustreamer.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

84 lines
2.3 KiB
Nix

import ./make-test-python.nix (
{ pkgs, ... }:
{
name = "ustreamer-vmtest";
nodes = {
client =
{ ... }:
{
environment.systemPackages = [ pkgs.curl ];
};
camera =
{ config, ... }:
let
configFile = pkgs.writeText "akvcam-configFile" ''
[Cameras]
cameras/size = 2
cameras/1/type = output
cameras/1/mode = mmap, userptr, rw
cameras/1/description = Virtual Camera (output device)
cameras/1/formats = 2
cameras/1/videonr = 7
cameras/2/type = capture
cameras/2/mode = mmap, rw
cameras/2/description = Virtual Camera
cameras/2/formats = 1, 2
cameras/2/videonr = 9
[Connections]
connections/size = 1
connections/1/connection = 1:2
[Formats]
formats/size = 2
formats/1/format = YUY2
formats/1/width = 640
formats/1/height = 480
formats/1/fps = 30
formats/2/format = RGB24, YUY2
formats/2/width = 640
formats/2/height = 480
formats/2/fps = 20/1, 15/2
'';
in
{
environment.systemPackages = [ pkgs.ustreamer ];
networking.firewall.enable = false;
systemd.services.ustreamer = {
description = "ustreamer service";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
DynamicUser = true;
ExecStart = "${pkgs.ustreamer}/bin/ustreamer --host=0.0.0.0 --port 8000 --device /dev/video9 --device-timeout=8";
PrivateTmp = true;
BindReadOnlyPaths = "/dev/video9";
SupplementaryGroups = [
"video"
];
Restart = "always";
};
};
boot.extraModulePackages = [ config.boot.kernelPackages.akvcam ];
boot.kernelModules = [ "akvcam" ];
boot.extraModprobeConfig = ''
options akvcam config_file=${configFile}
'';
};
};
testScript = ''
start_all()
camera.wait_for_unit("ustreamer.service")
camera.wait_for_open_port(8000)
client.wait_for_unit("multi-user.target")
client.succeed("curl http://camera:8000")
'';
}
)