-
Notifications
You must be signed in to change notification settings - Fork 44
/
mesa.nix
62 lines (55 loc) · 1.98 KB
/
mesa.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ config, lib, pkgs, ... }:
let
inherit (lib) types;
cfg = config.jovian.steamos;
#
# NOTE: to test the patch works, you can `strace` something using mesa.
# It will need to know about a limiter file path though. A bogus path is fine.
#
# ```
# $ GAMESCOPE_LIMITER_FILE=/limiter/is/working strace -P /limiter/is/working glxgears
# openat(AT_FDCWD, "/gamescope/is/working", O_RDONLY) = -1 ENOENT (No such file or directory)
# ```
#
# By using `-P` we can limit the logs to access to that (bogus) path only.
#
in
{
options = {
jovian.steamos = {
enableVendorRadv = lib.mkOption {
type = types.bool;
default = cfg.useSteamOSConfig && config.jovian.hardware.has.amd.gpu;
defaultText = lib.literalExpression "config.jovian.steamos.useSteamOSConfig && config.jovian.hardware.has.amd.gpu";
description = ''
Whether to enable the vendor branch of Mesa RADV.
'';
};
enableMesaPatches = lib.mkOption {
type = types.bool;
default = cfg.useSteamOSConfig;
defaultText = lib.literalExpression "config.jovian.steamos.useSteamOSConfig";
description = ''
Whether to apply the Mesa patches if available.
Currently, they allow the swapchain interval to be changed by
the framerate limiter in gamescope.
'';
};
};
};
config = lib.mkMerge [
# Jupiter Gamescope + radeonsi patches
(lib.mkIf (cfg.enableMesaPatches) {
hardware.opengl.package = pkgs.mesa-radeonsi-jupiter.drivers;
hardware.opengl.package32 = pkgs.pkgsi686Linux.mesa-radeonsi-jupiter.drivers;
})
# Jupiter RADV
(lib.mkIf (cfg.enableVendorRadv) {
hardware.opengl = {
extraPackages = [ (lib.hiPrio pkgs.mesa-radv-jupiter.drivers) ];
extraPackages32 = [ (lib.hiPrio pkgs.pkgsi686Linux.mesa-radv-jupiter.drivers) ];
};
environment.etc."drirc".source = pkgs.mesa-radv-jupiter + "/share/drirc.d/00-radv-defaults.conf";
})
];
}