mirror of
https://github.com/thilobillerbeck/dotfiles.git
synced 2024-12-22 03:53:05 +01:00
introduce official nixgl wrapper
This commit is contained in:
parent
056a6a5a78
commit
998f2da70e
6 changed files with 11 additions and 44 deletions
|
@ -6,9 +6,6 @@
|
|||
...
|
||||
}:
|
||||
|
||||
let
|
||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
||||
in
|
||||
{
|
||||
imports = [ ./../../home-manager/modules/machine.nix ];
|
||||
|
||||
|
@ -24,7 +21,5 @@ in
|
|||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
nixGLPrefix = lib.getExe pkgs.nixgl.nixGLIntel;
|
||||
|
||||
nix.settings.builders = "@/etc/nix/machines";
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
|
@ -81,6 +82,13 @@ with lib;
|
|||
news.display = "silent";
|
||||
targets.genericLinux.enable = config.machine.isGeneric;
|
||||
|
||||
nixGL = {
|
||||
packages = inputs.nixgl.packages;
|
||||
defaultWrapper = "mesa";
|
||||
installScripts = ["mesa"];
|
||||
vulkan.enable = true;
|
||||
};
|
||||
|
||||
home = {
|
||||
username = "${config.machine.username}";
|
||||
homeDirectory = "/home/${config.machine.username}";
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
with lib;
|
||||
let
|
||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
||||
nixGL = config.lib.nixGL.wrap;
|
||||
electronFlags = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --disable-gpu-shader-disk-cache -n";
|
||||
in
|
||||
{
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
||||
nixGL = config.lib.nixGL.wrap;
|
||||
in
|
||||
{
|
||||
programs.alacritty = {
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
}:
|
||||
|
||||
let
|
||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
||||
nixGL = config.lib.nixGL.wrap;
|
||||
in
|
||||
{
|
||||
programs.kitty = {
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
# Call once on import to load global context
|
||||
{ pkgs, config }:
|
||||
# Wrap a single package
|
||||
pkg:
|
||||
if config.nixGLPrefix == "" then
|
||||
pkg
|
||||
else
|
||||
# Wrap the package's binaries with nixGL, while preserving the rest of
|
||||
# the outputs and derivation attributes.
|
||||
(pkg.overrideAttrs (old: {
|
||||
name = "nixGL-${pkg.name}";
|
||||
buildCommand = ''
|
||||
set -eo pipefail
|
||||
|
||||
${
|
||||
# Heavily inspired by https://stackoverflow.com/a/68523368/6259505
|
||||
pkgs.lib.concatStringsSep "\n" (
|
||||
map (outputName: ''
|
||||
echo "Copying output ${outputName}"
|
||||
set -x
|
||||
cp -rs --no-preserve=mode "${pkg.${outputName}}" "''$${outputName}"
|
||||
set +x
|
||||
'') (old.outputs or [ "out" ])
|
||||
)
|
||||
}
|
||||
|
||||
rm -rf $out/bin/*
|
||||
shopt -s nullglob # Prevent loop from running if no files
|
||||
for file in ${pkg.out}/bin/*; do
|
||||
echo "#!${pkgs.bash}/bin/bash" > "$out/bin/$(basename $file)"
|
||||
echo "exec -a \"\$0\" ${config.nixGLPrefix} $file \"\$@\"" >> "$out/bin/$(basename $file)"
|
||||
chmod +x "$out/bin/$(basename $file)"
|
||||
done
|
||||
shopt -u nullglob # Revert nullglob back to its normal default state
|
||||
'';
|
||||
}))
|
Loading…
Reference in a new issue