Files
moonix/pkgs/displaylink.nix
nevaforget c9ec8e759b fix(thinkpad): Nix fetches the DisplayLink driver itself
nixpkgs builds displaylink with requireFile, so every driver version bump
(6.2.0-30 -> 6.3.0-48) stopped the system build until the zip was put into
the store by hand. pkgs/displaylink.nix overlays requireFile with fetchurl,
taking name and hash from nixpkgs and the URL from its requireFile message.
Applied in nixosModules.moonarch, since the NixOS module reads
pkgs.displaylink directly.
2026-10-14 18:14:48 +02:00

27 lines
1.1 KiB
Nix

# ABOUTME: Overlay that lets Nix fetch the DisplayLink driver itself.
# ABOUTME: Swaps nixpkgs' requireFile for fetchurl, with name, hash and URL taken from nixpkgs.
# nixpkgs builds displaylink with requireFile, so every new driver version
# stops the build until the archive is put into the store by hand. nixpkgs keeps
# name, hash and download URL current, but the URL only appears inside the
# requireFile message ("nix-prefetch-url --name <name> <url>"). Reading it from
# there means nothing in this flake has to be maintained per version. Should
# nixpkgs drop that line, evaluation stops here instead of falling back to the
# manual step.
final: prev: {
displaylink = prev.displaylink.override {
requireFile =
args:
let
url = builtins.match ".*nix-prefetch-url --name [^ ]+ (https://[^[:space:]]+).*" args.message;
in
if url == null then
throw "displaylink: the nixpkgs requireFile message has no direct-download URL any more, see pkgs/displaylink.nix"
else
final.fetchurl {
inherit (args) name hash;
url = builtins.head url;
};
};
}