From 2d7ef18297f24678fe736fc3e59cefad5daf4ee2 Mon Sep 17 00:00:00 2001 From: Philip Taron Date: Fri, 16 Aug 2024 10:30:44 -0700 Subject: [PATCH] mpv: remove with statements --- .../video/mpv/scripts/default.nix | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/pkgs/applications/video/mpv/scripts/default.nix b/pkgs/applications/video/mpv/scripts/default.nix index 873010ca3f5a..de0ee95044ca 100644 --- a/pkgs/applications/video/mpv/scripts/default.nix +++ b/pkgs/applications/video/mpv/scripts/default.nix @@ -41,40 +41,38 @@ let } # can't check whether `fullScriptPath` is a directory, in pure-evaluation mode - ( - with lib; - optionalAttrs - ( - !any (s: hasSuffix s drv.passthru.scriptName) [ - ".js" - ".lua" - ".so" - ] - ) - { - single-main-in-script-dir = - runCommand "mpvScripts.${name}.passthru.tests.single-main-in-script-dir" - { - meta.maintainers = with lib.maintainers; [ nicoo ]; - preferLocalBuild = true; + (lib.optionalAttrs + ( + !lib.any (s: lib.hasSuffix s drv.passthru.scriptName) [ + ".js" + ".lua" + ".so" + ] + ) + { + single-main-in-script-dir = + runCommand "mpvScripts.${name}.passthru.tests.single-main-in-script-dir" + { + meta.maintainers = with lib.maintainers; [ nicoo ]; + preferLocalBuild = true; + } + '' + die() { + echo "$@" >&2 + exit 1 } - '' - die() { - echo "$@" >&2 - exit 1 - } - cd "${drv}/${scriptPath}" # so the glob expands to filenames only - mains=( main.* ) - if [ "''${#mains[*]}" -eq 1 ]; then - touch $out - elif [ "''${#mains[*]}" -eq 0 ]; then - die "'${scriptPath}' contains no 'main.*' file" - else - die "'${scriptPath}' contains multiple 'main.*' files:" "''${mains[*]}" - fi - ''; - } + cd "${drv}/${scriptPath}" # so the glob expands to filenames only + mains=( main.* ) + if [ "''${#mains[*]}" -eq 1 ]; then + touch $out + elif [ "''${#mains[*]}" -eq 0 ]; then + die "'${scriptPath}' contains no 'main.*' file" + else + die "'${scriptPath}' contains multiple 'main.*' files:" "''${mains[*]}" + fi + ''; + } ) ]; };