Merge pull request #136247 from lovesegfault/nvidia-fixes

This commit is contained in:
Bernardo Meurer 2021-08-31 17:57:18 +00:00 committed by GitHub
commit 5abb70031c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 7 deletions

View File

@ -143,6 +143,15 @@ in
'';
};
hardware.nvidia.nvidiaSettings = mkOption {
default = true;
type = types.bool;
description = ''
Whether to add nvidia-settings, NVIDIA's GUI configuration tool, to
systemPackages.
'';
};
hardware.nvidia.nvidiaPersistenced = mkOption {
default = false;
type = types.bool;
@ -279,7 +288,8 @@ in
hardware.opengl.extraPackages = optional offloadCfg.enable nvidia_x11.out;
hardware.opengl.extraPackages32 = optional offloadCfg.enable nvidia_x11.lib32;
environment.systemPackages = [ nvidia_x11.bin nvidia_x11.settings ]
environment.systemPackages = [ nvidia_x11.bin ]
++ optionals nvidiaSettings [ nvidia_x11.settings ]
++ optionals nvidiaPersistencedEnabled [ nvidia_x11.persistenced ];
systemd.packages = optional cfg.powerManagement.enable nvidia_x11.out;

View File

@ -17,10 +17,8 @@ buildPhase() {
# Create the module.
echo "Building linux driver against kernel: $kernel";
cd kernel
sysSrc=$(echo $kernel/lib/modules/$kernelVersion/source)
sysOut=$(echo $kernel/lib/modules/$kernelVersion/build)
unset src # used by the nv makefile
make IGNORE_PREEMPT_RT_PRESENCE=1 NV_BUILD_SUPPORTS_HMM=1 SYSSRC=$sysSrc SYSOUT=$sysOut module -j$NIX_BUILD_CORES
make $makeFlags -j $NIX_BUILD_CORES module
cd ..
fi

View File

@ -75,6 +75,13 @@ let
kernel = if libsOnly then null else kernel.dev;
kernelVersion = if libsOnly then null else kernel.modDirVersion;
makeFlags = optionals (!libsOnly) (kernel.makeFlags ++ [
"IGNORE_PREEMPT_RT_PRESENCE=1"
"NV_BUILD_SUPPORTS_HMM=1"
"SYSSRC=${kernel.dev}/lib/modules/${kernel.modDirVersion}/source"
"SYSOUT=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
]);
hardeningDisable = [ "pic" "format" ];
dontStrip = true;

View File

@ -21,6 +21,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ m4 ];
buildInputs = [ libtirpc ];
inherit (nvidia_x11) makeFlags;
installFlags = [ "PREFIX=$(out)" ];
postFixup = ''

View File

@ -24,7 +24,7 @@ let
cd src/libXNVCtrl
'';
makeFlags = [
makeFlags = nvidia_x11.makeFlags ++ [
"OUTPUTDIR=." # src/libXNVCtrl
];
@ -51,7 +51,7 @@ stdenv.mkDerivation {
++ lib.optionals withGtk3 [ gtk3 librsvg wrapGAppsHook ];
enableParallelBuilding = true;
makeFlags = [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
makeFlags = nvidia_x11.makeFlags ++ [ "NV_USE_BUNDLED_LIBJANSSON=0" ];
installFlags = [ "PREFIX=$(out)" ];
postPatch = lib.optionalString nvidia_x11.useProfiles ''
@ -61,7 +61,7 @@ stdenv.mkDerivation {
preBuild = ''
if [ -e src/libXNVCtrl/libXNVCtrl.a ]; then
( cd src/libXNVCtrl
make
make $makeFlags
)
fi
'';