tests: mpv: refactor stubs definition

I am about to introduce more tests making use of the stubs, let's
centralize them in one file.
This commit is contained in:
Bruno BELANYI 2026-02-20 12:12:56 +00:00 committed by Austin Horstman
parent c3f348111f
commit ccd5351436
2 changed files with 42 additions and 12 deletions

View file

@ -4,24 +4,14 @@
}:
{
imports = [ ./stubs.nix ];
programs.mpv = {
enable = true;
package = pkgs.emptyDirectory;
scripts = [ pkgs.mpvScript ];
};
test.stubs = {
mpv = {
extraAttrs.override = { ... }: pkgs.emptyDirectory;
};
mpvScript = {
extraAttrs = {
scriptName = "something";
};
};
};
test.asserts.assertions.expected = [
''The programs.mpv "package" option is mutually exclusive with "scripts" option.''
];

View file

@ -0,0 +1,40 @@
{ lib, pkgs, ... }:
{
test.stubs = {
mpv-unwrapped = {
name = "mpv-unwrapped";
outPath = null;
buildScript = ''
mkdir -p $out/bin $out/share/applications
echo "Name=mpv" > $out/share/applications/mpv.desktop
cp ${pkgs.writeShellScript "mpv" "exit 0"} $out/bin/mpv
chmod +x $out/bin/mpv
'';
extraAttrs = {
meta =
let
stub = "stub";
in
{
description = stub;
longDescription = stub;
homepage = stub;
mainProgram = stub;
license = [ stub ];
maintainers = [ stub ];
teams = [ stub ];
platforms = lib.platforms.all;
};
};
};
mpvScript = {
extraAttrs = {
scriptName = "mpvScript";
};
};
};
}