# Error: after update flake about python3.11-tkinter

**URL:** https://discourse.nixos.org/t/error-after-update-flake-about-python3-11-tkinter/69328
**Category:** Help
**Created:** [September 13, 2025, 10:55am UTC](https://discourse.nixos.org/t/error-after-update-flake-about-python3-11-tkinter/69328 "2025-09-13T10:55:41Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![AMHOAZ](https://discourse.nixos.org/user_avatar/discourse.nixos.org/amhoaz/32/36133_2.png) [@AMHOAZ](https://discourse.nixos.org/u/AMHOAZ)
#### Post date: [September 14, 2025, 9:58am UTC](https://discourse.nixos.org/t/error-after-update-flake-about-python3-11-tkinter/69328/3 "2025-09-14T09:58:58Z")

</div>

### **[SOLVED] HOWTO: Fix `fatal error: tommath.h` during `qemu_full` build on NixOS**

Hi everyone,

I managed to solve this build issue, and I wanted to share the full solution. A big thank you to those who suggested the problem might be related to `qemu`—that was the key. The troubleshooting process was a bit long, so I’ve used an AI to help me write up a clear and detailed explanation for anyone else who runs into this.

#### **The Problem**

When trying to update my NixOS system with `sudo nixos-rebuild switch --flake .#nixos`, the build process would fail with the following error:

```auto
error: builder for '/nix/store/zdi06d8rz9wbsn8hg4dd7k7l6qrhv5zw-python3.11-tkinter-3.11.13.drv' failed with exit code 1;
       ...
       /build/python3.11-tkinter-3.11.13/tk8.6.13/unix/../generic/tk.h:76:11: fatal error: tommath.h: No such file or directory
          76 | # include <tommath.h>
             | ^ ~~~~~~~~~~
       compilation terminated.

```

As the log shows, the core issue was the failure to build the `python3.11-tkinter` package, caused by the missing header file `tommath.h`. This pointed to a missing dependency bug within Nixpkgs.

* * *

#### **Diagnosis Steps**

Since I hadn’t explicitly installed `tkinter`, I needed to find out which package in my `configuration.nix` was pulling in this broken dependency.

**Step 1: Dependency Tracing**

Using the `nix-store -q --referrers` command, I started tracing the dependency chain. I found that `matplotlib` depended on `tkinter`, and other packages depended on `matplotlib`. This manual tracing became too complex.

**Step 2: Identifying the Main Culprit (`qemu_full`)**

I shifted my approach to inspecting my `configuration.nix` directly. The `qemu_full` package stood out as a large application with many potential dependencies and was identified as the prime suspect.

**Step 3: Discovering the First Root Cause (QEMU Docs)**

My investigation revealed that `qemu_full`, by default, builds its own documentation. This created the first problematic dependency chain:

- The documentation build uses the `sphinx` tool.
- `sphinx` (or one of its extensions) requires `matplotlib` for plotting.
- `matplotlib` requires `tkinter` for its GUI backend.

**Chain 1:** `qemu_full` → Documentation Build → `sphinx` → `matplotlib` → `tkinter` (the broken package)

**Step 4: Discovering the Second Root Cause (Ceph Support)**

After disabling the documentation build, the error persisted! The new build log, however, pointed to another failing package: `ceph`.

- The `qemu_full` package also enables support for **Ceph** (a distributed storage system) by default.
- The `ceph` package itself has a complex Python environment, which includes data science libraries.
- These libraries also depend on `matplotlib`, which in turn depends on `tkinter`.

**Chain 2:** `qemu_full` → Ceph Support → `ceph` package → `ceph`’s Python Environment → `matplotlib` → `tkinter`

* * *

#### **Root Cause Analysis**

The direct cause of the error is a bug in the `python3.11-tkinter` package definition in Nixpkgs. However, this broken package was being pulled into my system configuration by `qemu_full` through **two distinct and optional features** :

1. The documentation build process.
2. The default-enabled support for the Ceph distributed storage system.

To fix the build, both of these dependency chains had to be broken.

* * *

#### **The Final Solution**

The solution is to work around the `tkinter` bug by overriding the `qemu_full` package in `configuration.nix` to disable both of these optional features.

Go to your `/etc/nixos/configuration.nix` file and edit the `environment.systemPackages` section as follows:

```nix
// In your /etc/nixos/configuration.nix

environment.systemPackages = with pkgs; [
  # ... other packages you have ...
  
  # qemu_full // REMOVE OR COMMENT OUT THIS LINE
  
  # And add this instead:
  (pkgs.qemu_full.override { 
    enableDocs = false; 
    cephSupport = false; 
  })

  # ... other packages ...
];

```

After applying this change, save the file and rebuild your system with `sudo nixos-rebuild switch`.

##### **Explanation of the Fix**

- **`enableDocs = false;`** : This disables the QEMU documentation build, breaking the first dependency chain related to `sphinx`.
- **`cephSupport = false;`** : This disables support for the Ceph storage system, breaking the second dependency chain.

By doing this, the core `qemu_full` package can be built successfully without pulling in the problematic optional dependencies. The main functionality of the simulator for typical use cases is not affected.

I hope this guide helps others who run into the same issue!

* * *

**Search Keywords:**  
NixOS, build failed, qemu, qemu\_full, tkinter, fatal error, tommath.h, matplotlib, ceph, nixos-rebuild, dependency issue.

---

_[View the full topic](https://discourse.nixos.org/t/error-after-update-flake-about-python3-11-tkinter/69328)._
