This commit is contained in:
Varris 2023-02-26 01:49:03 +01:00
parent a1676f8656
commit 74f2c9085a
14 changed files with 863 additions and 96 deletions

143
flake.nix
View File

@ -32,23 +32,13 @@
};
# Kakoune Plugins End
rofi-theme = {
url = "github:bardisty/gruvbox-rofi";
flake = false;
};
wayland-protcols-git = {
url = "gitlab:wayland/wayland-protocols?host=gitlab.freedesktop.org";
flake = false;
};
xorg-git = {
url = "gitlab:xorg/xserver?host=gitlab.freedesktop.org";
flake = false;
};
mesa-git = {
url = "gitlab:mesa/mesa/mesa-22.3.2?host=gitlab.freedesktop.org";
url = "gitlab:mesa/mesa?host=gitlab.freedesktop.org";
flake = false;
};
@ -67,11 +57,26 @@
inputs.nixpkgs.follows = "nixpkgs";
};
hyprpaper = {
url = "github:hyprwm/hyprpaper";
inputs.nixpkgs.follows = "nixpkgs";
};
waybar = {
url = "github:alexays/waybar";
flake = false;
};
webcord = {
url = "github:fufexan/webcord-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
openmw = {
url = "gitlab:OpenMW/openmw";
flake = false;
};
};
outputs = { self, nixpkgs, home-manager, nix-colors, ... }@inputs:
@ -84,7 +89,12 @@
allowUnfree = true;
allowUnsupportedSystem = true;
};
overlays = [ self.overlays.default inputs.hyprland-contrib.overlays.default ];
overlays = [
self.overlays.default
inputs.hyprland-contrib.overlays.default
inputs.hyprpaper.overlays.default
inputs.webcord.overlays.default
];
};
in
{
@ -131,49 +141,74 @@
];
};
mesa-git = (prev.mesa.overrideAttrs (old: {
version = "git";
src = inputs.mesa-git;
buildInputs = old.buildInputs ++ [ pkgs.llvmPackages.libclang pkgs.glslang pkgs.vulkan-loader ];
patches = [
./pkgs/patches/mesa-git/opencl.patch
./pkgs/patches/mesa-git/disk_cache-include-dri-driver-path-in-cache-key.patch
];
mesonFlags = pkgs.lib.lists.remove
"-Dxvmc-libs-path=${placeholder "drivers"}/lib"
old.mesonFlags; # xvmc was removed upstream
})).override {
galliumDrivers = [ "radeonsi" "swrast" ];
vulkanDrivers = [ "amd" ];
enableGalliumNine = false; # Replaced by DXVK
};
customedid = pkgs.callPackage ./pkgs/custom-edid { };
wxedid = pkgs.callPackage ./pkgs/wxedid { };
};
nixosConfigurations.terra = nixpkgs.lib.nixosSystem {
inherit system;
inherit pkgs;
specialArgs = { inherit inputs; };
modules = [
{
# needed to get tools working that expect a nixpkgs channel to exist
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.registry = { nixpkgs.flake = nixpkgs; };
}
./system/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = true;
users.manuel = import ./user/home.nix;
extraSpecialArgs = { inherit inputs pkgs nix-colors; };
mesa-git =
(prev.mesa.overrideAttrs
(old: {
version = "git";
src = inputs.mesa-git;
patches = [
./pkgs/mesa-git/disk_cache-include-dri-driver-path-in-cache-key.patch
./pkgs/mesa-git/opencl.patch
];
mesonFlags = old.mesonFlags ++ [
"-Dandroid-libbacktrace=disabled"
"-Dlmsensors=disabled"
"-Dlibunwind=disabled"
];
})).override
{
galliumDrivers = [ "radeonsi" "swrast" "svga" ];
vulkanDrivers = [ "amd" ];
enableGalliumNine = false; # Replaced by DXVK
};
}
inputs.grub2-themes.nixosModule
];
mygui = prev.mygui.overrideAttrs
(old: {
version = "3.4.1";
src = prev.fetchFromGitHub {
owner = "MyGUI";
repo = "mygui";
rev = "MyGUI3.4.1";
sha256 = "sha256-5u9whibYKPj8tCuhdLOhL4nDisbFAB0NxxdjU/8izb8=";
};
});
customedid = pkgs.callPackage
./pkgs/custom-edid
{ };
wxedid = pkgs.callPackage
./pkgs/wxedid
{ };
fastfetch = pkgs.callPackage
./pkgs/fastfetch
{ };
};
nixosConfigurations.terra = nixpkgs.lib.nixosSystem
{
inherit system;
inherit pkgs;
specialArgs = { inherit inputs; };
modules = [
{
# needed to get tools working that expect a nixpkgs channel to exist
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
nix.registry = { nixpkgs.flake = nixpkgs; };
}
./system/configuration.nix
home-manager.nixosModules.home-manager
{
home-manager = {
useUserPackages = true;
users.manuel = import ./user/home.nix;
extraSpecialArgs = { inherit inputs pkgs nix-colors; };
};
}
inputs.grub2-themes.nixosModules.default
];
};
};
}

