mpv: make wrapped package available via package

This commit is contained in:
Olmo Kramer 2020-08-29 00:08:01 +02:00 committed by Robert Helgesson
parent da6077a899
commit 9ff2188c5d
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -39,11 +39,24 @@ let
concatStringsSep "\n"
(mapAttrsToList (name: value: "${name} ${value}") bindings);
mpvPackage = if cfg.scripts == [ ] then
pkgs.mpv
else
pkgs.wrapMpv pkgs.mpv-unwrapped { scripts = cfg.scripts; };
in {
options = {
programs.mpv = {
enable = mkEnableOption "mpv";
package = mkOption {
type = types.package;
readOnly = true;
description = ''
Resulting mpv package.
'';
};
scripts = mkOption {
type = with types; listOf (either package str);
default = [ ];
@ -121,12 +134,8 @@ in {
config = mkIf cfg.enable (mkMerge [
{
home.packages = [
(if cfg.scripts == [ ] then
pkgs.mpv
else
pkgs.wrapMpv pkgs.mpv-unwrapped { scripts = cfg.scripts; })
];
home.packages = [ mpvPackage ];
programs.mpv.package = mpvPackage;
}
(mkIf (cfg.config != { } || cfg.profiles != { }) {
xdg.configFile."mpv/mpv.conf".text = ''