From 9ff2188c5d2c65b20ded3f2e7a759319866313d3 Mon Sep 17 00:00:00 2001 From: Olmo Kramer Date: Sat, 29 Aug 2020 00:08:01 +0200 Subject: [PATCH] mpv: make wrapped package available via `package` --- modules/programs/mpv.nix | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/programs/mpv.nix b/modules/programs/mpv.nix index a5b0517f..7c15bd9e 100644 --- a/modules/programs/mpv.nix +++ b/modules/programs/mpv.nix @@ -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 = ''