From 2f39e0ef7ad224f7ab72a3c00e8e1cb2b14241f1 Mon Sep 17 00:00:00 2001 From: Mika Tammi <mika.tammi@unikie.com> Date: Thu, 4 Apr 2024 17:13:42 +0300 Subject: [PATCH] Move the icon path exists check to checkPhase Move the icon path exists check to checkPhase of makeDesktopItem, to remove the IFD. Signed-off-by: Mika Tammi <mika.tammi@unikie.com> --- modules/desktop/graphics/launchers.nix | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/modules/desktop/graphics/launchers.nix b/modules/desktop/graphics/launchers.nix index ccb53a331..29133918c 100644 --- a/modules/desktop/graphics/launchers.nix +++ b/modules/desktop/graphics/launchers.nix @@ -7,16 +7,22 @@ ... }: let toDesktop = elem: - if !builtins.pathExists elem.icon - then throw "The icon's path ${elem.icon} doesn't exist" - else - makeDesktopItem { - inherit (elem) name icon; - genericName = elem.name; - desktopName = elem.name; - comment = "Secured Ghaf Application"; - exec = elem.path; - }; + (makeDesktopItem { + inherit (elem) name icon; + genericName = elem.name; + desktopName = elem.name; + comment = "Secured Ghaf Application"; + exec = elem.path; + }) + .overrideAttrs (prevAttrs: { + checkPhase = + prevAttrs.checkPhase + + '' + + # Check that the icon's path exists + [[ -f "${elem.icon}" ]] || (echo "The icon's path ${elem.icon} doesn't exist" && exit 1) + ''; + }); in pkgs.symlinkJoin { name = "ghaf-desktop-entries";