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 ];
|
imports = [ ./../../home-manager/modules/machine.nix ];
|
||||||
|
|
||||||
|
@ -24,7 +21,5 @@ in
|
||||||
|
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
nixGLPrefix = lib.getExe pkgs.nixgl.nixGLIntel;
|
|
||||||
|
|
||||||
nix.settings.builders = "@/etc/nix/machines";
|
nix.settings.builders = "@/etc/nix/machines";
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
lib,
|
lib,
|
||||||
pkgs,
|
pkgs,
|
||||||
config,
|
config,
|
||||||
|
inputs,
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -81,6 +82,13 @@ with lib;
|
||||||
news.display = "silent";
|
news.display = "silent";
|
||||||
targets.genericLinux.enable = config.machine.isGeneric;
|
targets.genericLinux.enable = config.machine.isGeneric;
|
||||||
|
|
||||||
|
nixGL = {
|
||||||
|
packages = inputs.nixgl.packages;
|
||||||
|
defaultWrapper = "mesa";
|
||||||
|
installScripts = ["mesa"];
|
||||||
|
vulkan.enable = true;
|
||||||
|
};
|
||||||
|
|
||||||
home = {
|
home = {
|
||||||
username = "${config.machine.username}";
|
username = "${config.machine.username}";
|
||||||
homeDirectory = "/home/${config.machine.username}";
|
homeDirectory = "/home/${config.machine.username}";
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
let
|
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";
|
electronFlags = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-wayland-ime --disable-gpu-shader-disk-cache -n";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
nixGL = config.lib.nixGL.wrap;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.alacritty = {
|
programs.alacritty = {
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
nixGL = import ./../../home-manager/utils/nixGLWrap.nix { inherit pkgs config; };
|
nixGL = config.lib.nixGL.wrap;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
programs.kitty = {
|
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