From 32ab8865b6551dd66139f790270910bff236643a Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 23 Apr 2023 02:18:58 -0400 Subject: [PATCH 1/5] Revert "adjust mpv flags to work with 22.11 or 23.05" This reverts commit 3217f26b19b8323d3aa8c50276777aa3cc0e9d59. --- flake.nix | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/flake.nix b/flake.nix index 895acbf..6b34069 100644 --- a/flake.nix +++ b/flake.nix @@ -47,21 +47,11 @@ overlays.default = final: prev: let newScripts = packages.packages.${prev.system}; in rec { - mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs: - if oldAttrs ? wafConfigureFlags - then { - wafConfigureFlags = oldAttrs.wafConfigureFlags ++ [ - "--confloaddir=/etc/mpv" - ]; - } - else if oldAttrs ? mesonFlags - then { - mesonFlags = oldAttrs.mesonFlags ++ [ - "-Dsysconfdir=/etc" - ]; - } - else oldAttrs - ); + mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs: { + wafConfigureFlags = oldAttrs.wafConfigureFlags ++ [ + "--confloaddir=/etc/mpv" + ]; + }); mpv = prev.wrapMpv mpv-unwrapped { scripts = builtins.attrValues newScripts; }; From 4f950c6af98bc61ddc0bfb84bab68fa2c2c467e0 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 23 Apr 2023 02:19:15 -0400 Subject: [PATCH 2/5] Revert "better overriding of conf dir" This reverts commit 00f5e1d2859ab524b5c44672141b02282bdd9db6. --- confdir.patch | 13 +++++++++++++ flake.nix | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 confdir.patch diff --git a/confdir.patch b/confdir.patch new file mode 100644 index 0000000..d43c6a1 --- /dev/null +++ b/confdir.patch @@ -0,0 +1,13 @@ +diff --git a/meson.build b/meson.build +index acaa39f764..b4efc581dc 100644 +--- a/meson.build ++++ b/meson.build +@@ -1625,7 +1625,7 @@ sys.stdout.write(features) + ''' + feature_str = run_command(python, '-c', feature_sort, feature_keys, check: true).stdout() + conf_data.set_quoted('FULLCONFIG', feature_str) +-conf_data.set_quoted('MPV_CONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpv')) ++conf_data.set_quoted('MPV_CONFDIR', '/etc/mpv') + configure_file(output : 'config.h', configuration : conf_data) + message('List of enabled features: ' + feature_str) + diff --git a/flake.nix b/flake.nix index 6b34069..7c780cf 100644 --- a/flake.nix +++ b/flake.nix @@ -48,8 +48,8 @@ newScripts = packages.packages.${prev.system}; in rec { mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs: { - wafConfigureFlags = oldAttrs.wafConfigureFlags ++ [ - "--confloaddir=/etc/mpv" + patches = (oldAttrs.patches or []) ++ [ + ./confdir.patch ]; }); mpv = prev.wrapMpv mpv-unwrapped { From 681260bdb6ba0d138a08b7e80a375cb7a0101c09 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 23 Apr 2023 02:19:17 -0400 Subject: [PATCH 3/5] Revert "adjust confdir patch for v0.35.1 rather than master" This reverts commit 2c2216b8f40209525fdfe86afc8f0a1234747790. --- confdir.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/confdir.patch b/confdir.patch index d43c6a1..03b6be1 100644 --- a/confdir.patch +++ b/confdir.patch @@ -1,13 +1,13 @@ diff --git a/meson.build b/meson.build -index acaa39f764..b4efc581dc 100644 +index 4aada48731..39a37853de 100644 --- a/meson.build +++ b/meson.build -@@ -1625,7 +1625,7 @@ sys.stdout.write(features) +@@ -1655,7 +1655,7 @@ sys.stdout.write(features) ''' feature_str = run_command(python, '-c', feature_sort, feature_keys, check: true).stdout() conf_data.set_quoted('FULLCONFIG', feature_str) -conf_data.set_quoted('MPV_CONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpv')) +conf_data.set_quoted('MPV_CONFDIR', '/etc/mpv') + conf_data.set_quoted('PLATFORM', host_machine.system()) configure_file(output : 'config.h', configuration : conf_data) message('List of enabled features: ' + feature_str) - From be5208856b61c551a8936502cd1b1af9b8226da3 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 23 Apr 2023 02:19:19 -0400 Subject: [PATCH 4/5] Revert "fix mpv global config dir" This reverts commit 6f73a7d50c9d0377f4210a81db304231882b4ab8. --- confdir.patch | 13 ------------- flake.nix | 11 ++--------- 2 files changed, 2 insertions(+), 22 deletions(-) delete mode 100644 confdir.patch diff --git a/confdir.patch b/confdir.patch deleted file mode 100644 index 03b6be1..0000000 --- a/confdir.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/meson.build b/meson.build -index 4aada48731..39a37853de 100644 ---- a/meson.build -+++ b/meson.build -@@ -1655,7 +1655,7 @@ sys.stdout.write(features) - ''' - feature_str = run_command(python, '-c', feature_sort, feature_keys, check: true).stdout() - conf_data.set_quoted('FULLCONFIG', feature_str) --conf_data.set_quoted('MPV_CONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpv')) -+conf_data.set_quoted('MPV_CONFDIR', '/etc/mpv') - conf_data.set_quoted('PLATFORM', host_machine.system()) - configure_file(output : 'config.h', configuration : conf_data) - message('List of enabled features: ' + feature_str) diff --git a/flake.nix b/flake.nix index 7c780cf..204716e 100644 --- a/flake.nix +++ b/flake.nix @@ -46,15 +46,8 @@ packages // rec { overlays.default = final: prev: let newScripts = packages.packages.${prev.system}; - in rec { - mpv-unwrapped = prev.mpv-unwrapped.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or []) ++ [ - ./confdir.patch - ]; - }); - mpv = prev.wrapMpv mpv-unwrapped { - scripts = builtins.attrValues newScripts; - }; + in { + mpv = prev.mpv.override { scripts = builtins.attrValues newScripts; }; mpvScripts = prev.mpvScripts // newScripts; }; From 6c5c7f2b0004bd89a0428a2e9fa68a0e064dc3ab Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 23 Apr 2023 02:19:36 -0400 Subject: [PATCH 5/5] Revert "move sub-select.json to global config, remove home-manager dependency" This reverts commit 0047c5f9bef20c2228566c3efac3413b9efb11b2. --- flake.nix | 80 +++++++++++++++++++++---------------------- sub-select-path.patch | 13 ------- 2 files changed, 40 insertions(+), 53 deletions(-) delete mode 100644 sub-select-path.patch diff --git a/flake.nix b/flake.nix index 204716e..19ea799 100644 --- a/flake.nix +++ b/flake.nix @@ -9,13 +9,12 @@ outputs = { self, nixpkgs, utils }: let packages = utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; - mpvScript = { owner, repo, rev, sha256, scriptName, patches ? [] }: pkgs.stdenvNoCC.mkDerivation { + mpvScript = { owner, repo, rev, sha256, scriptName }: pkgs.stdenvNoCC.mkDerivation { pname = repo; version = builtins.substring 0 6 rev; src = pkgs.fetchFromGitHub { inherit owner repo rev sha256; }; - inherit patches; dontBuild = true; installPhase = '' install -Dm644 ${scriptName} $out/share/mpv/scripts/${scriptName} @@ -29,9 +28,6 @@ rev = "5d2fb7ab73fc0e36d44109e75c9be26bd42084e2"; sha256 = "0dyh2kyvivj81lrkyqhc3czmi9hqjkh7xg8dqjnnr3kh3yn62dpi"; scriptName = "sub-select.lua"; - patches = [ - ./sub-select-path.patch - ]; }; packages.segment-linking = mpvScript { @@ -59,41 +55,45 @@ pkgs.mkvtoolnix ]; - environment.etc."mpv/script-opts/sub-select.json".text = builtins.toJSON [ - { - alang = "j[ap]n?"; - slang = [ "eng?" "und" ]; - blacklist = [ "sign" ]; - condition = "not sub.forced"; - } - { - alang = "eng?"; - slang = "forced"; - } - { - alang = "eng?"; - slang = "eng?"; - whitelist = [ "sign" "song" ]; - } - { - alang = [ "eng?" "no" ]; - slang = "no"; - } - { - alang = "*"; - slang = "eng?"; - condition = "not sub.forced"; - } - { - alang = "*"; - slang = "und"; - condition = "not sub.forced"; - } - { - alang = "*"; - slang = "forced"; - } - ]; + home-manager.sharedModules = [ ({ config, ... }: { + config = lib.mkIf config.programs.mpv.enable { + xdg.configFile."mpv/script-opts/sub-select.json".text = builtins.toJSON [ + { + alang = "j[ap]n?"; + slang = [ "eng?" "und" ]; + blacklist = [ "sign" ]; + condition = "not sub.forced"; + } + { + alang = "eng?"; + slang = "forced"; + } + { + alang = "eng?"; + slang = "eng?"; + whitelist = [ "sign" "song" ]; + } + { + alang = [ "eng?" "no" ]; + slang = "no"; + } + { + alang = "*"; + slang = "eng?"; + condition = "not sub.forced"; + } + { + alang = "*"; + slang = "und"; + condition = "not sub.forced"; + } + { + alang = "*"; + slang = "forced"; + } + ]; + }; + }) ]; }; }; } diff --git a/sub-select-path.patch b/sub-select-path.patch deleted file mode 100644 index 9f6fb92..0000000 --- a/sub-select-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/sub-select.lua b/sub-select.lua -index f61025b..1d8edc8 100644 ---- a/sub-select.lua -+++ b/sub-select.lua -@@ -73,7 +73,7 @@ local function type_check(val, t, required) - end - - local function setup_prefs() -- local file = assert(io.open(mp.command_native({"expand-path", o.config}) .. "/sub-select.json")) -+ local file = assert(io.open(mp.command_native({"expand-path", o.config .. "/sub-select.json"}))) - local json = file:read("*all") - file:close() - prefs = utils.parse_json(json)