refactor: get rid of isNvidia
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-03-03 17:34:21 -05:00
parent 477ef7759a
commit 88d5d1bdd8
4 changed files with 6 additions and 11 deletions

View file

@ -6,9 +6,8 @@
}: let }: let
inherit (lib) hasAttr optionals; inherit (lib) hasAttr optionals;
isNvidia = config.hardware.nvidia.modesetting.enable;
jellyPkgs = jellyPkgs =
if isNvidia if config.nvidia.enableCUDA
then pkgs.cudaPackages.pkgs then pkgs.cudaPackages.pkgs
else pkgs; else pkgs;
in { in {

View file

@ -20,7 +20,6 @@
inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors; inherit (import ./setupMonitors.nix {inherit config pkgs;}) setupMonitors;
# Nix stuff # Nix stuff
isNvidia = config.hardware.nvidia.modesetting.enable;
cfgHypr = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland; cfgHypr = config.home-manager.users.${mainUser}.wayland.windowManager.hyprland;
devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings; devices = filterAttrs (n: v: hasPrefix "device:" n) cfgHypr.settings;
@ -44,7 +43,7 @@
attrs); attrs);
in { in {
hyprConf = pkgs.writeText "greetd-hypr-config" ( hyprConf = pkgs.writeText "greetd-hypr-config" (
(optionalString isNvidia (optionalString config.nvidia.enable
/* /*
hyprlang hyprlang
*/ */

View file

@ -7,8 +7,6 @@
}: let }: let
inherit (lib) concatStringsSep optionals; inherit (lib) concatStringsSep optionals;
inherit (config.vars) mainUser; inherit (config.vars) mainUser;
isNvidia = config.hardware.nvidia.modesetting.enable;
in { in {
# SYSTEM CONFIG # SYSTEM CONFIG
imports = [ imports = [
@ -61,7 +59,7 @@ in {
"$XDG_DATA_DIRS" "$XDG_DATA_DIRS"
]}" ]}"
] ]
++ (optionals isNvidia [ ++ (optionals config.nvidia.enable [
"LIBVA_DRIVER_NAME, nvidia" "LIBVA_DRIVER_NAME, nvidia"
"XDG_SESSION_TYPE, wayland" "XDG_SESSION_TYPE, wayland"
"GBM_BACKEND, nvidia-drm" "GBM_BACKEND, nvidia-drm"

View file

@ -4,9 +4,8 @@
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) makeLibraryPath optionalString;
inherit (config.vars) mainUser; inherit (config.vars) mainUser;
isNvidia = config.hardware.nvidia.modesetting.enable;
in { in {
imports = [../dolphin.nix]; imports = [../dolphin.nix];
@ -61,8 +60,8 @@ in {
]; ];
buildInputs = [makeWrapper]; buildInputs = [makeWrapper];
postBuild = '' postBuild = ''
wrapProgram $out/bin/Discord ${lib.optionalString isNvidia wrapProgram $out/bin/Discord ${optionalString config.nvidia.enable
''--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ ''--prefix LD_LIBRARY_PATH : "${makeLibraryPath [
addOpenGLRunpath.driverLink addOpenGLRunpath.driverLink
libglvnd libglvnd
]}"''} \ ]}"''} \