diff options
| -rw-r--r-- | pkgs/weznix.nix | 67 |
1 files changed, 35 insertions, 32 deletions
diff --git a/pkgs/weznix.nix b/pkgs/weznix.nix index bd1bd3a..333488e 100644 --- a/pkgs/weznix.nix +++ b/pkgs/weznix.nix @@ -1,6 +1,5 @@ { wezterm, makeWrapper, - symlinkJoin, writeText, nixToLua, lib, @@ -32,12 +31,9 @@ cfgDir = weznix.configDirectory end - - -- require('wezterm').config_dir = cfgDir wezterm = require('wezterm') wezterm.config_dir = cfgDir - -- package.path = package.path .. ';' .. cfgDir .. '/?.lua' package.path = cfgDir .. '/?.lua' package.cpath = package.cpath .. ';' .. cfgDir .. '/?.so' @@ -51,31 +47,38 @@ "--prefix" "PATH" ":" (lib.makeBinPath extraPATH) ] ++ extraWrapperArgs; -in (symlinkJoin { - name = "wezterm"; - nativeBuildInputs = [ makeWrapper ]; - paths = [ wezterm ]; - postBuild = # bash - '' - for bin in $out/bin/wezterm*; do - wrapProgram "$bin" ${lib.escapeShellArgs wrapperArgs} - done - ''; - }) // { - inherit (wezterm) version name passthru meta; -} - -# in wezterm.overrideAttrs ({ postInstall ? "", nativeBuildInputs ? [], buildInputs ? [], ... }: { -# nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper ]; -# -# buildInputs = buildInputs ++ extraPATH; -# -# postInstall = # bash -# '' -# ${postInstall} -# -# for bin in $out/bin/wezterm*; do -# wrapProgram "$bin" ${lib.escapeShellArgs wrapperArgs} -# done -# ''; -# }) +in wezterm.overrideAttrs ({ nativeBuildInputs ? [], ... }: { + nativeBuildInputs = nativeBuildInputs ++ [ makeWrapper ]; + + separateDebugInfo = false; + + buildCommand = /* bash */ '' + ${lib.concatMapStringsSep "\n" (outputName: '' + echo "Copying output ${outputName}" + set -x + cp -rs --no-preserve=mode "${wezterm.${outputName}}" "''$${outputName}" + set +x + '') (wezterm.outputs or [ "out" ])} + + + shopt -s nullglob + for bin in ${wezterm.out}/bin/wezterm*; do + local prog="$(basename "$bin")" + rm "$out/bin/$prog" + makeWrapper "$bin" "$out/bin/$prog" ${lib.escapeShellArgs wrapperArgs} + done + + # If .desktop files refer to the old package, replace the references + for dsk in "$out/share/applications"/*.desktop ; do + if ! grep -q "${wezterm.out}" "$dsk"; then + continue + fi + src="$(readlink "$dsk")" + rm "$dsk" + sed "s|${wezterm.out}|$out|g" "$src" > "$dsk" + done + + shopt -u nullglob # Revert nullglob back to its normal default state + + ''; + }) |
