aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wells <chris@mathematicaster.org>2025-11-05 08:58:22 -0600
committerChris Wells <chris@mathematicaster.org>2025-11-05 08:58:22 -0600
commit7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368 (patch)
tree1e3f0369375a985518c6605ab0944e4d207500eb
parentca50606b98774565ba5f31caa6ec33601471480e (diff)
downloadweznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar.gz
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar.bz2
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar.lz
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar.xz
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.tar.zst
weznix-7f1c5fa4afe6c6c5c3316da0f622698f1b2ab368.zip
Decided to overrideAttrs instead of symlinkJoin
-rw-r--r--pkgs/weznix.nix67
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
+
+ '';
+ })