From eb0b4983a2c8e3a12b3a03120cc3ded5078940d6 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 12 Nov 2025 21:39:33 +0100 Subject: [PATCH] feat: Polyfill attrsWith This restores support for a range EOL versions, which may occasionally be of interest for testing, bisections, etc. --- lib.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib.nix b/lib.nix index 2ff8bb0..76a96e3 100644 --- a/lib.nix +++ b/lib.nix @@ -165,6 +165,11 @@ let }; mkPerSystemOption = mkDeferredModuleOption; + # Polyfill https://github.com/NixOS/nixpkgs/pull/344216 + # Nixpkgs master 2024-12-09, Nixpkgs 25.05 + attrsWith = types.attrsWith or ({ elemType, lazy ? false, placeholder ? "name" }: + if lazy then types.attrsOf elemType else types.lazyAttrsOf elemType); + # Helper function for defining a per-system option that # gets transposed by the usual flake system logic to a # top-level flake attribute. @@ -174,7 +179,7 @@ let options = { flake = flake-parts-lib.mkSubmoduleOptions { ${name} = mkOption { - type = types.attrsWith { + type = attrsWith { elemType = option.type; lazy = true; placeholder = "system";