NixOS not rebuilding on file change

Hello!

As in the title; NixOS isn’t rebuilding when I change an import in the code below from /home/shadowrylander/nixos-hardware/microsoft/surface/xanmod-ck.nix to /home/shadowrylander/nixos-hardware/microsoft/surface/zen-ck.nix:

{ config, lib, pkgs, ... }: with builtins; with lib;

let
  nixos-hardware = builtins.fetchGit { url = "https://github.com/shadowrylander/nixos-hardware.git"; ref = "master"; };
in {
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
      # "${nixos-hardware}/microsoft/surface/xanmod-ck.nix"
      /home/shadowrylander/nixos-hardware/microsoft/surface/zen-ck.nix
    ];

  boot = {
      loader = {
          systemd-boot.enable = true;
          efi = {
              canTouchEfiVariables = true;
              efiSysMountPoint = "/boot/efi";
          };
          grub.copyKernels = true;
      };
      zfs = {
          enableUnstable = true;
          devNodes = "/dev/";
      };
      kernelParams = [ "nohibernate" ];
      initrd.supportedFilesystems = [ "zfs" "bcachefs" ];
      # supportedFilesystems = config.boot.initrd.supportedFilesystems;
      supportedFilesystems = [ "zfs" "bcachefs" ];
  };

  services = {
      udev.extraRules = ''
        ACTION=="add|change", KERNEL=="sd[a-z]*[0-9]*|mmcblk[0-9]*p[0-9]*|nvme[0-9]*n[0-9]*p[0-9]*", ENV{ID_FS_TYPE}=="zfs_member", ATTR{../queue/scheduler}="none"
      ''; # zfs already has its own scheduler. without this my(@Artturin) computer froze for a second when i nix build something.
      zfs = {
          trim.enable = true;
          autoScrub = {
              enable = true;
              pools = [ config.networking.hostName ];
          };
      };
      xserver = {
          enable = true;
          displayManager = {
              startx.enable = true;
              lightdm.enable = mkForce false;
          };
          desktopManager.gnome.enable = true;
          autorun = false;
          libinput.enable = true;
          modules = [ pkgs.xf86_input_wacom ];
          wacom.enable = true;
      };
  };

  nix = {
      useSandbox = false;
      package = pkgs.nixUnstable;
  };

  [ ... ]

  hardware.enableRedistributableFirmware = lib.mkDefault true;

  environment.systemPackages = with pkgs; [
    alacritty
    xfce.thunar
    vlc
  ] ++ (with pkgs.gnome; [
    gnome-session
  ]);

  system.stateVersion = "21.11";
}

However, the files are still different, for surface/zen-ck:

{ config, pkgs, lib, ... }: 
{
    imports = [ ./. ];
    boot.kernelPackages = lib.mkOverride 99 (pkgs.callPackage ./kernel/zen-ck.nix { });
}

And surface/kernel/zen-ck:

{ callPackage, linuxKernel, lib, ... }: let
    kernel = callPackage ./zen.nix { };
in kernel.override {
    argsOverride = rec {
        version = "${kernel.version}-ck";
        modDirVersion = version;
        kernelPatches = (callPackage ./ck.nix { ignores = [
            # "0001-MultiQueue-Skiplist-Scheduler-v0.210.patch"
            # "0002-Unmask-ondemand-and-conservative-and-allow-schedutil.patch"
            # "0003-Make-preemptible-kernel-default.patch"
            # "0004-Create-highres-timeout-variants-of-schedule_timeout-.patch"
            # "0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch"
            # "0006-Convert-msleep-to-use-hrtimers-when-active.patch"
            # "0007-Replace-all-schedule-timeout-1-with-schedule_min_hrt.patch"
            # "0008-Replace-all-calls-to-schedule_timeout_interruptible-.patch"
            # "0009-Replace-all-calls-to-schedule_timeout_uninterruptibl.patch"
            # "0010-Don-t-use-hrtimer-overlay-when-pm_freezing-since-som.patch"
            # "0011-Make-hrtimer-granularity-and-minimum-hrtimeout-confi.patch"
            # "0012-Make-threaded-IRQs-optionally-the-default-which-can-.patch"
            # "0013-Reinstate-default-Hz-of-100-in-combination-with-MuQS.patch"
            # "0014-Swap-sucks.patch"
            # "0015-Make-nohz_full-not-be-picked-up-as-a-default-config-.patch"
            # "0016-Add-ck1-version.patch"
        ]; }) ++ kernel.kernelPatches;
    };
}

