From 9c3330b00648b05adfcd37afd9a9410274770550 Mon Sep 17 00:00:00 2001 From: ahuston-0 Date: Mon, 20 May 2024 01:19:21 -0400 Subject: [PATCH] convert if/else to lib.optionals Signed-off-by: ahuston-0 --- lib/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 1115798..dc15a27 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -43,10 +43,9 @@ # lsdir :: Path -> String -> [String] lsdir = dir: - if (builtins.pathExists (dir)) then - (lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir)))) - else - [ ]; + lib.optionals (builtins.pathExists dir) ( + lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir))) + ); # return full paths of all files in a directory #