View File

@ -0,0 +1,82 @@
{ lib
, stdenv
, cmake
, pkg-config
, fetchFromGitHub
, makeWrapper
, # hard deps
dbus
, dconf
, glib
, pciutils
, zlib
, # soft deps
enableChafa ? false
, chafa
, enableImageMagick ? false
, imagemagick_light
, enableOpenCLModule ? true
, ocl-icd
, opencl-headers
, enableOpenGLModule ? true
, libglvnd
, enableVulkanModule ? true
, vulkan-loader
, enableWayland ? true
, wayland
, enableX11 ? true
, libX11
, libxcb
, enableXFCE ? false
, xfce
,
}:
stdenv.mkDerivation rec {
pname = "fastfetch";
version = "1.9.1";
src = fetchFromGitHub {
owner = "LinusDierheimer";
repo = pname;
rev = version;
hash = "sha256-Qc0lDEKwhKNafZlpiyMmXU8vIvtRsN7OQaymUr6yQPE=";
};
nativeBuildInputs = [ cmake makeWrapper pkg-config ];
runtimeDependencies =
[ dbus dconf glib pciutils zlib ]
++ lib.optional enableChafa chafa
++ lib.optional enableImageMagick imagemagick_light
++ lib.optional enableOpenCLModule ocl-icd
++ lib.optional enableOpenGLModule libglvnd
++ lib.optional enableVulkanModule vulkan-loader
++ lib.optional enableWayland wayland
++ lib.optional enableX11 libxcb
++ lib.optional enableXFCE xfce.xfconf;
buildInputs =
runtimeDependencies
++ lib.optional enableOpenCLModule opencl-headers
++ lib.optional enableX11 libX11;
cmakeFlags = [
"-DCMAKE_INSTALL_SYSCONFDIR=${placeholder "out"}/etc"
];
ldLibraryPath = lib.makeLibraryPath runtimeDependencies;
postInstall = ''
wrapProgram $out/bin/fastfetch --prefix LD_LIBRARY_PATH : "${ldLibraryPath}"
wrapProgram $out/bin/flashfetch --prefix LD_LIBRARY_PATH : "${ldLibraryPath}"
'';
meta = with lib; {
description = "Like neofetch, but much faster";
inherit (src.meta) homepage;
license = licenses.mit;
platforms = platforms.linux;
maintainers = with import ../maintainers.nix; [ spikespaz ];
};
}

331
pkgs/mesa-git/default.nix Normal file
View File