And surface/xanmod:

{ config, pkgs, lib, ... }: 
{
    imports = [ ./. ];
    boot.kernelPackages = lib.mkOverride 99 (pkgs.callPackage ./kernel/xanmod-ck.nix { });
}

And surface/kernel/xanmod:

{ callPackage, linuxKernel, lib, ... }: let
    kernel = callPackage ./xanmod.nix { };
in kernel.override {
    argsOverride = rec {
        version = "${kernel.version}-ck";
        modDirVersion = version;
        kernelPatches = (callPackage ./ck.nix { ignores = [
            "0001-MultiQueue-Skiplist-Scheduler-v0.210.patch"
            "0002-Unmask-ondemand-and-conservative-and-allow-schedutil.patch"
            "0003-Make-preemptible-kernel-default.patch"
            # "0004-Create-highres-timeout-variants-of-schedule_timeout-.patch"
            # "0005-Special-case-calls-of-schedule_timeout-1-to-use-the-.patch"
            # "0006-Convert-msleep-to-use-hrtimers-when-active.patch"
            "0007-Replace-all-schedule-timeout-1-with-schedule_min_hrt.patch"
            # "0008-Replace-all-calls-to-schedule_timeout_interruptible-.patch"
            # "0009-Replace-all-calls-to-schedule_timeout_uninterruptibl.patch"
            # "0010-Don-t-use-hrtimer-overlay-when-pm_freezing-since-som.patch"
            "0011-Make-hrtimer-granularity-and-minimum-hrtimeout-confi.patch"
            "0012-Make-threaded-IRQs-optionally-the-default-which-can-.patch"
            # "0013-Reinstate-default-Hz-of-100-in-combination-with-MuQS.patch"
            # "0014-Swap-sucks.patch"
            "0015-Make-nohz_full-not-be-picked-up-as-a-default-config-.patch"
            # "0016-Add-ck1-version.patch"
        ]; }) ++ kernel.kernelPatches;
    };
}

The output is this:

building Nix...
building the system configuration...

And then done.

Any help in resolving this would be greatly appreciated!

How do you pass the changes to nixos-rebuild? How do you reference the files here in your configuration?

Since it’s /etc/nixos/configuration.nix, I use nixos-rebuild boot -I nixpkgs=/home/shadowrylander/nixpkgs/ --option tarball-ttl 0 --show-trace; is that what you were referring to?

That doesn’t seem to refer to your nixos-hardware folder.

How do you use/import what lives there?

It’s in the imports = [ ... ] of my configuration at the beginning, is it not…? /home/shadowrylander/nixos-hardware/microsoft/surface/zen-ck.nix and "${nixos-hardware}/microsoft/surface/xanmod-ck.nix"?

Oh, the first snippet was your configuration? I assumed it was one of the modules in nixos-hardware, as thats whats written straight above it.

Sorry for the confusion!

1 Like

Yes, I too find walls of text difficult to parse. :joy_cat:

No worries, and thanks for your interest in the matter! :smile_cat:

Quick note, however: the surface kernel does not seem to respect boot.kernelPatches either, so that may be linked to this; I made another topic about it here: Modprobe: FATAL: Module bcachefs not found in directory /nix/store/[hash]-linux-5.16.11-modules/lib/modules/5.16.11 - #3 by shadowrylander