From 58351e44283ebaf4fa49c4ec1e50754f6ec9ed5e Mon Sep 17 00:00:00 2001 From: NAHO <90870942+trueNAHO@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:18:48 +0200 Subject: [PATCH] lib: eachSystem: optimize hot path by assuming rare --impure usage --- lib.nix | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/lib.nix b/lib.nix index 8afb841..c7a74e8 100644 --- a/lib.nix +++ b/lib.nix @@ -48,17 +48,13 @@ let ) { } ( - systems - ++ + if + !builtins ? currentSystem || builtins.elem builtins.currentSystem systems + then + systems + else # Add the current system if the --impure flag is used. - ( - if - builtins ? currentSystem && !builtins.elem builtins.currentSystem systems - then - [ builtins.currentSystem ] - else - [ ] - ) + systems ++ [ builtins.currentSystem ] ); # eachSystemMap using defaultSystems