global: rename from faucet

This commit is contained in:
514fpv 2024-01-07 22:01:31 +08:00
parent 785ab73c50
commit d3f97a71e4
Signed by: koishi
SSH key fingerprint: SHA256:axz0uIzzY+5W19i7QOUuiw5LSqhKfCBKPf3L4xFRxLw
31 changed files with 40 additions and 40 deletions

68
global/gui/default.nix Normal file
View file

@ -0,0 +1,68 @@
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.global.gui;
intel = cfg.type == "intel" || (cfg.type == "prime" && config.hardware.nvidia.prime.intelBusId != "");
amdgpu = cfg.type == "amdgpu" || (cfg.type == "prime" && config.hardware.nvidia.prime.amdgpuBusId != "");
nvidia = cfg.type == "nvidia" || cfg.type == "prime";
in {
imports = [
./plymouth.nix
./greetd.nix
];
options.global.gui = {
enable = mkEnableOption "various setup required for GUI and support software";
session = mkEnableOption "software required for a graphical session" // { default = true; };
type = mkOption {
type = with types; enum [ "intel" "amdgpu" "nvidia" "prime" ];
description = "type of graphics acceleration used";
};
};
config = mkIf cfg.enable {
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
# https://nixos.wiki/wiki/Accelerated_Video_Playback
extraPackages = with pkgs; optionals intel [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
] ++ optional nvidia nvidia-vaapi-driver;
};
services.xserver.videoDrivers =
optional nvidia "nvidia" ++
optional (cfg.type == "amdgpu") "amdgpu";
# inhibits default display manager
services.xserver.displayManager.startx.enable = mkDefault true;
hardware.nvidia = mkIf nvidia {
modesetting.enable = true;
nvidiaSettings = true;
prime = mkIf (cfg.type == "prime") {
offload = {
enable = true;
enableOffloadCmd = true;
};
};
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
};
boot.initrd.kernelModules =
optional amdgpu "amdgpu" ++
optional intel "i915";
boot.kernelParams = optional intel "i915.fastboot=1";
};
}

23
global/gui/greetd.nix Normal file
View file

@ -0,0 +1,23 @@
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.global.gui;
in mkIf (cfg.enable && cfg.session) {
programs.regreet = {
enable = true;
cageArgs = [ "-s" "-d" "-m" "last" ];
settings = {
background.path = ../../share/54345906_p0.jpg;
background.fit = "Fill";
GTK = {
application_prefer_dark_theme = true;
cursor_theme_name = "Bibata-Modern-Classic";
icon_theme_name = "WhiteSur-dark";
theme_name = "WhiteSur-Dark";
};
};
};
environment.persistence."/nix/persist/fhs".directories = [ "/var/cache/regreet" ];
}

22
global/gui/plymouth.nix Normal file
View file

@ -0,0 +1,22 @@
{ pkgs
, lib
, config
, ... }: with lib; let
cfg = config.global.gui;
in mkIf cfg.enable {
boot = {
loader.timeout = lib.mkDefault 0;
consoleLogLevel = 0;
initrd.verbose = false;
initrd.systemd.enable = true;
plymouth.enable = true;
kernelParams = [
"quiet"
"splash"
"loglevel=3"
"rd.systemd.show_status=false"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
};
}