Rust ABI error when building Kernel 6.19.8 ISO installer for Microsoft Surface Pro Gen 6

Continuing the discussion from Linux Surface Kernel Stuck at 6.12.19:

I am trying to build for a Surface Pro Gen 6 Intel and also getting the Rust ABI error for x86-softfloat. I am not sure what the flake should look like here (stable / longterm) or anything else:

flake.nix


{
  description = "Surface-aware NixOS installer ISO";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    nixos-hardware.url = "github:NixOS/nixos-hardware";
  };

  outputs = { self, nixpkgs, nixos-hardware }: {
    nixosConfigurations.iso = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        # Installer base (minimal is fine; switch to graphical if you prefer)
        "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
        # or: "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares.nix"

        # Surface patches + kernel
        nixos-hardware.nixosModules.microsoft-surface-pro-intel
        # (or microsoft-surface-pro-intel if you prefer)
        {
          hardware.microsoft-surface.kernelVersion = "stable";

          environment.systemPackages = with nixpkgs.legacyPackages.x86_64-linux; [
            vim git
          ];
          isoImage.squashfsCompression = "gzip -Xcompression-level 1";
        }
      ];

    };
  };
}

Output:

linux>   HOSTCC  /build/build/tools/bpf/resolve_btfids/ctype.o
linux>   HOSTCC  /build/build/tools/bpf/resolve_btfids/str_error_r.o
linux>   HOSTLD  /build/build/tools/bpf/resolve_btfids/resolve_btfids-in.o
linux>   LINK     resolve_btfids
linux>   RUSTC L rust/core.o
linux>   BINDGEN rust/bindings/bindings_generated.rs
linux>   BINDGEN rust/bindings/bindings_helpers_generated.rs
linux>   CC      rust/helpers/helpers.o
linux>   RUSTC P rust/libpin_init_internal.so
linux>   RUSTC PL rust/libproc_macro2.rlib
linux> error: error loading target specification: rustc-abi: invalid rustc abi: 'x86-softfloat'. allowed values: 'x86-sse2', 'powerpc-spe', 'softfloat' at line 3 column 32
linux>   |
linux>   = help: run `rustc --print target-list` for a list of built-in targets
linux>
linux> make[3]: *** [/nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev/lib/modules/6.19.8/source/rust/Makefile:637: rust/core.o] Error 1
linux> make[3]: *** Waiting for unfinished jobs....
linux> Failed to run rustfmt: No such file or directory (os error 2) (non-fatal, continuing)
linux> Failed to run rustfmt: No such file or directory (os error 2) (non-fatal, continuing)
linux> make[2]: *** [/nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev/lib/modules/6.19.8/source/Makefile:1320: prepare] Error 2
linux> make[1]: *** [/nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev/lib/modules/6.19.8/source/Makefile:248: __sub-make] Error 2
linux> make[1]: Leaving directory '/build/build'
linux> make: *** [Makefile:248: __sub-make] Error 2
error: Cannot build '/nix/store/acip69lxb0rhz9qq8vnr74mnfz9xp806-linux-6.19.8.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev
         /nix/store/5fl71jkybpw1r6xba3pz6sy3bb6s9ilm-linux-6.19.8
         /nix/store/myavsx83qcgrs5kihx3y3xb1aciqxpww-linux-6.19.8-modules
error: Cannot build '/nix/store/acip69lxb0rhz9qq8vnr74mnfz9xp806-linux-6.19.8.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev
         /nix/store/5fl71jkybpw1r6xba3pz6sy3bb6s9ilm-linux-6.19.8
         /nix/store/myavsx83qcgrs5kihx3y3xb1aciqxpww-linux-6.19.8-modules
error: Cannot build '/nix/store/acip69lxb0rhz9qq8vnr74mnfz9xp806-linux-6.19.8.drv'.
       Reason: builder failed with exit code 2.
       Output paths:
         /nix/store/4386qq602y9k7q1cjk1g6anqvwsbgn1g-linux-6.19.8-dev
         /nix/store/5fl71jkybpw1r6xba3pz6sy3bb6s9ilm-linux-6.19.8
         /nix/store/myavsx83qcgrs5kihx3y3xb1aciqxpww-linux-6.19.8-modules
