refactor(gpu)!: rename from gui

This commit is contained in:
514fpv 2024-01-27 22:14:03 +08:00
parent bd6d09034a
commit 978bc19f68
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
14 changed files with 24 additions and 24 deletions

View file

@ -2,7 +2,7 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
cfg = config.global.gui; cfg = config.global.gpu;
intel = cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != ""); intel = cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != "");
amdgpu = cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != ""); amdgpu = cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != "");
@ -13,7 +13,7 @@ in {
./greetd.nix ./greetd.nix
]; ];
options.global.gui = { options.global.gpu = {
enable = mkEnableOption "various setup required for GUI and support software"; enable = mkEnableOption "various setup required for GUI and support software";
session = mkEnableOption "software required for a graphical session" // { default = true; }; session = mkEnableOption "software required for a graphical session" // { default = true; };
type = mkOption { type = mkOption {
@ -77,14 +77,14 @@ in {
specialisation.integratedGraphics = mkIf (cfg.type == "prime") { specialisation.integratedGraphics = mkIf (cfg.type == "prime") {
configuration = { configuration = {
global.gui.type = mkForce (if intel then "intel" else if amdgpu then "amdgpu" else "prime"); global.gpu.type = mkForce (if intel then "intel" else if amdgpu then "amdgpu" else "prime");
boot.blacklistedKernelModules = [ "nouveau" ]; boot.blacklistedKernelModules = [ "nouveau" ];
}; };
}; };
specialisation.withArc = mkIf (cfg.arc != null) { specialisation.withArc = mkIf (cfg.arc != null) {
configuration = { configuration = {
global.gui.arc = mkForce null; global.gpu.arc = mkForce null;
powerManagement.cpuFreqGovernor = mkForce "performance"; powerManagement.cpuFreqGovernor = mkForce "performance";
}; };
}; };

View file

@ -2,7 +2,7 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
cfg = config.global.gui; cfg = config.global.gpu;
in mkIf (cfg.enable && cfg.session) { in mkIf (cfg.enable && cfg.session) {
programs.regreet = { programs.regreet = {
enable = true; enable = true;

View file

@ -2,10 +2,10 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
cfg = config.global.gui; cfg = config.global.gpu;
in mkIf cfg.enable { in mkIf cfg.enable {
boot = { boot = {
loader.timeout = lib.mkDefault 0; loader.timeout = mkDefault 0;
consoleLogLevel = 0; consoleLogLevel = 0;
initrd.verbose = false; initrd.verbose = false;
initrd.systemd.enable = true; initrd.systemd.enable = true;

View file

@ -3,7 +3,7 @@
, config , config
, ... }: with lib; let , ... }: with lib; let
cfg = config.global.io; cfg = config.global.io;
gui = with config.global.gui; enable && session; gui = with config.global.gpu; enable && session;
in { in {
options.global.io = { options.global.io = {
betaflight = mkEnableOption "betaflight udev rules" // { default = true; }; betaflight = mkEnableOption "betaflight udev rules" // { default = true; };

View file

@ -11,7 +11,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
virtualisation.podman = { virtualisation.podman = {
enable = true; enable = true;
enableNvidia = with config.global.gui; mkDefault (type == "prime" || type == "nvidia"); enableNvidia = with config.global.gpu; mkDefault type == "prime" || type == "nvidia";
dockerCompat = true; dockerCompat = true;
}; };

View file

@ -2,7 +2,7 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
gui = with config.global.gui; ( enable && session ); gui = with config.global.gpu; enable && session;
in { in {
users.home.persist.directories = mkIf gui [ ".config/google-chrome" ]; users.home.persist.directories = mkIf gui [ ".config/google-chrome" ];
security.chromiumSuidSandbox.enable = mkIf gui true; security.chromiumSuidSandbox.enable = mkIf gui true;

View file

@ -2,7 +2,7 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
gui = with config.global.gui; ( enable && session ); gui = with config.global.gpu; enable && session;
in { in {
config = { config = {
users.homeModules = [ users.homeModules = [

View file

@ -2,8 +2,8 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
gui = with config.global.gui; ( enable && session ); gui = with config.global.gpu; enable && session;
nvidia = with config.global.gui; ( type == "nvidia" || type == "prime" ); nvidia = with config.global.gpu; type == "nvidia" || type == "prime";
in mkIf gui { in mkIf gui {
services.xserver.displayManager.sessionPackages = [ services.xserver.displayManager.sessionPackages = [
(pkgs.writeTextFile { (pkgs.writeTextFile {

View file

@ -3,7 +3,7 @@
, config , config
, ... }: with lib; let , ... }: with lib; let
cfg = config.home.util; cfg = config.home.util;
gui = with config.global.gui; ( enable && session ); gui = with config.global.gpu; enable && session;
in { in {
options.home.util = { options.home.util = {
minimal = mkEnableOption "minimal system environment with less packages"; minimal = mkEnableOption "minimal system environment with less packages";

View file

@ -2,7 +2,7 @@
, lib , lib
, config , config
, ... }: with lib; let , ... }: with lib; let
gui = with config.global.gui; ( enable && session ); gui = with config.global.gpu; enable && session;
in mkIf gui { in mkIf gui {
programs.virt-manager.enable = true; programs.virt-manager.enable = true;
} }

View file

@ -12,8 +12,8 @@
fs.cryptsetup.uuids.nix = "3905f87f-7b11-49ef-8ddf-f4202c555ffd"; fs.cryptsetup.uuids.nix = "3905f87f-7b11-49ef-8ddf-f4202c555ffd";
fs.cryptsetup.uuids.persist = "b2322f01-1c44-433f-a995-4ddce5845cf9"; fs.cryptsetup.uuids.persist = "b2322f01-1c44-433f-a995-4ddce5845cf9";
boot.lanzaboote = true; boot.lanzaboote = true;
gui.enable = true; gpu.enable = true;
gui.type = "prime"; gpu.type = "prime";
android.enable = true; android.enable = true;
}; };

View file

@ -4,9 +4,9 @@
fs.esp.uuid = "FC6D-75D8"; fs.esp.uuid = "FC6D-75D8";
fs.type = "zfs"; fs.type = "zfs";
boot.lanzaboote = true; boot.lanzaboote = true;
gui.enable = true; gpu.enable = true;
gui.type = "intel"; gpu.type = "intel";
gui.arc = "8086:5691"; gpu.arc = "8086:5691";
android.enable = true; android.enable = true;
}; };

View file

@ -14,8 +14,8 @@
fs.cryptsetup.uuids.nix = "84baa53a-c76d-4716-813a-196f5a53e44d"; fs.cryptsetup.uuids.nix = "84baa53a-c76d-4716-813a-196f5a53e44d";
fs.cryptsetup.uuids.persist = "e31f8b1c-6504-4b43-93dd-997ad17ebf5e"; fs.cryptsetup.uuids.persist = "e31f8b1c-6504-4b43-93dd-997ad17ebf5e";
boot.lanzaboote = true; boot.lanzaboote = true;
gui.enable = true; gpu.enable = true;
gui.type = "prime"; gpu.type = "prime";
asusd.enable = true; asusd.enable = true;
oci.enable = true; oci.enable = true;
}; };

View file

@ -8,8 +8,8 @@
fs.esp.uuid = "6CEB-765A"; fs.esp.uuid = "6CEB-765A";
fs.type = "xfs"; fs.type = "xfs";
fs.store = "b80e8bbe-d1ff-4d2e-ae25-9e9048d67355"; fs.store = "b80e8bbe-d1ff-4d2e-ae25-9e9048d67355";
gui.enable = true; gpu.enable = true;
gui.type = "nvidia"; gpu.type = "nvidia";
}; };
home = { home = {