diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 3e29907f3c5a..7728234f11bc 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -404,6 +404,7 @@ in { gollum = handleTest ./gollum.nix {}; gonic = handleTest ./gonic.nix {}; google-oslogin = handleTest ./google-oslogin {}; + gopro-tool = handleTest ./gopro-tool.nix {}; goss = handleTest ./goss.nix {}; gotenberg = handleTest ./gotenberg.nix {}; gotify-server = handleTest ./gotify-server.nix {}; diff --git a/nixos/tests/gopro-tool.nix b/nixos/tests/gopro-tool.nix new file mode 100644 index 000000000000..1f183e4c30d5 --- /dev/null +++ b/nixos/tests/gopro-tool.nix @@ -0,0 +1,41 @@ +import ./make-test-python.nix ( + { lib, pkgs, ... }: + + let + testScript = '' + start_all() + + machine.wait_for_unit("multi-user.target") + + # Check that gopro-tool is installed + machine.succeed("which gopro-tool") + + # Check that the v4l2loopback module is available + machine.succeed("lsmod | grep v4l2loopback || echo 'Module not found'") + + # Check that VLC is installed + machine.succeed("which vlc") + ''; + in + { + name = "gopro-tool"; + meta.maintainers = with lib.maintainers; [ ZMon3y ]; + nodes.machine = + { config, pkgs, ... }: + { + # Ensure dependencies are installed + environment.systemPackages = with pkgs; [ + gopro-tool + vlc + ]; + + # Load kernel module for testing + boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; + + # Enable module loading + boot.kernelModules = [ "v4l2loopback" ]; + }; + + testScript = testScript; + } +) diff --git a/pkgs/by-name/go/gopro-tool/package.nix b/pkgs/by-name/go/gopro-tool/package.nix new file mode 100644 index 000000000000..e282bb0f9e07 --- /dev/null +++ b/pkgs/by-name/go/gopro-tool/package.nix @@ -0,0 +1,45 @@ +{ + lib, + stdenv, + fetchFromGitHub, + makeWrapper, + ffmpeg, + vlc, + jq, +}: + +stdenv.mkDerivation { + pname = "gopro-tool"; + version = "0-unstable-2024-04-18"; + + src = fetchFromGitHub { + owner = "juchem"; + repo = "gopro-tool"; + rev = "a678f0ea65e24dca9b8d848b245bd2d487d3c8ca"; + sha256 = "0sh3s38m17pci24x4kdlmlhn0gwgm28aaa6p7qs16wysk0q0h6wz"; + }; + + nativeBuildInputs = [ makeWrapper ]; + + installPhase = '' + mkdir -p $out/bin + cp $src/gopro-tool $out/bin/gopro-tool + chmod +x $out/bin/gopro-tool + + wrapProgram $out/bin/gopro-tool \ + --prefix PATH : ${ + lib.makeBinPath [ + ffmpeg + vlc + jq + ] + } + ''; + + meta = { + description = "A tool to control GoPro webcam mode in Linux (requires v4l2loopback kernel module and a firewall rule)"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ ZMon3y ]; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fb3618d837a1..866d351cc9f1 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6222,6 +6222,11 @@ with pkgs; dotnetPackages = recurseIntoAttrs (callPackage ./dotnet-packages.nix {}); + gopro-tool = callPackage ../by-name/go/gopro-tool/package.nix { + vlc = + vlc.overrideAttrs (old: { buildInputs = old.buildInputs ++ [ x264 ]; }); + }; + gwe = callPackage ../tools/misc/gwe { nvidia_x11 = linuxPackages.nvidia_x11; };