Home Explore Blog Models CI



nixpkgs

2nd chunk of `nixos/modules/services/hardware/display.md`
e7f24b3a5a1f5c846aba7c58e36ea0147d87f6ba89ad42390000000100000d61
`$out/lib/firmware/edid/` and secondly add that derivation to `hardware.display.edid.packages` NixOS option:

```nix
{
  hardware.display.edid.packages = [
    (pkgs.runCommand "edid-custom" { } ''
      mkdir -p $out/lib/firmware/edid
      base64 -d > "$out/lib/firmware/edid/custom1.bin" <<'EOF'
      <insert your base64 encoded EDID file here `base64 < /sys/class/drm/card0-.../edid`>
      EOF
      base64 -d > "$out/lib/firmware/edid/custom2.bin" <<'EOF'
      <insert your base64 encoded EDID file here `base64 < /sys/class/drm/card1-.../edid`>
      EOF
    '')
  ];
}
```

There are 2 options significantly easing preparation of EDID files:
- `hardware.display.edid.linuxhw`
- `hardware.display.edid.modelines`

## Assigning EDID files to displays {#module-hardware-display-edid-assign}

To assign available custom EDID binaries to your monitor (video output) use `hardware.display.outputs."<NAME>".edid` option.
Under the hood it adds `drm.edid_firmware` entry to `boot.kernelParams` NixOS option for each configured output:

```nix
{
  hardware.display.outputs."VGA-1".edid = "custom1.bin";
  hardware.display.outputs."VGA-2".edid = "custom2.bin";
  /*
    equals:
    boot.kernelParams = [ "drm.edid_firmware=VGA-1:edid/custom1.bin,VGA-2:edid/custom2.bin" ];
  */
}
```

## Pulling files from linuxhw/EDID database {#module-hardware-display-edid-linuxhw}

`hardware.display.edid.linuxhw` utilizes `pkgs.linuxhw-edid-fetcher` to extract EDID files
from <https://github.com/linuxhw/EDID> based on simple string/regexp search identifying exact entries:

```nix
{
  hardware.display.edid.linuxhw."PG278Q_2014" = [
    "PG278Q"
    "2014"
  ];

  /*
    equals:
    hardware.display.edid.packages = [
      (pkgs.linuxhw-edid-fetcher.override {
        displays = {
          "PG278Q_2014" = [ "PG278Q" "2014" ];
        };
      })
    ];
  */
}
```


## Using XFree86 Modeline definitions {#module-hardware-display-edid-modelines}

`hardware.display.edid.modelines` utilizes `pkgs.edid-generator` package allowing you to
conveniently use [`XFree86 Modeline`](https://en.wikipedia.org/wiki/XFree86_Modeline) entries as EDID binaries:

```nix
{
  hardware.display.edid.modelines."PG278Q_60" =
    "    241.50   2560 2608 2640 2720   1440 1443 1448 1481   -hsync +vsync";
  hardware.display.edid.modelines."PG278Q_120" =
    "   497.75   2560 2608 2640 2720   1440 1443 1448 1525   +hsync -vsync";

  /*
    equals:
    hardware.display.edid.packages = [
      (pkgs.edid-generator.overrideAttrs {
        clean = true;
        modelines = ''
          Modeline "PG278Q_60"      241.50   2560 2608 2640 2720   1440 1443 1448 1481   -hsync +vsync
          Modeline "PG278Q_120"     497.75   2560 2608 2640 2720   1440 1443 1448 1525   +hsync -vsync
        '';
      })
    ];
  */
}
```

## Complete example for Asus PG278Q {#module-hardware-display-pg278q}

And finally this is a complete working example for a 2014 (first) batch of [Asus PG278Q monitor with `amdgpu` drivers](https://gitlab.freedesktop.org/drm/amd/-/issues/615#note_1987392):

```nix
{
  hardware.display.edid.modelines."PG278Q_60" =
    "   241.50   2560 2608 2640 2720   1440 1443 1448 1481   -hsync +vsync";
  hardware.display.edid.modelines."PG278Q_120" =
    "  497.75   2560 2608 2640 2720   1440 1443 1448 1525   +hsync -vsync";

  hardware.display.outputs."DP-1".edid = "PG278Q_60.bin";
  hardware.display.outputs."DP-1".mode = "e";
}
```

Title: Advanced EDID Management: Assignment, Database Fetching, and Modeline Generation
Summary
This section details various methods for managing and assigning custom EDID files to displays. It explains how to assign prepared EDID binaries to specific monitor outputs using `hardware.display.outputs."<NAME>".edid`, which translates to `drm.edid_firmware` kernel parameters. Furthermore, it introduces `hardware.display.edid.linuxhw` for fetching EDID files from the linuxhw/EDID database based on search criteria, and `hardware.display.edid.modelines` for generating EDID binaries directly from XFree86 Modeline definitions. A complete example demonstrates how to combine these options for a specific monitor configuration.