From 1f99a4c6c3fbfbf60d7a9a5985070dd56670bf04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20=E2=80=9CNiols=E2=80=9D=20Jeannerod?= Date: Fri, 1 Aug 2025 13:09:26 +0200 Subject: [PATCH] =?UTF-8?q?`listToAttrs`=20o=20`map`=20o=20`attrsToList`?= =?UTF-8?q?=20=E2=86=92=20`mapAttrs'`=20(#489)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.fediversity.eu/Fediversity/Fediversity/pulls/489 Reviewed-by: kiara Grouwstra Co-authored-by: Nicolas “Niols” Jeannerod Co-committed-by: Nicolas “Niols” Jeannerod --- infra/flake-part.nix | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/infra/flake-part.nix b/infra/flake-part.nix index 9bfd2269..34bc6e50 100644 --- a/infra/flake-part.nix +++ b/infra/flake-part.nix @@ -14,9 +14,7 @@ let mkOption evalModules filterAttrs - attrsToList - map - listToAttrs + mapAttrs' deepSeq ; inherit (lib.attrsets) genAttrs; @@ -200,27 +198,17 @@ in { pkgs, ... }: { checks = - listToAttrs ( - map ( - { name, value }: - { - name = "nixosConfigurations-${name}"; - value = value.config.system.build.toplevel; - } - ) (attrsToList nixosConfigurations) - ) - // listToAttrs ( - map ( - { name, value }: - { - name = "vmOptions-${name}"; - ## Check that VM options builds/evaluates correctly. `deepSeq e1 - ## e2` evaluates `e1` strictly in depth before returning `e2`. We - ## use this trick because checks need to be derivations, which VM - ## options are not. - value = deepSeq value pkgs.hello; - } - ) (attrsToList vmOptions) - ); + mapAttrs' (name: nixosConfiguration: { + name = "nixosConfigurations-${name}"; + value = nixosConfiguration.config.system.build.toplevel; + }) nixosConfigurations + // mapAttrs' (name: vmOptions: { + name = "vmOptions-${name}"; + ## Check that VM options builds/evaluates correctly. `deepSeq e1 + ## e2` evaluates `e1` strictly in depth before returning `e2`. We + ## use this trick because checks need to be derivations, which VM + ## options are not. + value = deepSeq vmOptions pkgs.hello; + }) vmOptions; }; }