@ -0,0 +1,331 @@
{ stdenv
, lib
, fetchurl
, meson
, pkg-config
, ninja
, intltool
, bison
, flex
, file
, python3Packages
, wayland-scanner
, expat
, libdrm
, xorg
, wayland
, wayland-protocols
, openssl
, llvmPackages
, libffi
, libomxil-bellagio
, libva-minimal
, libelf
, libvdpau
, libglvnd
, libunwind
, vulkan-loader
, glslang
, galliumDrivers ? [ "auto" ]
# upstream Mesa defaults to only enabling swrast (aka lavapipe) on aarch64 for some reason, so force building the others
, vulkanDrivers ? if (stdenv.isLinux && stdenv.isAarch64) then [ "swrast" "broadcom" "freedreno" "panfrost" ] else [ "auto" ]
, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" ]
, vulkanLayers ? lib.optionals (!stdenv.isDarwin) [ "device-select" "overlay" ] # No Vulkan support on Darwin
, OpenGL
, Xplugin
, withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind-light && !valgrind-light.meta.broken
, valgrind-light
, enableGalliumNine ? stdenv.isLinux
, enableOSMesa ? stdenv.isLinux
, enableOpenCL ? stdenv.isLinux && stdenv.isx86_64
, enablePatentEncumberedCodecs ? true
, libclc
, jdupes
, cmake
, rustc
, rust-bindgen
, spirv-llvm-translator_14
, inputs
}:
/** Packaging design:
- The basic mesa ($out) contains headers and libraries (GLU is in libGLU now).
This or the mesa attribute (which also contains GLU) are small (~ 2 MB, mostly headers)
and are designed to be the buildInput of other packages.
- DRI drivers are compiled into $drivers output, which is much bigger and
depends on LLVM. These should be searched at runtime in
"/run/opengl-driver{,-32}/lib/*" and so are kind-of impure (given by NixOS).
(I suppose on non-NixOS one would create the appropriate symlinks from there.)
- libOSMesa is in $osmesa (~4 MB)
*/
let
# Release calendar: https://www.mesa3d.org/release-calendar.html
# Release frequency: https://www.mesa3d.org/releasing.html#schedule
version = "git";
branch = lib.versions.major version;
withLibdrm = lib.meta.availableOn stdenv.hostPlatform libdrm;
rust-bindgen' = rust-bindgen.override {
rust-bindgen-unwrapped = rust-bindgen.unwrapped.override {
clang = llvmPackages.clang;
};
};
self = stdenv.mkDerivation {
pname = "mesa-git";
inherit version;
src = inputs.mesa-git;
# TODO:
# revive ./dricore-gallium.patch when it gets ported (from Ubuntu), as it saved
# ~35 MB in $drivers; watch https://launchpad.net/ubuntu/+source/mesa/+changelog
patches = [
# fixes pkgsMusl.mesa build
./musl.patch
./opencl.patch
./disk_cache-include-dri-driver-path-in-cache-key.patch
];
postPatch = ''
patchShebangs .
# The drirc.d directory cannot be installed to $drivers as that would cause a cyclic dependency:
substituteInPlace src/util/xmlconfig.c --replace \
'DATADIR "/drirc.d"' '"${placeholder "out"}/share/drirc.d"'
substituteInPlace src/util/meson.build --replace \
"get_option('datadir')" "'${placeholder "out"}/share'"
substituteInPlace src/amd/vulkan/meson.build --replace \
"get_option('datadir')" "'${placeholder "out"}/share'"
'';
outputs = [ "out" "dev" "drivers" ]
++ lib.optional enableOSMesa "osmesa"
++ lib.optional stdenv.isLinux "driversdev"
++ lib.optional enableOpenCL "opencl";
# FIXME: this fixes rusticl/iris segfaulting on startup, _somehow_.
# Needs more investigating.
separateDebugInfo = true;
preConfigure = ''
PATH=${llvmPackages.libllvm.dev}/bin:$PATH
'';
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
mesonFlags = [
"--sysconfdir=/etc"
"--datadir=${placeholder "drivers"}/share" # Vendor files
# Don't build in debug mode
# https://gitlab.freedesktop.org/mesa/mesa/blob/master/docs/meson.html#L327
"-Db_ndebug=true"
"-Ddisk-cache-key=${placeholder "drivers"}"
"-Ddri-search-path=${libglvnd.driverLink}/lib/dri"
"-Dplatforms=${lib.concatStringsSep "," eglPlatforms}"
"-Dgallium-drivers=${lib.concatStringsSep "," galliumDrivers}"
"-Dvulkan-drivers=${lib.concatStringsSep "," vulkanDrivers}"
"-Ddri-drivers-path=${placeholder "drivers"}/lib/dri"
"-Dvdpau-libs-path=${placeholder "drivers"}/lib/vdpau"
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
"-Dgallium-nine=${lib.boolToString enableGalliumNine}" # Direct3D in Wine
"-Dosmesa=${lib.boolToString enableOSMesa}" # used by wine
"-Dmicrosoft-clc=disabled" # Only relevant on Windows (OpenCL 1.2 API on top of D3D12)
# To enable non-mesa gbm backends to be found (e.g. Nvidia)
"-Dgbm-backends-path=${libglvnd.driverLink}/lib/gbm:${placeholder "out"}/lib/gbm"
] ++ lib.optionals stdenv.isLinux [
"-Dglvnd=true"
] ++ lib.optionals enableOpenCL [
"-Dgallium-opencl=icd" # Enable the gallium OpenCL frontend
"-Dgallium-rusticl=true"
"-Drust_std=2021"
"-Dclang-libdir=${llvmPackages.clang-unwrapped.lib}/lib"
] ++ lib.optional enablePatentEncumberedCodecs
"-Dvideo-codecs=h264dec,h264enc,h265dec,h265enc,vc1dec"
++ lib.optional (vulkanLayers != [ ]) "-D vulkan-layers=${builtins.concatStringsSep "," vulkanLayers}";
buildInputs = with xorg; [
expat
llvmPackages.libllvm
libglvnd
xorgproto
libX11
libXext
libxcb
libXt
libXfixes
libxshmfence
libXrandr
libffi
libvdpau
libelf
libXvMC
libpthreadstubs
openssl /*or another sha1 provider*/
] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [ wayland wayland-protocols ]
++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ]
++ lib.optionals stdenv.isDarwin [ libunwind ]
++ lib.optionals enableOpenCL [ libclc llvmPackages.clang llvmPackages.clang-unwrapped rustc rust-bindgen' spirv-llvm-translator_14 ]
++ lib.optional withValgrind valgrind-light
# Mesa will not build zink when gallium-drivers=auto
++ lib.optional (lib.elem "zink" galliumDrivers) vulkan-loader;
depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [
meson
pkg-config
ninja
intltool
bison
flex
file
python3Packages.python
python3Packages.Mako
jdupes
glslang
] ++ lib.optionals (lib.elem "wayland" eglPlatforms) [
wayland-scanner
];
propagatedBuildInputs = with xorg; [
libXdamage
libXxf86vm
] ++ lib.optional withLibdrm libdrm
++ lib.optionals stdenv.isDarwin [ OpenGL Xplugin ];
doCheck = false;
postInstall = ''
# Some installs don't have any drivers so this directory is never created.
mkdir -p $drivers $osmesa
'' + lib.optionalString stdenv.isLinux ''
mkdir -p $drivers/lib
if [ -n "$(shopt -s nullglob; echo "$out/lib/libxatracker"*)" -o -n "$(shopt -s nullglob; echo "$out/lib/libvulkan_"*)" ]; then
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
mv -t $drivers/lib \
$out/lib/libxatracker* \
$out/lib/libvulkan_*
fi
if [ -n "$(shopt -s nullglob; echo "$out"/lib/lib*_mesa*)" ]; then
# Move other drivers to a separate output
mv -t $drivers/lib $out/lib/lib*_mesa*
fi
# Update search path used by glvnd
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
done
# Update search path used by Vulkan (it's pointing to $out but
# drivers are in $drivers)
for js in $drivers/share/vulkan/icd.d/*.json; do
substituteInPlace "$js" --replace "$out" "$drivers"
done
'' + lib.optionalString enableOpenCL ''
# Move OpenCL stuff
mkdir -p $opencl/lib
mv -t "$opencl/lib/" \
$out/lib/gallium-pipe \
$out/lib/lib*OpenCL*
# We construct our own .icd files that contain absolute paths.
mkdir -p $opencl/etc/OpenCL/vendors/
echo $opencl/lib/libMesaOpenCL.so > $opencl/etc/OpenCL/vendors/mesa.icd
echo $opencl/lib/libRusticlOpenCL.so > $opencl/etc/OpenCL/vendors/rusticl.icd
'' + lib.optionalString enableOSMesa ''
# move libOSMesa to $osmesa, as it's relatively big
mkdir -p $osmesa/lib
mv -t $osmesa/lib/ $out/lib/libOSMesa*
'' + lib.optionalString (vulkanLayers != [ ]) ''
mv -t $drivers/lib $out/lib/libVkLayer*
for js in $drivers/share/vulkan/{im,ex}plicit_layer.d/*.json; do
substituteInPlace "$js" --replace '"libVkLayer_' '"'"$drivers/lib/libVkLayer_"
done
'';
postFixup = lib.optionalString stdenv.isLinux ''
# set the default search path for DRI drivers; used e.g. by X server
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
[ -f "$dev/lib/pkgconfig/d3d.pc" ] && substituteInPlace "$dev/lib/pkgconfig/d3d.pc" --replace "$drivers" "${libglvnd.driverLink}"
# remove pkgconfig files for GL/EGL; they are provided by libGL.
rm -f $dev/lib/pkgconfig/{gl,egl}.pc
# Move development files for libraries in $drivers to $driversdev
mkdir -p $driversdev/include
mv $dev/include/xa_* $dev/include/d3d* -t $driversdev/include || true
mkdir -p $driversdev/lib/pkgconfig
for pc in lib/pkgconfig/{xatracker,d3d}.pc; do
if [ -f "$dev/$pc" ]; then
substituteInPlace "$dev/$pc" --replace $out $drivers
mv $dev/$pc $driversdev/$pc
fi
done
# NAR doesn't support hard links, so convert them to symlinks to save space.
jdupes --hard-links --link-soft --recurse "$drivers"
# add RPATH so the drivers can find the moved libgallium and libdricore9
# moved here to avoid problems with stripping patchelfed files
for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
if [[ ! -L "$lib" ]]; then
patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
fi
done
'';
NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ "-fno-common" ] ++ lib.optionals enableOpenCL [
"-UPIPE_SEARCH_DIR"
"-DPIPE_SEARCH_DIR=\"${placeholder "opencl"}/lib/gallium-pipe\""
];
passthru = {
inherit (libglvnd) driverLink;
inherit llvmPackages;
libdrm = if withLibdrm then libdrm else null;
tests = lib.optionalAttrs stdenv.isLinux {
devDoesNotDependOnLLVM = stdenv.mkDerivation {
name = "mesa-dev-does-not-depend-on-llvm";
buildCommand = ''
echo ${self.dev} >>$out
'';
disallowedRequisites = [ llvmPackages.llvm self.drivers ];
};
};
};
meta = with lib; {
description = "An open source 3D graphics library";
longDescription = ''
The Mesa project began as an open-source implementation of the OpenGL
specification - a system for rendering interactive 3D graphics. Over the
years the project has grown to implement more graphics APIs, including
OpenGL ES (versions 1, 2, 3), OpenCL, OpenMAX, VDPAU, VA API, XvMC, and
Vulkan. A variety of device drivers allows the Mesa libraries to be used
in many different environments ranging from software emulation to
complete hardware acceleration for modern GPUs.
'';
homepage = "https://www.mesa3d.org/";
changelog = "https://www.mesa3d.org/relnotes/${version}.html";
license = licenses.mit; # X11 variant, in most files
platforms = platforms.mesaPlatforms;
maintainers = with maintainers; [ primeos vcunat ]; # Help is welcome :)
};
};
in
self

View File

@ -0,0 +1,59 @@
diff --git a/meson_options.txt b/meson_options.txt
index 0bd92d3916d..0c6db767dc8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -488,6 +488,13 @@ option(
description : 'Enable direct rendering in GLX and EGL for DRI',
)
+option(
+ 'disk-cache-key',
+ type : 'string',
+ value : '',
+ description : 'Mesa cache key.'
+)
+
option('egl-lib-suffix',
type : 'string',
value : '',
diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c
index e4e03131b0a..4fade805111 100644
--- a/src/util/disk_cache.c
+++ b/src/util/disk_cache.c
@@ -217,8 +217,10 @@ disk_cache_type_create(const char *gpu_name,
/* Create driver id keys */
size_t id_size = strlen(driver_id) + 1;
+ size_t key_size = strlen(DISK_CACHE_KEY) + 1;
size_t gpu_name_size = strlen(gpu_name) + 1;
cache->driver_keys_blob_size += id_size;
+ cache->driver_keys_blob_size += key_size;
cache->driver_keys_blob_size += gpu_name_size;
/* We sometimes store entire structs that contains a pointers in the cache,
@@ -239,6 +241,7 @@ disk_cache_type_create(const char *gpu_name,
uint8_t *drv_key_blob = cache->driver_keys_blob;
DRV_KEY_CPY(drv_key_blob, &cache_version, cv_size)
DRV_KEY_CPY(drv_key_blob, driver_id, id_size)
+ DRV_KEY_CPY(drv_key_blob, DISK_CACHE_KEY, key_size)
DRV_KEY_CPY(drv_key_blob, gpu_name, gpu_name_size)
DRV_KEY_CPY(drv_key_blob, &ptr_size, ptr_size_size)
DRV_KEY_CPY(drv_key_blob, &driver_flags, driver_flags_size)
diff --git a/src/util/meson.build b/src/util/meson.build
index fe57c35a967..ce90b3530f9 100644
--- a/src/util/meson.build
+++ b/src/util/meson.build
@@ -261,7 +261,12 @@ _libmesa_util = static_library(
include_directories : [inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux],
dependencies : deps_for_libmesa_util,
link_with: [libmesa_format, libmesa_util_sse41],
- c_args : [c_msvc_compat_args],
+ c_args : [
+ c_msvc_compat_args,
+ '-DDISK_CACHE_KEY="@0@"'.format(
+ get_option('disk-cache-key')
+ ),
+ ],
gnu_symbol_visibility : 'hidden',
build_by_default : false
)

59
pkgs/mesa-git/musl.patch Normal file
View File

@ -0,0 +1,59 @@
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
index 06ca90564f0..bb244f8f358 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
@@ -30,6 +30,7 @@
#include <amdgpu.h>
#include <pthread.h>
+#include <sys/types.h>
#include "util/list.h"
#include "util/rwlock.h"
#include "ac_gpu_info.h"
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 22f99c41909..2f3195926be 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -108,6 +108,8 @@ extern bool fd_binning_enabled;
#include <sys/types.h>
#include <sys/syscall.h>
+#define gettid() ((pid_t)syscall(SYS_gettid))
+
#define DBG(fmt, ...) \
do { \
if (FD_DBG(MSGS)) \
diff --git a/src/gallium/frontends/nine/nine_debug.c b/src/gallium/frontends/nine/nine_debug.c
index f3a6a945025..f4a6c41a612 100644
--- a/src/gallium/frontends/nine/nine_debug.c
+++ b/src/gallium/frontends/nine/nine_debug.c
@@ -65,7 +65,7 @@ _nine_debug_printf( unsigned long flag,
{
static boolean first = TRUE;
static unsigned long dbg_flags = DBG_ERROR | DBG_WARN;
- unsigned long tid = 0;
+ pthread_t tid = 0;
if (first) {
first = FALSE;
@@ -74,7 +74,7 @@ _nine_debug_printf( unsigned long flag,
#if defined(HAVE_PTHREAD)
if (dbg_flags & DBG_TID)
- tid = (unsigned long)pthread_self();
+ tid = pthread_self();
#endif
if (dbg_flags & flag) {
diff --git a/src/util/rand_xor.c b/src/util/rand_xor.c
index 81b64f1ea71..56ebd2eccdf 100644
--- a/src/util/rand_xor.c
+++ b/src/util/rand_xor.c
@@ -28,6 +28,7 @@
#if defined(HAVE_GETRANDOM)
#include <sys/random.h>
#endif
+#include <sys/types.h> /* size_t, ssize_t */
#include <unistd.h>
#include <fcntl.h>
#endif

View File

@ -0,0 +1,66 @@
diff --git a/meson.build b/meson.build
index 172c64a7c70..05961e56926 100644
--- a/meson.build
+++ b/meson.build
@@ -1900,7 +1900,7 @@ endif
dep_clang = null_dep
if with_clc
- llvm_libdir = dep_llvm.get_variable(cmake : 'LLVM_LIBRARY_DIR', configtool: 'libdir')
+ llvm_libdir = get_option('clang-libdir')
dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
diff --git a/meson_options.txt b/meson_options.txt
index 6f307018815..ab84eb1006c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -18,6 +18,12 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
+option(
+ 'clang-libdir',
+ type : 'string',
+ value : '',
+ description : 'Locations to search for clang libraries.'
+)
option(
'platforms',
type : 'array',
diff --git a/src/gallium/targets/opencl/meson.build b/src/gallium/targets/opencl/meson.build
index db3586bd7fb..4d914206d21 100644
--- a/src/gallium/targets/opencl/meson.build
+++ b/src/gallium/targets/opencl/meson.build
@@ -39,7 +39,8 @@ if dep_llvm.version().version_compare('>=10.0.0')
polly_isl_dep = cpp.find_library('PollyISL', dirs : llvm_libdir, required : false)
endif
-dep_clang = cpp.find_library('clang-cpp', dirs : llvm_libdir, required : false)
+clang_libdir = get_option('clang-libdir')
+dep_clang = cpp.find_library('clang-cpp', dirs : clang_libdir, required : false)
# meson will return clang-cpp from system dirs if it's not found in llvm_libdir
linker_rpath_arg = '-Wl,--rpath=@0@'.format(llvm_libdir)
@@ -123,7 +124,7 @@ if with_opencl_icd
configuration : _config,
input : 'mesa.icd.in',
output : 'mesa.icd',
- install : true,
+ install : false,
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)
diff --git a/src/gallium/targets/rusticl/meson.build b/src/gallium/targets/rusticl/meson.build
index a968dee52db..69475cf3133 100644
--- a/src/gallium/targets/rusticl/meson.build
+++ b/src/gallium/targets/rusticl/meson.build
@@ -58,7 +58,7 @@ configure_file(
configuration : _config,
input : 'rusticl.icd.in',
output : 'rusticl.icd',
- install : true,
+ install : false,
install_dir : join_paths(get_option('sysconfdir'), 'OpenCL', 'vendors'),
)

75
pkgs/mesa-git/stubs.nix Normal file
View File

@ -0,0 +1,75 @@
{ stdenv
, libglvnd, mesa
, OpenGL }:
stdenv.mkDerivation {
inherit (libglvnd) version;
pname = "libGL";
outputs = [ "out" "dev" ];
# On macOS, libglvnd is not supported, so we just use what mesa
# build. We need to also include OpenGL.framework, and some
# extra tricks to go along with. We add mesas libGLX to support
# the X extensions to OpenGL.
buildCommand = if stdenv.hostPlatform.isDarwin then ''
mkdir -p $out/nix-support $dev
echo ${OpenGL} >> $out/nix-support/propagated-build-inputs
ln -s ${mesa.out}/lib $out/lib
mkdir -p $dev/lib/pkgconfig $dev/nix-support
echo "$out" > $dev/nix-support/propagated-build-inputs
ln -s ${mesa.dev}/include $dev/include
cat <<EOF >$dev/lib/pkgconfig/gl.pc
Name: gl
Description: gl library
Version: ${mesa.version}
Libs: -L${mesa.out}/lib -lGL
Cflags: -I${mesa.dev}/include
EOF
cat <<EOF >$dev/lib/pkgconfig/glesv1_cm.pc
Name: glesv1_cm
Description: glesv1_cm library
Version: ${mesa.version}
Libs: -L${mesa.out}/lib -lGLESv1_CM
Cflags: -I${mesa.dev}/include
EOF
cat <<EOF >$dev/lib/pkgconfig/glesv2.pc
Name: glesv2
Description: glesv2 library
Version: ${mesa.version}
Libs: -L${mesa.out}/lib -lGLESv2
Cflags: -I${mesa.dev}/include
EOF
''
# Otherwise, setup gl stubs to use libglvnd.
else ''
mkdir -p $out/nix-support
ln -s ${libglvnd.out}/lib $out/lib
mkdir -p $dev/{,lib/pkgconfig,nix-support}
echo "$out ${libglvnd} ${libglvnd.dev}" > $dev/nix-support/propagated-build-inputs
ln -s ${libglvnd.dev}/include $dev/include
genPkgConfig() {
local name="$1"
local lib="$2"
cat <<EOF >$dev/lib/pkgconfig/$name.pc
Name: $name
Description: $lib library
Version: ${libglvnd.version}
Libs: -L${libglvnd.out}/lib -l$lib
Cflags: -I${libglvnd.dev}/include
EOF
}
genPkgConfig gl GL
genPkgConfig egl EGL
genPkgConfig glesv1_cm GLESv1_CM
genPkgConfig glesv2 GLESv2
'';
}

View File

@ -20,6 +20,13 @@
"drm.edid_firmware=DP-1:edid/edid-EX2780Q.bin"
];
extraModprobeConfig = ''
options iwlwifi power_save=0
options iwlwifi swcrypto=0
options iwlwifi uapsd_disable=1
options iwlmvm power_scheme=1
'';
loader = {
efi = {
canTouchEfiVariables = true;
@ -41,7 +48,7 @@
};
# initrd.availableKernelModules=sd [ "amdgpu" ];
kernelPackages = pkgs.linuxPackages_latest;
kernelPackages = pkgs.linuxPackages_zen;
kernelModules = [ "i2c-dev" "i2c-piix4" ];
};
@ -49,7 +56,13 @@
networking = {
hostName = "terra"; # Define your hostname.
networkmanager.enable = true;
networkmanager = {
enable = true;
wifi = {
scanRandMacAddress = false;
powersave = false;
};
};
firewall.checkReversePath = false;
firewall.enable = false;
@ -81,8 +94,8 @@
hardware.opengl = {
enable = true;
#package = pkgs.mesa-git.drivers;
#package32 = pkgs.pkgsi686Linux.mesa-git.drivers;
package = pkgs.mesa-git.drivers;
package32 = pkgs.pkgsi686Linux.mesa-git.drivers;
extraPackages = [ pkgs.libvdpau-va-gl ];
driSupport = true;
@ -92,11 +105,17 @@
hardware.steam-hardware.enable = true;
hardware.bluetooth.enable = true;
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
};
# Enable sound.
sound.enable = true;
security.rtkit.enable = true;
security.audit.enable = false;
security.auditd.enable = false;
services.pipewire = {
enable = true;
@ -159,6 +178,8 @@
"input"
"networkmanager"
"nm-openvpn"
"scanner"
"lp"
"users"
"video"
"wheel"
@ -204,7 +225,7 @@
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
wlr.enable = true;
wlr.enable = false; #conflict with XDPH if enabled
extraPortals = [
pkgs.xdg-desktop-portal-gtk
];

View File

@ -1,5 +1,10 @@
{ config, pkgs, ... }:
{
programs.browserpass = {
enable = true;
browsers = [ "firefox" ];
};
programs.firefox = {
enable = true;
};

View File

@ -65,6 +65,10 @@ in
map global user l %{: enter-user-mode lsp<ret>} -docstring "LSP mode"
set-face global Default rgb:ebdbb2,default
set-face global StatusLine rgb:ebdbb2,default
set-face global BufferPadding rgb:504945,default
# require-module powerline
# powerline-start
# powerline-theme gruvbox

View File

@ -14,7 +14,7 @@ in
};
colors = {
alpha = "0.95";
alpha = "0.70";
background = "${colors.base00}";
foreground = "${colors.base06}";
regular0 = "${colors.base01}";

View File

@ -11,7 +11,7 @@ let
wallpaper = "/mnt/hdd/Wallpapers/florest-stair2.jpg";
wob-voldaemon = pkgs.writeShellScriptBin "wob-volumedaemon.sh" ''
wob-voldaemon = pkgs.writeShellScriptBin "wob-volumeindicator.sh" ''
if pgrep "wob"; then
killall wob &> /dev/null
fi
@ -79,10 +79,10 @@ in
general {
gaps_in = 10
border_size = 2
border_size = 4
col.active_border = rgba(${colors.base0F}FF)
col.inactive_border = rgba(${colors.base00}FF)
col.inactive_border = rgba(${colors.base00}B3)
}
dwindle {
@ -95,31 +95,28 @@ in
}
misc {
no_vfr = yes
vfr = true
vrr = 2
}
decoration {
rounding = 4
rounding = 10
blur = yes
blur_size = 3
blur_passes = 1
blur_passes = 2
blur_new_optimizations = on
drop_shadow = yes
shadow_range = 12
shadow_render_power = 1
shadow_offset = 5 5
col.shadow = rgba(00000099)
col.shadow = rgba(${colors.base00}99)
}
animations {
enabled = yes
# Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
animation = windows, 1, 5, default
animation = windowsOut, 1, 5, default
animation = border, 1, 8, default
@ -130,11 +127,11 @@ in
exec-once = ${pkgs.waybar}/bin/waybar
exec-once = ${pkgs.swaybg}/bin/swaybg -i ${wallpaper} -m fill
exec-once = ${pkgs.openrgb}/bin/openrgb --server --profile autorun.orp
exec-once = ${pkgs.openrgb}/bin/openrgb --startminimized --profile autorun.orp
exec-once = ${pkgs.networkmanagerapplet}/bin/nm-applet --indicator
exec-once = ${pkgs.blueman}/bin/blueman-applet
exec = ${wob-voldaemon}/bin/wob-volumedaemon.sh;
exec = ${wob-voldaemon}/bin/wob-volumeindicator.sh;
exec = ${xwaylandSetPrimary}/bin/xwayland-setprimary.sh
#keybinds
@ -192,12 +189,14 @@ in
bind = , Print, exec, ${pkgs.grimblast}/bin/grimblast -c --notify copy screen
bind = ${modKey}, Print, exec, ${pkgs.grimblast}/bin/grimblast -c --notify copy active
bind = ${modKey} SHIFT, Print, exec, ${pkgs.grimblast}/bin/grimblast -c --notify copy area
bind = ${modKey}, r, exec, ${pkgs.cinnamon.nemo}/bin/nemo
bind = ${modKey} SHIFT, C, exec, hyprctl reload
windowrulev2 = fullscreen, class:^(hl2_linux)$
'';
};
home.packages = [ pkgs.wl-clipboard ];
home.packages = [ pkgs.wl-clipboard pkgs.wl-clipboard-x11 ];
}

View File

@ -29,8 +29,8 @@ in
position = "top";
height = 32;
modules-left = [ "custom/blank" "wlr/workspaces" ];
modules-center = [ "hyprland/window" ];
modules-left = [ "custom/blank" "hyprland/window" ];
modules-center = [ "wlr/workspaces" "custom/blank" ];
modules-right = [
"custom/ds-battery"
"pulseaudio"
@ -51,6 +51,22 @@ in
on-click = "activate";
on-scroll-up = "hyprctl dispatch workspace e+1";
on-scroll-down = "hyprctl dispatch workspace e-1";
format = "{icon}";
format-icons = {
#active = "";
#default = "";
active = "";
default = "";
};
};
"custom/workspaceborderleft" = {
format = " ";
};
"custom/workspaceborderright" = {
format = " ";
};
"hyprland/window" = {
@ -65,6 +81,7 @@ in
scroll-step = 5;
format = "{icon} {volume}%";
format-icons = [ "" "" "" "" ];
ignored-sinks = [ "Easy Effects Sink" ];
};
"tray" = {
@ -92,6 +109,7 @@ in
@define-color foreground #${colors.base06};
@define-color background #${colors.base00};
@define-color box-bg #${colors.base01};
@define-color workspace-bg #${colors.base00};
label:disabled,
button:disabled {
@ -107,54 +125,61 @@ in
window#waybar {
background: @background;
color: @foreground;
border-bottom: 1px solid @box-bg;
}
#pulseaudio, #mpd, #custom-waybar-mpris, #custom-ds-battery, #window, #keyboard-state {
#pulseaudio, #mpd, #custom-waybar-mpris, #custom-ds-battery, #window, #keyboard-state, #tray, #clock {
background: @box-bg;
padding: 0 10px 0 10px;
margin: 5px 10px 5px 0;
border-radius: 10px;
}
#tray, #clock {
margin: 5px 0 5px 0;
}
window#waybar.empty #window {
background: @background;
}
#tray, #clock {
background: @box-bg;
padding: 0 10px 0 10px;
margin: 5px 0 5px 0;
}
#clock {
margin: 5px 0 5px 0;
}
#workspaces {
background: @box-bg;
color: @foreground;
margin: 5px 0 5px 0;
padding-left: 10px;
}
#workspaces button {
border-radius: 0;
color: @foreground;
background: @background;
background: @box-bg;
padding: 0 5px;
}
#workspaces button:last-child {
background: @box-bg;
border-radius: 0px 10px 10px 0;
}
#workspaces button:first-child {
background: @box-bg;
border-radius: 10px 0px 0px 10px;
}
#workspaces button:only-child {
background: @box-bg;
border-radius: 10px 10px 10px 10px;
}
#workspaces button.active {
border-radius: 0;
color: @foreground;
background: @box-bg;
font-weight: bold;
}
#workspaces button.unfocused {
border-radius: 0;
color: @foreground;
background: @background;
background: @box-bg;
/* background: @box-bg; */
}
'';
};
}

View File

@ -23,11 +23,14 @@
appimage-run
bottom
calcurse
discord-canary
fastfetch
gamescope
gimp
gnome.file-roller
gnome.seahorse
gnome.simple-scan
gnome.gvfs
hyprpaper
lutris
mesa-demos
mesa-demos
@ -38,6 +41,7 @@
pass
pavucontrol
protontricks
sc-im
signal-desktop
sshfs
steam
@ -48,6 +52,7 @@
twemoji-color-font
vulkan-tools
vulkan-validation-layers
webcord
wineWowPackages.stagingFull
wxedid
xdg-utils
@ -57,7 +62,8 @@
home.sessionVariables = {
EDITOR = "kak";
WINEDLLOVERRIDES = "winemenubuilder.exe=d";
#RADV_PERFTEST = "gpl";
RADV_PERFTEST = "gpl";
NIXOS_OZONE_WL = "1";
XDG_SCREENSHOTS_DIR = "~/Screenshots";
};