Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixgl: forward override calls to wrapped package #6029

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions modules/misc/nixgl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ in {
else
# Wrap the package's binaries with nixGL, while preserving the rest of
# the outputs and derivation attributes.
(pkg.overrideAttrs (old: {
((pkg.overrideAttrs (old: {
name = "nixGL-${pkg.name}";

# Make sure this is false for the wrapper derivation, so nix doesn't expect
Expand All @@ -203,7 +203,8 @@ in {
in ''
set -eo pipefail

${ # Heavily inspired by https://stackoverflow.com/a/68523368/6259505
${
# Heavily inspired by https://stackoverflow.com/a/68523368/6259505
lib.concatStringsSep "\n" (map (outputName: ''
echo "Copying output ${outputName}"
set -x
Expand Down Expand Up @@ -240,7 +241,15 @@ in {

shopt -u nullglob # Revert nullglob back to its normal default state
'';
}));
})) // {
# When the nixGL-wrapped package is given to a HM module, the module
# might want to override the package arguments, but our wrapper
# wouldn't know what to do with them. So, we rewrite the override
# function to instead forward the arguments to the package's own
# override function.
override = args:
(makePackageWrapper vendor environment (pkg.override args));
});

wrappers = {
mesa = makePackageWrapper "Intel" { };
Expand Down
Loading