slab: setup supergfxd in specialisation
This commit is contained in:
parent
dc7ff4cac7
commit
0fd3f6455b
@ -30,6 +30,7 @@
|
|||||||
|
|
||||||
../../system # nixfiles modules
|
../../system # nixfiles modules
|
||||||
./nvidia-optimus.nix
|
./nvidia-optimus.nix
|
||||||
|
./supergfxd.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
specialisation.plasma.configuration = {
|
specialisation.plasma.configuration = {
|
||||||
@ -42,6 +43,8 @@
|
|||||||
services.xserver.displayManager.startx.enable = lib.mkForce false;
|
services.xserver.displayManager.startx.enable = lib.mkForce false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nixfiles.supergfxd.profile = lib.mkDefault "Integrated";
|
||||||
|
|
||||||
# who needs a display manager?
|
# who needs a display manager?
|
||||||
services.displayManager.sddm.enable = false;
|
services.displayManager.sddm.enable = false;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
nvidia.configuration = {
|
nvidia.configuration = {
|
||||||
system.nixos.tags = [ "NVIDIA" ];
|
system.nixos.tags = [ "NVIDIA" ];
|
||||||
|
|
||||||
|
nixfiles.supergfxd.profile = "Hybrid";
|
||||||
|
|
||||||
# Load nvidia driver for Xorg and Wayland
|
# Load nvidia driver for Xorg and Wayland
|
||||||
services.xserver.videoDrivers = ["amdgpu" "nvidia"];
|
services.xserver.videoDrivers = ["amdgpu" "nvidia"];
|
||||||
|
@ -13,18 +13,33 @@ let
|
|||||||
"hotplug_type": "None"
|
"hotplug_type": "None"
|
||||||
}
|
}
|
||||||
'';
|
'';
|
||||||
|
# old def (keeping this here just in case
|
||||||
|
# modprobe = pkgs.writeText "supergfxd-integrated-modprobe" ''
|
||||||
|
# # Automatically generated by supergfxd
|
||||||
|
# blacklist nouveau
|
||||||
|
# alias nouveau off
|
||||||
|
# blacklist nvidia_drm
|
||||||
|
# blacklist nvidia_uvm
|
||||||
|
# blacklist nvidia_modeset
|
||||||
|
# blacklist nvidia
|
||||||
|
# alias nvidia off
|
||||||
|
|
||||||
|
# options nvidia-drm modeset=1
|
||||||
|
# '';
|
||||||
modprobe = pkgs.writeText "supergfxd-integrated-modprobe" ''
|
modprobe = pkgs.writeText "supergfxd-integrated-modprobe" ''
|
||||||
# Automatically generated by supergfxd
|
# Automatically generated by supergfxd
|
||||||
blacklist nouveau
|
blacklist nouveau
|
||||||
alias nouveau off
|
|
||||||
blacklist nvidia_drm
|
blacklist nvidia_drm
|
||||||
blacklist nvidia_uvm
|
blacklist nvidia_uvm
|
||||||
blacklist nvidia_modeset
|
blacklist nvidia_modeset
|
||||||
blacklist nvidia
|
blacklist nvidia
|
||||||
alias nvidia off
|
install nvidia_uvm /bin/false
|
||||||
|
install nvdia_drm /bin/false
|
||||||
|
install nvidia_modeset /bin/false
|
||||||
|
install nvidia /bin/false
|
||||||
|
install nouveau /bin/false
|
||||||
|
|
||||||
options nvidia-drm modeset=1
|
options nvidia-drm modeset=1
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
Hybrid = {
|
Hybrid = {
|
||||||
@ -46,7 +61,6 @@ alias nouveau off
|
|||||||
options nvidia NVreg_DynamicPowerManagement=0x02
|
options nvidia NVreg_DynamicPowerManagement=0x02
|
||||||
|
|
||||||
options nvidia-drm modeset=1
|
options nvidia-drm modeset=1
|
||||||
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -61,17 +75,24 @@ options nvidia-drm modeset=1
|
|||||||
in {
|
in {
|
||||||
options = {
|
options = {
|
||||||
nixfiles.supergfxd.profile = mkOption {
|
nixfiles.supergfxd.profile = mkOption {
|
||||||
type = types.str;
|
type = types.nullOr (types.enum (builtins.attrNames gfx));
|
||||||
default = "";
|
default = null;
|
||||||
example = "Integrated";
|
example = "Integrated";
|
||||||
description = "supergfxd profile to use";
|
description = "supergfxd profile to use";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
etc = mkIf (!(cfg.profile == "")) {
|
environment.etc = mkIf (!(builtins.isNull cfg.profile)) {
|
||||||
# TODO figure out here how to assert if the value is in the gfx attrset
|
|
||||||
# TODO actually configure the system settings here
|
# TODO actually configure the system settings here
|
||||||
|
"supergfxd.conf" = {
|
||||||
|
source = gfx.${cfg.profile}.supergfxd;
|
||||||
|
mode = "0644";
|
||||||
|
};
|
||||||
|
"modprobe.d/supergfxd.conf" = {
|
||||||
|
source = gfx.${cfg.profile}.modprobe;
|
||||||
|
mode = "0644";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user