From 4f91397c987739cc96e1dd418f79fc0d94326485 Mon Sep 17 00:00:00 2001 From: Rostislav Beneš Date: Sun, 7 May 2017 21:37:56 +0200 Subject: nixos/nvidia: populating /dev with nvidia devices at boot --- nixos/modules/hardware/video/nvidia.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 80abec95c03d..2bad50d65e7a 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -62,11 +62,16 @@ in boot.extraModulePackages = [ nvidia_x11.bin ]; # nvidia-uvm is required by CUDA applications. - boot.kernelModules = [ "nvidia-uvm" ]; + boot.kernelModules = [ "nvidia-uvm" ] ++ + lib.optionals config.services.xserver.enable [ "nvidia" "nvidia_modeset" "nvidia_drm" ]; + # Create /dev/nvidia-uvm when the nvidia-uvm module is loaded. services.udev.extraRules = '' + KERNEL=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidiactl c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 255'" + KERNEL=="nvidia_modeset", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-modeset c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) 254'" + KERNEL=="card*", SUBSYSTEM=="drm", DRIVERS=="nvidia", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia%n c $(grep nvidia-frontend /proc/devices | cut -d \ -f 1) %n'" KERNEL=="nvidia_uvm", RUN+="${pkgs.stdenv.shell} -c 'mknod -m 666 /dev/nvidia-uvm c $(grep nvidia-uvm /proc/devices | cut -d \ -f 1) 0'" ''; -- cgit 1.4.1 From 4ef82339c9a32548d2432ca71e8aac87abe79777 Mon Sep 17 00:00:00 2001 From: Rostislav Beneš Date: Sun, 7 May 2017 22:27:02 +0200 Subject: nixos/gdm,nvidia: new options to enable GDM on Wayland and disabling it for nvidia drivers. --- nixos/modules/hardware/video/nvidia.nix | 6 ++++++ nixos/modules/services/x11/display-managers/gdm.nix | 9 +++++++++ 2 files changed, 15 insertions(+) (limited to 'nixos') diff --git a/nixos/modules/hardware/video/nvidia.nix b/nixos/modules/hardware/video/nvidia.nix index 2bad50d65e7a..52f1773e9c45 100644 --- a/nixos/modules/hardware/video/nvidia.nix +++ b/nixos/modules/hardware/video/nvidia.nix @@ -40,6 +40,12 @@ in { config = mkIf enabled { + assertions = [ + { + assertion = services.xserver.displayManager.gdm.wayland; + message = "NVidia drivers don't support wayland"; + } + ]; services.xserver.drivers = singleton { name = "nvidia"; modules = [ nvidia_x11.bin ]; libPath = [ nvidia_x11 ]; }; diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix index b0a3ff1bb753..e68bc816aad2 100644 --- a/nixos/modules/services/x11/display-managers/gdm.nix +++ b/nixos/modules/services/x11/display-managers/gdm.nix @@ -64,6 +64,14 @@ in }; }; + wayland = mkOption { + default = true; + description = '' + Allow GDM run on Wayland instead of Xserver + ''; + type = types.bool; + }; + }; }; @@ -139,6 +147,7 @@ in # presented and there's a little delay. environment.etc."gdm/custom.conf".text = '' [daemon] + WaylandEnable=${if cfg.gdm.wayland then "true" else "false"} ${optionalString cfg.gdm.autoLogin.enable ( if cfg.gdm.autoLogin.delay > 0 then '' TimedLoginEnable=true -- cgit 1.4.1 From 0cad98dde1cef69e847cb2b1ccfb9c583016a1fb Mon Sep 17 00:00:00 2001 From: Rostislav Beneš Date: Sun, 7 May 2017 23:01:20 +0200 Subject: nixos/xserver,gdm: let GDM handle X server verbosity. --- nixos/modules/services/x11/display-managers/gdm.nix | 1 + nixos/modules/services/x11/xserver.nix | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'nixos') diff --git a/nixos/modules/services/x11/display-managers/gdm.nix b/nixos/modules/services/x11/display-managers/gdm.nix index e68bc816aad2..83c5c95dae7e 100644 --- a/nixos/modules/services/x11/display-managers/gdm.nix +++ b/nixos/modules/services/x11/display-managers/gdm.nix @@ -102,6 +102,7 @@ in # GDM needs different xserverArgs, presumable because using wayland by default. services.xserver.tty = null; services.xserver.display = null; + services.xserver.verbose = null; services.xserver.displayManager.job = { diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 3ce124d3da27..d4fe475690ce 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -480,6 +480,15 @@ in ''; }; + verbose = mkOption { + type = types.nullOr types.int; + default = 3; + example = 7; + description = '' + Controls verbosity of X logging. + ''; + }; + useGlamor = mkOption { type = types.bool; default = false; @@ -631,10 +640,11 @@ in [ "-config ${configFile}" "-xkbdir" "${cfg.xkbDir}" # Log at the default verbosity level to stderr rather than /var/log/X.*.log. - "-verbose" "3" "-logfile" "/dev/null" + "-logfile" "/dev/null" ] ++ optional (cfg.display != null) ":${toString cfg.display}" ++ optional (cfg.tty != null) "vt${toString cfg.tty}" ++ optional (cfg.dpi != null) "-dpi ${toString cfg.dpi}" + ++ optional (cfg.verbose != null) "-verbose ${toString cfg.verbose}" ++ optional (!cfg.enableTCP) "-nolisten tcp" ++ optional (cfg.autoRepeatDelay != null) "-ardelay ${toString cfg.autoRepeatDelay}" ++ optional (cfg.autoRepeatInterval != null) "-arinterval ${toString cfg.autoRepeatInterval}" -- cgit 1.4.1