[Nix-dev] nvidia proprietary / i7 notebook - does not start

Marc Weber marco-oweber at gmx.de
Thu May 11 13:09:57 CEST 2017


This worked, almost:

    ({config, pkgs, ...}: { 
      hardware.bumblebee.enable = true;
      hardware.bumblebee.connectDisplay = true;
      hardware.bumblebee.driver = "nvidia";
      hardware.bumblebee.group = "users";

      hardware.opengl.extraPackages = [ pkgs.vaapiIntel ];
      services.xserver.videoDrivers = ["intel nvidia"]; 
      services.xserver.deviceSection = ''
        BusID "PCI:3:0:0"
        BoardName "GeForce 940MX"
      '';
    })

  (Thanks to github.com/yamafaktory/nixos-configuration)


After applying the GDM patch (.66 nivdia driver), I can start X with the
configuratino above, and glxgears -info shows 79 and 780
fpms/sec depending on whether optirun was used. nvidia shows intel or
nvidia.


nix-shell -p python36Packages.tensorflowWithCuda
then optirun python on

  import tensorflow as tf
  # Creates a graph.
  a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
  b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
  c = tf.matmul(a, b)
  # Creates a session with log_device_placement set to True.
  sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
  # Runs the op.
  print(sess.run(c))

still shows CPU. The nix-shell command worked on a desktop, the test
script worked on ububntu on the same machine. So there is still a small
thing left to explore, but I do no longer have to reboot :)

Thank you very much for helping me.

Should a nixos-hardware-scan be able to detect such cases and write a
configuration like above? Then a nixos-rebuild boot/switch could
'regenerate' the config and warn if your system doesn't match what nixos
expected. Then you can review changes and things just work ?
If there are preferences to be choosen such as nvidia vs nouveau such
choice could be remembered ?

Marc Weber


More information about the nix-dev mailing list