mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
mpv: add scriptOpts option, fix tests (#3491)
This commit is contained in:
parent
a8f5ca239f
commit
e386ec640e
6 changed files with 53 additions and 18 deletions
4
.github/CODEOWNERS
vendored
4
.github/CODEOWNERS
vendored
|
@ -203,8 +203,8 @@ Makefile @thiagokokada
|
|||
/modules/programs/micro.nix @MForster
|
||||
/tests/modules/programs/micro @MForster
|
||||
|
||||
/modules/programs/mpv.nix @tadeokondrak @thiagokokada
|
||||
/tests/modules/programs/mpv @thiagokokada
|
||||
/modules/programs/mpv.nix @tadeokondrak @thiagokokada @chuangzhu
|
||||
/tests/modules/programs/mpv @thiagokokada @chuangzhu
|
||||
|
||||
/modules/programs/mu.nix @KarlJoad
|
||||
|
||||
|
|
|
@ -34,6 +34,12 @@ let
|
|||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
|
||||
renderScriptOptions = generators.toKeyValue {
|
||||
mkKeyValue =
|
||||
generators.mkKeyValueDefault { mkValueString = renderOption; } "=";
|
||||
listsAsDuplicateKeys = true;
|
||||
};
|
||||
|
||||
renderProfiles = generators.toINI {
|
||||
mkKeyValue =
|
||||
generators.mkKeyValueDefault { mkValueString = renderOptionValue; } "=";
|
||||
|
@ -85,6 +91,27 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
scriptOpts = mkOption {
|
||||
description = ''
|
||||
Script options added to
|
||||
<filename>$XDG_CONFIG_HOME/mpv/script-opts/</filename>. See
|
||||
<citerefentry>
|
||||
<refentrytitle>mpv</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
</citerefentry>
|
||||
for the full list of options of builtin scripts.
|
||||
'';
|
||||
type = types.attrsOf mpvOptions;
|
||||
default = { };
|
||||
example = {
|
||||
osc = {
|
||||
scalewindowed = 2.0;
|
||||
vidscale = false;
|
||||
visibility = "always";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkOption {
|
||||
description = ''
|
||||
Configuration written to
|
||||
|
@ -184,7 +211,13 @@ in {
|
|||
(mkIf (cfg.bindings != { }) {
|
||||
xdg.configFile."mpv/input.conf".text = renderBindings cfg.bindings;
|
||||
})
|
||||
{
|
||||
xdg.configFile = mapAttrs' (name: value:
|
||||
nameValuePair "mpv/script-opts/${name}.conf" {
|
||||
text = renderScriptOptions value;
|
||||
}) cfg.scriptOpts;
|
||||
}
|
||||
]);
|
||||
|
||||
meta.maintainers = with maintainers; [ tadeokondrak thiagokokada ];
|
||||
meta.maintainers = with maintainers; [ tadeokondrak thiagokokada chuangzhu ];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
# Temporarily commented until fixed for recent changes in Nixpkgs.
|
||||
# mpv-example-settings = ./mpv-example-settings.nix;
|
||||
# mpv-invalid-settings = ./mpv-invalid-settings.nix;
|
||||
mpv-example-settings = ./mpv-example-settings.nix;
|
||||
mpv-invalid-settings = ./mpv-invalid-settings.nix;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
scalewindowed=2.000000
|
||||
vidscale=no
|
||||
visibility=always
|
|
@ -18,6 +18,14 @@
|
|||
cache-default = 4000000;
|
||||
};
|
||||
|
||||
scriptOpts = {
|
||||
osc = {
|
||||
scalewindowed = 2.0;
|
||||
vidscale = false;
|
||||
visibility = "always";
|
||||
};
|
||||
};
|
||||
|
||||
profiles = {
|
||||
fast = { vo = "vdpau"; };
|
||||
"protocol.dvd" = {
|
||||
|
@ -38,6 +46,9 @@
|
|||
assertFileContent \
|
||||
home-files/.config/mpv/input.conf \
|
||||
${./mpv-example-settings-expected-bindings}
|
||||
assertFileContent \
|
||||
home-files/.config/mpv/script-opts/osc.conf \
|
||||
${./mpv-example-settings-expected-osc-opts}
|
||||
'';
|
||||
};
|
||||
|
||||
|
|
|
@ -10,24 +10,12 @@
|
|||
|
||||
nixpkgs.overlays = [
|
||||
(self: super: {
|
||||
mpv-unwrapped = pkgs.runCommandLocal "mpv" {
|
||||
version = "0";
|
||||
passthru = {
|
||||
lua.luaversion = "0";
|
||||
luaEnv = "/dummy";
|
||||
vapoursynthSupport = false;
|
||||
};
|
||||
} ''
|
||||
mkdir -p $out/bin $out/Applications/mpv.app/Contents/MacOS
|
||||
touch $out/bin/{,u}mpv $out/Applications/mpv.app/Contents/MacOS/mpv
|
||||
chmod 755 $out/bin/{,u}mpv $out/Applications/mpv.app/Contents/MacOS/mpv
|
||||
'';
|
||||
mpvDummy = config.lib.test.mkStubPackage { };
|
||||
mpvScript =
|
||||
pkgs.runCommandLocal "mpvScript" { scriptName = "something"; }
|
||||
"mkdir $out";
|
||||
})
|
||||
];
|
||||
test.stubs.mpvDummy = { };
|
||||
|
||||
test.asserts.assertions.expected = [
|
||||
''
|
||||
|
|
Loading…
Reference in a new issue