mirror of
https://github.com/CHN-beta/nixpkgs.git
synced 2026-01-11 18:32:23 +08:00
Made with
```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
typos --no-check-filenames --write-changes "$1"
git diff --exit-code "$1" && exit
#( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
[[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```
and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`
I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
65 lines
1.5 KiB
Nix
65 lines
1.5 KiB
Nix
{
|
|
stdenv,
|
|
toKodiAddon,
|
|
addonDir,
|
|
cmake,
|
|
kodi,
|
|
kodi-platform,
|
|
libcec_platform,
|
|
}:
|
|
{
|
|
name ? "${attrs.pname}-${attrs.version}",
|
|
namespace,
|
|
version,
|
|
extraNativeBuildInputs ? [ ],
|
|
extraBuildInputs ? [ ],
|
|
extraRuntimeDependencies ? [ ],
|
|
extraCMakeFlags ? [ ],
|
|
extraInstallPhase ? "",
|
|
...
|
|
}@attrs:
|
|
toKodiAddon (
|
|
stdenv.mkDerivation (
|
|
{
|
|
name = "kodi-" + name;
|
|
|
|
dontStrip = true;
|
|
|
|
nativeBuildInputs = [ cmake ] ++ extraNativeBuildInputs;
|
|
buildInputs = [
|
|
kodi
|
|
kodi-platform
|
|
libcec_platform
|
|
] ++ extraBuildInputs;
|
|
|
|
inherit extraRuntimeDependencies;
|
|
|
|
# disables check ensuring install prefix is that of kodi
|
|
cmakeFlags = [
|
|
"-DOVERRIDE_PATHS=1"
|
|
] ++ extraCMakeFlags;
|
|
|
|
# kodi checks for addon .so libs existence in the addon folder (share/...)
|
|
# and the non-wrapped kodi lib/... folder before even trying to dlopen
|
|
# them. Symlinking .so, as setting LD_LIBRARY_PATH is of no use
|
|
installPhase =
|
|
let
|
|
n = namespace;
|
|
in
|
|
''
|
|
runHook preInstall
|
|
|
|
make install
|
|
|
|
[[ -f $out/lib/addons/${n}/${n}.so ]] && ln -s $out/lib/addons/${n}/${n}.so $out${addonDir}/${n}/${n}.so || true
|
|
[[ -f $out/lib/addons/${n}/${n}.so.${version} ]] && ln -s $out/lib/addons/${n}/${n}.so.${version} $out${addonDir}/${n}/${n}.so.${version} || true
|
|
|
|
${extraInstallPhase}
|
|
|
|
runHook postInstall
|
|
'';
|
|
}
|
|
// attrs
|
|
)
|
|
)
|