From 41bdeb88009dd232808edee9fc0e4ae94358d8d6 Mon Sep 17 00:00:00 2001 From: Arpit Chakladar Date: Sat, 29 Aug 2026 02:02:23 +0530 Subject: refactor: moving script into modules that makes sense - instead of collecting all scripts into modules/scripts we are moving them to modules that makes sense (yazi-file-chooser.sh into yazi) --- modules/lib/default.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 modules/lib/default.nix (limited to 'modules/lib/default.nix') diff --git a/modules/lib/default.nix b/modules/lib/default.nix new file mode 100644 index 0000000..fd54fa2 --- /dev/null +++ b/modules/lib/default.nix @@ -0,0 +1,48 @@ +# Internal aggregation for script modules registered via mkScriptModule +{ + config, + lib, + ... +}: +{ + options.scriptPaths = lib.mkOption { + type = lib.types.listOf (lib.types.listOf lib.types.str); + default = [ ]; + internal = true; + description = "Attr paths of script modules registered via mkScriptModule."; + }; + + config = { + home.packages = lib.filter (p: p != null) ( + map (path: (lib.getAttrFromPath path config).package) config.scriptPaths + ); + + xdg.desktopEntries = lib.listToAttrs ( + map + ( + path: + let + name = lib.last path; + sc = lib.getAttrFromPath path config; + in + lib.nameValuePair name { + name = sc.desktop.displayName; + exec = "${lib.getExe config.terminal.kitty.package} --class ${name} -e ${lib.getExe sc.package}"; + icon = sc.desktop.icon; + categories = [ "Utility" ]; + terminal = false; + type = "Application"; + } + ) + ( + lib.filter ( + path: + let + sc = lib.getAttrFromPath path config; + in + sc.enable && sc.desktop.enable + ) config.scriptPaths + ) + ); + }; +} -- cgit v1.2.3