To make mpv handle jxls properly, I used this:
environment.systemPackages = [
(pkgs.mpv.override { mpv-unwrapped = pkgs.mpv-unwrapped.override { ffmpeg = pkgs.ffmpeg-full; }; })
];
And it works perfectly, I’m able to for example take screenshots in jxl.
However, when I wanted to add this to my custom module for mpv, like so:
config = lib.mkIf cfg.enable {
environment.systemPackages = [
(cfg.package.override {
extraMakeWrapperArgs = [
"--add-flags"
"--config-dir=${
pkgs.symlinkJoin {
inherit name;
paths = [
(pkgs.writeTextDir "${name}.conf" cfg.extraConfig)
(pkgs.writeTextDir "input.conf" cfg.extraInputConf)
];
}
}"
];
mpv-unwrapped = lib.mkIf cfg.useFullFFmpeg (
pkgs.mpv-unwrapped.override {
ffmpeg = pkgs.ffmpeg-full;
}
);
})
];
};
It causes an evaluation error:
error:
… while evaluating an expression to select 'drvPath' on it
at «internal»:1:552:
… while evaluating strict
at «internal»:1:552:
(stack trace truncated; use '--show-trace' to show the full trace)
error: attribute 'meta' missing
at /nix/store/dx2qikyb4dyb6hbdfywbmsyla0z5a1h3-source/pkgs/by-name/mp/mpv/package.nix:146:28:
145| meta = {
146| inherit (mpv-unwrapped.meta)
| ^
147| homepage
note: trace involved the following derivations:
derivation 'nixos-system-7730U-26.05.20260217.0182a36'
derivation 'etc'
derivation 'dbus-1'
derivation 'system-path'
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '/etc/nixos#nixosConfigurations."7730U".config.system.build.toplevel' --no-link --log-format multiline-with-logs' returned non-zero exit status 1.
From my understanding of how override works, my code should not be affecting the meta attribute of mpv-unwrapped; and it should be almost entirely identical in effect to the first snippet, which did work.
What’s going on here?