mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
nixgl: make desktop files point to wrapped exe
Some desktop files will refer to the absolute path of the original derivation, which would bypass nixGL wrapping. So we need to replace the path with the path to the wrapper derivation to ensure the wrapped version is always launched.
This commit is contained in:
parent
446293584f
commit
bbd4254d00
1 changed files with 11 additions and 0 deletions
|
@ -57,6 +57,17 @@ in {
|
||||||
echo "exec -a \"\$0\" ${cfg.prefix} $file \"\$@\"" >> "$out/bin/$(basename $file)"
|
echo "exec -a \"\$0\" ${cfg.prefix} $file \"\$@\"" >> "$out/bin/$(basename $file)"
|
||||||
chmod +x "$out/bin/$(basename $file)"
|
chmod +x "$out/bin/$(basename $file)"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# If .desktop files refer to the old package, replace the references
|
||||||
|
for dsk in "$out/share/applications"/*.desktop ; do
|
||||||
|
if ! grep "${pkg.out}" "$dsk" > /dev/null; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
src="$(readlink "$dsk")"
|
||||||
|
rm "$dsk"
|
||||||
|
sed "s|${pkg.out}|$out|g" "$src" > "$dsk"
|
||||||
|
done
|
||||||
|
|
||||||
shopt -u nullglob # Revert nullglob back to its normal default state
|
shopt -u nullglob # Revert nullglob back to its normal default state
|
||||||
'';
|
'';
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in a new issue