mpv: add 'extraMakeWrapperArgs'
This commit is contained in:
parent
14e98b1d96
commit
dcfc84871c
4 changed files with 51 additions and 3 deletions
|
|
@ -64,10 +64,14 @@ let
|
|||
|
||||
wrapperRequiresOverride = lib.any (v: v != [ ]) [
|
||||
cfg.scripts
|
||||
cfg.extraMakeWrapperArgs
|
||||
];
|
||||
|
||||
mpvPackage =
|
||||
if wrapperRequiresOverride then pkgs.mpv.override { inherit (cfg) scripts; } else cfg.package;
|
||||
if wrapperRequiresOverride then
|
||||
pkgs.mpv.override { inherit (cfg) scripts extraMakeWrapperArgs; }
|
||||
else
|
||||
cfg.package;
|
||||
|
||||
in
|
||||
{
|
||||
|
|
@ -101,6 +105,22 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
extraMakeWrapperArgs = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
example = literalExpression ''
|
||||
[
|
||||
"--prefix"
|
||||
"LD_LIBRARY_PATH"
|
||||
":"
|
||||
(lib.makeLibraryPath [ pkgs.libaacs pkgs.libbluray ])
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
List of scripts to use with mpv.
|
||||
'';
|
||||
};
|
||||
|
||||
scriptOpts = mkOption {
|
||||
description = ''
|
||||
Script options added to
|
||||
|
|
@ -224,7 +244,7 @@ in
|
|||
assertions = [
|
||||
{
|
||||
assertion = wrapperRequiresOverride -> (cfg.package == options.programs.mpv.package.default);
|
||||
message = ''The programs.mpv "package" option is mutually exclusive with "scripts" option.'';
|
||||
message = ''The programs.mpv "package" option is mutually exclusive with "scripts", "extraMakeWrapperArgs" options.'';
|
||||
}
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@
|
|||
mpv-example-settings = ./mpv-example-settings.nix;
|
||||
mpv-invalid-settings = ./mpv-invalid-settings.nix;
|
||||
mpv-scripts = ./mpv-scripts.nix;
|
||||
mpv-extra-wrapper-args = ./mpv-extra-wrapper-args.nix;
|
||||
}
|
||||
|
|
|
|||
27
tests/modules/programs/mpv/mpv-extra-wrapper-args.nix
Normal file
27
tests/modules/programs/mpv/mpv-extra-wrapper-args.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [ ./stubs.nix ];
|
||||
|
||||
programs.mpv = {
|
||||
enable = true;
|
||||
extraMakeWrapperArgs = [
|
||||
"--prefix"
|
||||
"LD_LIBRARY_PATH"
|
||||
":"
|
||||
(lib.makeLibraryPath [
|
||||
pkgs.libaacs
|
||||
pkgs.libbluray
|
||||
])
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
mpvbin="home-path/bin/mpv"
|
||||
assertFileRegex "$mpvbin" 'LD_LIBRARY_PATH'
|
||||
'';
|
||||
}
|
||||
|
|
@ -13,6 +13,6 @@
|
|||
};
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''The programs.mpv "package" option is mutually exclusive with "scripts" option.''
|
||||
''The programs.mpv "package" option is mutually exclusive with "scripts", "extraMakeWrapperArgs" options.''
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue