diff --git a/modules/home/gl.nix b/modules/home/gl.nix index 3eed353..0955370 100644 --- a/modules/home/gl.nix +++ b/modules/home/gl.nix @@ -1,7 +1,9 @@ -{ config, pkgs, lib, ... }: +{ config, osConfig ? null, pkgs, lib, ... }: let # https://github.com/nix-community/nixGL - useNixGL = !("system" ? config) && !config.isMacOS; # if not NixOS + # Only wrap when running standalone home-manager on a non-NixOS Linux distro; + # NixOS and nix-darwin provide working GL drivers natively. + useNixGL = osConfig == null && !config.isMacOS; wrapGL = { name, package }: # wrap a package's bins with nixGL if useNixGL then pkgs.runCommand "${name}-wrapped" { @@ -17,8 +19,8 @@ let filename=$(basename "$file") newfile="$out/bin/$filename" - echo "#!/bin/bash" > "$newfile" - echo "${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL \"$file\" \"\$@\"" >> "$newfile" + echo "#!${pkgs.runtimeShell}" > "$newfile" + echo "exec ${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL \"$file\" \"\$@\"" >> "$newfile" chmod +x "$newfile" done ''