1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-23 03:29:45 +01:00

nixgl: use makeWrapper and update docs

makeWrapper is more consistent with the rest of nixpkgs & home-manager,
so it should be a little more maintainable. It can also validate that
the wrapper command is executable at build time.
This commit is contained in:
Mel Bourgeois 2024-06-19 18:35:53 -05:00 committed by Robert Helgesson
parent bbd4254d00
commit b9fe747915
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -13,9 +13,9 @@ in {
The nixGL command that `lib.nixGL.wrap` should wrap packages with. The nixGL command that `lib.nixGL.wrap` should wrap packages with.
This can be used to provide libGL access to applications on non-NixOS systems. This can be used to provide libGL access to applications on non-NixOS systems.
Some packages are wrapped by default (e.g. kitty, firefox), but you can wrap other packages Wrap individual packages like so: `(config.lib.nixGL.wrap <package>)`. The returned package
as well, with `(config.lib.nixGL.wrap <package>)`. If this option is empty (the default), can be used just like the original one, but will have access to libGL. If this option is empty (the default),
then `lib.nixGL.wrap` is a no-op. then `lib.nixGL.wrap` is a no-op. This is useful on NixOS, where the wrappers are unnecessary.
''; '';
}; };
@ -53,9 +53,12 @@ in {
rm -rf $out/bin/* rm -rf $out/bin/*
shopt -s nullglob # Prevent loop from running if no files shopt -s nullglob # Prevent loop from running if no files
for file in ${pkg.out}/bin/*; do for file in ${pkg.out}/bin/*; do
echo "#!${pkgs.bash}/bin/bash" > "$out/bin/$(basename $file)" local prog="$(basename "$file")"
echo "exec -a \"\$0\" ${cfg.prefix} $file \"\$@\"" >> "$out/bin/$(basename $file)" makeWrapper \
chmod +x "$out/bin/$(basename $file)" "${cfg.prefix}" \
"$out/bin/$prog" \
--argv0 "$prog" \
--add-flags "$file"
done done
# If .desktop files refer to the old package, replace the references # If .desktop files refer to the old package, replace the references