error: Cannot build '/nix/store/ddkkav2ccb7klnb60nisa2vvxrr9i2j7-nixos-minimal-26.11.20261020.02c087f-x86_64-linux.iso.drv'.
       Reason: 1 dependency failed.
       Output paths:
         /nix/store/m8sid3d5dmcy2jmr12p5pg3gb2d72h0m-nixos-minimal-26.11.20261020.02c087f-x86_64-linux.iso

The Rust version (1.99) on unstable is too new for the EOL kernel version being used (6.19.8) as it does not have the upstream patch applied; nor does 6.19.14, the last 6.19 version.

Options are, in order of pragmatism:

  • Use NixOS 26.05, which uses Rust version 1.95.
  • Patch the kernel.
  • Use a LTS kernel that has the patch applied, 6.18.58 has it, for example.

Like this I guess?

{
  description = "Surface-aware NixOS installer ISO";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
    nixos-hardware.url = "github:NixOS/nixos-hardware";
  };

  outputs = { self, nixpkgs, nixos-hardware }: {
    nixosConfigurations.iso = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"
        # or: "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares.nix"

        nixos-hardware.nixosModules.microsoft-surface-pro-intel

          hardware.microsoft-surface.kernelVersion = "stable";  # optional, ignored when kernelPackages is forced

          environment.systemPackages = with pkgs; [
            vim
            git
          ];

          isoImage.squashfsCompression = "gzip -Xcompression-level 1";
        })
      ];
    };
  };
}

The change to your flake input is correct to use NixOS 26.05, but you are missing a { above hardware.microsoft-surface.kernelVersion = "stable";.

To stick to NixOS unstable, you can apply the upstream patch to the kernel like so.

Make a file called fix-rust-gen.patch in the same directory as your flake.nix with the following content:

diff --git a/scripts/generate_rust_target.rs b/scripts/generate_rust_target.rs
index 38b3416..3d657eb 100644
--- a/scripts/generate_rust_target.rs
+++ b/scripts/generate_rust_target.rs
@@ -196,7 +196,9 @@ fn main() {
         }
     } else if cfg.has("X86_64") {
         ts.push("arch", "x86_64");
-        if cfg.rustc_version_atleast(1, 86, 0) {
+	if cfg.rustc_version_atleast(1, 98, 0) {
+	    ts.push("rustc-abi", "softfloat");
+	} else if cfg.rustc_version_atleast(1, 86, 0) {
             ts.push("rustc-abi", "x86-softfloat");
         }
         ts.push(

In your flake.nix add this underneath hardware.microsoft-surface.kernelVersion = "stable";.

boot.kernelPatches = [
  {
    name = "fix-rust-gen";
    patch = ./fix-rust-gen.patch;
  }
];

Thank you @magicquark !

This is a small fix, but ideally the upstream Linux-surface repo already supports 7.2 and NixOS-hardware needs to add this. Currently “stable” and “longterm” are 6.19, which is EOL for some time.

Ugh. @magicquark

I chose the installer from the colorful boot screen and then
I seem to have hit an error during installation (also switched to the plasma6 graphical installer in my flake.nix, but the same error occurred when I made a USB with also the minimal installer in flake.nix above). I.e. both boot, choose install, then same error about exoecting /dev/tpm0

The last line after some init lines on the Surface screen says
Expecting device /dev/tpm0 ...

then it drops to the emergency mode prompt lines

I recommend starting a new topic for this issue; it will be more likely that you get fresh views.

Have you disabled the TPM in the UEFI?

TPM needs to be disabled for NixOS?

No.

I am asking because the error message says Expecting device /dev/tpm0/ ..., so I wonder if you (or another) have disabled the TPM in UEFI. It could be other issues though.

Solved! Had to disable TPM and also rewrite USB with Rufus and use GPT partition scheme and DD mode to write USB.

While this might have allowed you to install, depending on your needs (e.g. if you want measured boot), it is not a good long-term solution. It is just masking another issue.