Luminescent Dreams

Weekly Ramblings for November 3rd, 2019

January 01, 0001
Along the Tracks, 2019-05

Hello, everyone, and welcome back to another round of my weekly ramblings!

This week I was still a bit under the weather, but I did a lot of work and started setting up my new machine.

NixOS

For me, setting up a machine is a complicated process. I typically run NixOS where I can, and I run MacOS with a Nix overlay when I cannot. For running MacOS, where the OS comes pre-installed and ready on the pre-configured hardware, system setup can take less than half an hour. I have to install nix, clone my nix-shell repository, then run nix-env -i all, and suddenly I have a full system with all of my configuration options.

But, with NixOS, I do not have any configuration options any more. I am having to build from the base system up. My last NixOS machine has been gone for several years, the configuration options on that machine have been lost, and wouldn’t really work on the new machine, anyway.

I went with AMD fo this build, and there were a couple of different quirks that I had to resolve.

  • Thinkpad x395
  • Ryzen 7 processor

First of all, and since this is my first time really dealing with the UEFI boot, be sure to turn off Secure Boot! NixOS cannot be booted in secure mode at this time, so it is very necessary to turn this off. Primary symptom was that I would reach the UEFI boot menu, select a NixOS USB key, and would immediately get back to the UEFI boot menu. This is particularly annoying because there is no error message and no log to check.

Second one is that the stable versions of NixOS ship with a 4.x Linux kernel, and it turns out that recent AMD processors really require a 5.x kernel to resolve quite a few different bugs, especially with ACPI. That meant switching to the latest linux kernel by setting boot.kernelPackages = pkgs.linuxPackages_latest;.

I have done quite a bit in the way of configuring my new system. I have shared my entir NixOS configuration on Github. Relevant options for a Thinkpad probably come down to just these, with everything else being specific more to me.

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;
  boot.kernelPackages = pkgs.linuxPackages_latest;
  boot.kernelModules = [ "kvm-amd" ];
  boot.extraModulePackages = with config.boot.kernelPackages; [ ];

  systemd.services.systemd-udev-settle.serviceConfig.ExecStart = ["" "${pkgs.coreutils}/bin/true"];

  boot.kernelParams = [ "acpi_backlight=none" ];
  programs.light.enable = true;
  services.actkbd = {
    enable = true;
    bindings = [
      { keys = [ 225 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -s sysfs/backlight/amdgpu_bl0 -A 10"; }
      { keys = [ 224 ]; events = [ "key" ]; command = "/run/current-system/sw/bin/light -s sysfs/backlight/amdgpu_bl0 -U 10"; }
    ];
  };

Still got more to do here, as I don’t have the screen locking when I suspend the machine, and sometimes the machine hard locks on suspend instead of actually suspending. But I’ve made progress!

Derivations

It turns out that very few of my MacOS derivations work on NixOS. It appears that on NixOS, the derivation builders generally don’t have internet access, and so derivations that download as part of the build don’t work.

As an example, my derivation for floki depends on running npm install in a normal build script, and that npm install doesn’t have access to the internet.

For some of these, the only thing I shoul need to do is to learn how to use node2nix. But for Floki it gets more complicated because Floki is not a Javascript app, but a Clojure app that compiles to Javacript.


  • all of my development derivations
  • Fitnesstrax
  • Photography tools
  • Steam

I have a lot more to do in order to be fully running on my new machine. Much more than I expected when I started on this, but it is all educational.

Furthermore, I think of it is training, and it certainly gives me more hands-on experience with NixOS that I can share here.

But, I’m running late on this post, so that’s it for this week! I’ll let you know about additional progress over the weekend.