Adventures in NixOS


Trying out NixOS has been an interesting experience, and breaks away from traditional GNU/Linux distributions that I am normally accustomed to. There's a great emphasis on a configurable system environment, with the ability to roll-back changes, and to mitigate dependency issues. I've also been able to properly use the Wayland display system for the first time, with an NVIDIA GPU exclusively.

The journey to getting Wayland to work exclusively with my dedicated GPU wasn't easy, as Firefox's report by browsing to "about:support" would report the NVIDIA GPU being used, but it was really my integrated AMD Radeon graphics just copying buffers back. I tried the former with the PRIME offloading tool, and by setting webgl to "force enable" in Firefox. The solution was to block/black-list my AMD GPU, and also set the preferred graphics device to external in my BIOS settings.

Blender seems to work well under Wayland, although I have to use a special derivation for CUDA support and launch it with nix-shell cuda-blender-shell.nix.. This was written by shpinog:

{ pkgs ? import <nixpkgs> {config.cudaSupport = true;} }:
pkgs.stdenv.mkDerivation {
  name = "cuda-env-shell";
  buildInputs = with pkgs; [
    cudatoolkit
    blender
  ];
  shellHook = ''
    export CUDA_PATH=${pkgs.cudatoolkit}
    export EXTRA_LDFLAGS="-L/lib -L${pkgs.linuxPackages.nvidia_x11}/lib"
    export EXTRA_CCFLAGS="-I/usr/include"
  '';
}

My next challenge will be to try and install the MINGW cross-compiler toolset, probably through running a MSYS2 shell in Wine. With regards to enabling CUDA support in my nixos system config, I tried but this caused my laptop to become unresponsive. Only Blender really benefits from CUDA for rendering at the moment.

Besides the trials of NixOS, and having to configure stuff properly, I've found it more rewarding than Arch, because of the different mindset.