Nixos-anywhere: error: attribute 'buildDTBs' missing

Hi!

I’m trying to install NixOS on Dell Poweredge R730 using nixos-anywhere. But I get this error:

f user@kaktus 30s 1 nixos-configuration main m -> sudo nix run github:nix-community/nixos-anywhere -- --flake ./#server-0 --target-host root@10.1.0.12
Warning: Identity file /tmp/tmp.20EWJUIAdA/nixos-anywhere not accessible: No such file or directory.
### Uploading install SSH keys ###
/run/current-system/sw/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/tmp/tmp.20EWJUIAdA/nixos-anywhere.pub"
/run/current-system/sw/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/run/current-system/sw/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Warning: Permanently added '10.1.0.12' (ED25519) to the list of known hosts.
(root@10.1.0.12) Password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh -i /tmp/tmp.20EWJUIAdA/nixos-anywhere -o 'IdentitiesOnly=no' -o 'ConnectTimeout=10' -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' 'root@10.1.0.12'"
and check to make sure that only the key(s) you wanted were added.

### Gathering machine facts ###
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added '10.1.0.12' (ED25519) to the list of known hosts.
Warning: Permanently added '10.1.0.12' (ED25519) to the list of known hosts.
error:
       … while calling the 'head' builtin
         at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/lib/attrsets.nix:1719:13:
         1718|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1719|             head values
             |             ^
         1720|           else

       … while evaluating the attribute 'value'
         at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/lib/modules.nix:1149:7:
         1148|     // {
         1149|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1150|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/wlk9a5827bc2pdqisypjkgcv5j72xia8-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `assertions':

       … while evaluating definitions from `/nix/store/wlk9a5827bc2pdqisypjkgcv5j72xia8-source/nixos/modules/hardware/device-tree.nix':

       … while evaluating the option `hardware.deviceTree.enable':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'buildDTBs' missing
       at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/nixos/modules/hardware/device-tree.nix:126:19:
          125|       enable = lib.mkOption {
          126|         default = config.boot.kernelPackages.kernel.buildDTBs;
             |                   ^
          127|         defaultText = lib.literalExpression "config.boot.kernelPackages.kernel.buildDTBs";
f user@kaktus 25s 1 nixos-configuration main ->

I booted up nixos-minimal iso on the server. I downloaded it some time ago, so maybe this iso is too old?

Looking forward for your help:)
Best,
Miro

Might be a nixpkgs bug, best to confirm with a newer iso.

I tried updating channel and rebuilding on that iso, but it didn’t work. I’ll try to redownload fresh iso today!

Okay, I tried fresh iso (today downloaded) and the same error occurs:

f user@kaktus 0s nixos-configuration main -> sudo nix run github:nix-community/nixos-anywhere -- --flake ./#server-0 --target-host root@10.1.0.11
[sudo] password for kazimierzkrauze:
Warning: Identity file /tmp/tmp.42UmNz1w0V/nixos-anywhere not accessible: No such file or directory.
### Uploading install SSH keys ###
/run/current-system/sw/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/tmp/tmp.42UmNz1w0V/nixos-anywhere.pub"
/run/current-system/sw/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/run/current-system/sw/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Warning: Permanently added '10.1.0.11' (ED25519) to the list of known hosts.
(root@10.1.0.11) Password:
Connection closed by 10.1.0.11 port 22
/run/current-system/sw/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/tmp/tmp.42UmNz1w0V/nixos-anywhere.pub"
/run/current-system/sw/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/run/current-system/sw/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
Warning: Permanently added '10.1.0.11' (ED25519) to the list of known hosts.
(root@10.1.0.11) Password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh -i /tmp/tmp.42UmNz1w0V/nixos-anywhere -o 'IdentitiesOnly=no' -o 'ConnectTimeout=10' -o 'IdentitiesOnly=yes' -o 'UserKnownHostsFile=/dev/null' -o 'StrictHostKeyChecking=no' 'root@10.1.0.11'"
and check to make sure that only the key(s) you wanted were added.

### Gathering machine facts ###
Pseudo-terminal will not be allocated because stdin is not a terminal.
Warning: Permanently added '10.1.0.11' (ED25519) to the list of known hosts.
Warning: Permanently added '10.1.0.11' (ED25519) to the list of known hosts.
error:
       … while calling the 'head' builtin
         at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/lib/attrsets.nix:1719:13:
         1718|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1719|             head values
             |             ^
         1720|           else

       … while evaluating the attribute 'value'
         at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/lib/modules.nix:1149:7:
         1148|     // {
         1149|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1150|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/wlk9a5827bc2pdqisypjkgcv5j72xia8-source/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `assertions':

       … while evaluating definitions from `/nix/store/wlk9a5827bc2pdqisypjkgcv5j72xia8-source/nixos/modules/hardware/device-tree.nix':

       … while evaluating the option `hardware.deviceTree.enable':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: attribute 'buildDTBs' missing
       at «github:nixos/nixpkgs/65179426c83bb3f6bc14898b42ea1c6f01d374b0?narHash=sha256-xnJJk%2Bct%2BD2%2BwdRxj1wk36w5zV9RVESwRqcklPdt3fM%3D»/nixos/modules/hardware/device-tree.nix:126:19:
          125|       enable = lib.mkOption {
          126|         default = config.boot.kernelPackages.kernel.buildDTBs;
             |                   ^
          127|         defaultText = lib.literalExpression "config.boot.kernelPackages.kernel.buildDTBs";
f user@kaktus 6m53s 1 nixos-configuration main ->

Any idea how to troubleshoot it further?

I’d actually guess this is a mistake in your configuration. Looks like you’ve set boot.kernelPackages to something that isn’t supposed to go there.

Can you share your configuration?

Sure, I should mention that I didn’t include my confile because it is in multiple files and I don’t know which part is important. boot.kernelPackages is set to pkgs-stable.linuxPackages.

This is my configuration.nix:

{ config, pkgs-stable, pkgs-unstable, lib, inputs, ... }:

{
  imports = [
    ./hardware/hardware-configuration.nix
    ./hardware/disko.nix
    ./users.nix
  ];

  boot = {
    loader = {
      systemd-boot.enable = true;
      efi.canTouchEfiVariables = true;
    };
    kernelPackages = pkgs-stable.linuxPackages;
  };

  zramSwap.enable = true;

  networking = {
    networkmanager.enable = true;
    hostId = "aaaaaaaa";
  };

  console.keyMap = "pl";

  time.timeZone = "Europe/Warsaw";

  i18n = {
    defaultLocale = "en_GB.UTF-8";
    extraLocaleSettings = {
      LC_ADDRESS = "pl_PL.UTF-8";
      LC_IDENTIFICATION = "pl_PL.UTF-8";
      LC_MEASUREMENT = "pl_PL.UTF-8";
      LC_MONETARY = "pl_PL.UTF-8";
      LC_NAME = "pl_PL.UTF-8";
      LC_NUMERIC = "pl_PL.UTF-8";
      LC_PAPER = "pl_PL.UTF-8";
      LC_TELEPHONE = "pl_PL.UTF-8";
      LC_TIME = "pl_PL.UTF-8";
    };
  };

  environment = {
    systemPackages = with pkgs-stable; [
      git
      vim
      pciutils
      htop
      btop
      tree
      yt-dlp
      ncdu
    ];
    variables.EDITOR = "vim";
    sessionVariables.NIXOS_OZONE_WL = "1";
  };

  services = {
    openssh.enable = true;
    clamav = {
      daemon.enable = true;
      updater.enable = true;
    };
  };

  nix = {
    settings = {
      experimental-features = [
        "nix-command"
        "flakes"
      ];
      auto-optimise-store = true;
    };
    gc = {
      automatic = true;
      dates = "daily";
      options = "--delete-older-than 120d";
    };
  };

  networking = {
    interfaces.ens18.ipv4.addresses = [{
      address = "10.100.10.10";
      prefixLength = 8;
    }];
    defaultGateway = "10.0.0.1";
    nameservers = [ "10.0.0.1" ];
    firewall.enable = true;
  };

  system.stateVersion = "24.11"; # Did you read the comment? Yes.
}

This is my flake.nix:

{
  description = "Nixos config flake";

  inputs = {
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
    nixpkgs-24-11.url = "github:nixos/nixpkgs/nixos-24.11";
    nixpkgs-25-05.url = "github:nixos/nixpkgs/nixos-25.05";
    nixpkgs-25-11.url = "github:nixos/nixpkgs/nixos-25.11";
    nixpkgs-26-05.url = "github:nixos/nixpkgs/nixos-26.05";
    nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-26.05";

    nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
    nix-index-db = {
      url = "github:nix-community/nix-index-database";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };
    plasma-manager = {
      url = "github:nix-community/plasma-manager";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
      inputs.home-manager.follows = "home-manager";
    };
    disko = {
      url = "github:nix-community/disko/latest";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    cosmic-manager = {
      url = "github:HeitorAugustoLN/cosmic-manager";
      inputs = {
        nixpkgs.follows = "nixpkgs-unstable";
        home-manager.follows = "home-manager";
      };
    };

    fynedesk.url = "gitlab:miro-zamiro/nixos-fynedesk";
    py_screen_size.url = "gitlab:miro-zamiro/py-screen-size";
    daikokuten.url = "gitlab:miro-zamiro/daikokuten";

    hyprland.url = "github:hyprwm/Hyprland";
  };
  nixConfig = {
    extra-substituters = [
      "https://cache.nixos.org"
      "https://nix-community.cachix.org"
      "https://hyprland.cachix.org"
      "https://cosmic.cachix.org/"
    ];
    extra-trusted-public-keys = [
      "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
      "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
    ];
  };
  outputs = {
    self,
    nixpkgs,
    nixpkgs-unstable,
    nixpkgs-24-11,
    nixpkgs-25-05,
    nixpkgs-26-05,
    nixpkgs-stable,
    nix-flatpak,
    home-manager,
    nix-index-db,
    disko,
    plasma-manager,
    cosmic-manager,
    fynedesk,
    py_screen_size,
    daikokuten,
    ...
  }@inputs:
  let
    system = "x86_64-linux";
    args = {
      inherit inputs;
      inherit system;
      pkgs-unstable = import nixpkgs-unstable {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-24-11 = import nixpkgs-24-11 {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-25-05 = import nixpkgs-25-05 {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-stable = import nixpkgs-stable {
        inherit system;
        config.allowUnfree = true;
      };
    };
    speciArgs = {
      inherit inputs;
      inherit system;
      pkgs-unstable = import nixpkgs-unstable {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-24-11 = import nixpkgs-24-11 {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-25-05 = import nixpkgs-25-05 {
        inherit system;
        config.allowUnfree = true;
      };
      pkgs-stable = import nixpkgs-stable {
        inherit system;
        config.allowUnfree = true;
      };
      flake-inputs = inputs;
    };
    in
  {
    nixosConfigurations = {
### server-0 ###
      server-0 = nixpkgs-unstable.lib.nixosSystem {
        specialArgs = args;
        modules = [
          { nixpkgs.hostPlatform = "x86_64-linux"; }
          home-manager.nixosModules.home-manager
          {
            home-manager = {
              useGlobalPkgs = true;
              useUserPackages = true;
              extraSpecialArgs = args;
              users = {
                user0 = import ./hosts/server-0/home-kazkra.nix;
                user1 = import ./hosts/server-0/home-heljur.nix;
                user2 = import ./hosts/server-0/home-helkaz.nix;
              };
            };
          }
          ./hosts/server-0/configuration.nix
          disko.nixosModules.disko
        ];
      };
    };
  };
}

And this is my disko.nix:

{
  disko.devices = {
    disk = {
      disk0 = {
        type = "disk";
        device = "/dev/disk/by-id/wwn-0x50000398c889e7ed";
        content = {
          type = "gpt";
          partitions = {
            ESP = {
              size = "1G";
              type = "EF00";
              content = {
                type = "filesystem";
                format = "vfat";
                mountpoint = "/boot";
                mountOptions = [ "umask=0077" ];
              };
            };
            swap = {
              size = "7G";
              type = "8200";
              content.type = "swap";
            };
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk1 = {
        type = "disk";
        device = "/dev/disk/by-id/wwn-0x50000398e81ae17d";
        content = {
          type = "gpt";
          partitions = {
            swap = {
              size = "8G";
              type = "8200";
              content.type = "swap";
            };
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
      disk2 = {
        type = "disk";
        device = "/dev/disk/by-id/wwn-0x5000039848182479";
        content = {
          type = "gpt";
          partitions = {
            swap = {
              size = "8G";
              type = "8200";
              content.type = "swap";
            };
            zfs = {
              size = "100%";
              content = {
                type = "zfs";
                pool = "zroot";
              };
            };
          };
        };
      };
    };
    zpool = {
      zroot = {
        type = "zpool";
        mode = "mirror";
        rootFsOptions = {
          compression = "zstd";
          "com.sun:auto-snapshot" = "false";
        };
        datasets = {
          "root" = {
            type = "zfs_fs";
            mountpoint = "/";
            options = {
              "com.sun:auto-snapshot" = "true";
            };
          };
          "root/home" = {
            type = "zfs_fs";
            mountpoint = "/home";
            options = {
              "com.sun:auto-snapshot" = "true";
            };
          };
          "root/home/user0" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user0/Archive" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user0/Documents" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user0/Downloads" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user0/Notes" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user0/Pictures" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };

          "root/home/user1" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user1/Documents" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user1/Downloads" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/home/user1/Pictures" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };

          "root/nix" = {
            type = "zfs_fs";
            mountpoint = "/nix";
            options = {
              "com.sun:auto-snapshot" = "true";
            };
          };
          "root/var" = {
            type = "zfs_fs";
            mountpoint = "/var";
            options."com.sun:auto-snapshot" = "true";
          };

          "root/media" = {
            type = "zfs_fs";
            mountpoint = "/media";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/media/jellyfin" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/media/audiobookshelf" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
          "root/media/immich" = {
            type = "zfs_fs";
            options."com.sun:auto-snapshot" = "true";
          };
        };
      };
    };
  };
}

What you’ve done is try to use kernelPackages from nixos-26.05 with nixos-unstable. This fails because of commit 31d1d80b3fb5ca92da5836376cae81fa523da428 introducing buildDTBs to nixos-unstable.

Thank you!

With unstable it actually works!

1 Like