From bf6215e0cb9d82d108bcaea6abb1f84f325d8ff0 Mon Sep 17 00:00:00 2001 From: Austin Horstman Date: Thu, 26 Mar 2026 16:15:30 -0500 Subject: [PATCH] vicinae: support local sources for raycast extensions Support extensions without fetchgit, useful when providing the sources from a flake input or derivation for all extensions. Signed-off-by: Austin Horstman --- modules/programs/vicinae.nix | 100 +++++++++++++++++++---------------- 1 file changed, 54 insertions(+), 46 deletions(-) diff --git a/modules/programs/vicinae.nix b/modules/programs/vicinae.nix index 61d7bbb1..7fac8e47 100644 --- a/modules/programs/vicinae.nix +++ b/modules/programs/vicinae.nix @@ -78,6 +78,10 @@ in sha256 = "sha256-G7il8T1L+P/2mXWJsb68n4BCbVKcrrtK8GnBNxzt73Q="; rev = "4d417c2dfd86a5b2bea202d4a7b48d8eb3dbaeb1"; }) + (config.lib.vicinae.mkRayCastExtension { + name = "my-local-raycast-extension"; + src = ./extensions/my-local-raycast-extension; + }) ], ``` ''; @@ -165,57 +169,61 @@ in message = "After version 0.17, if you want to explicitly disable the use of layer shell, you need to set {option}.programs.vicinae.settings.launcher_window.layer_shell.enabled = false."; } ]; - lib.vicinae.mkExtension = ( - { - name, - src, - }: - (pkgs.buildNpmPackage { - inherit name src; - installPhase = '' - runHook preInstall - mkdir -p $out - cp -r /build/.local/share/vicinae/extensions/${name}/* $out/ + lib.vicinae = { + mkExtension = + { + name, + src, + }: + (pkgs.buildNpmPackage { + inherit name src; + inherit (pkgs.importNpmLock) npmConfigHook; + installPhase = '' + runHook preInstall - runHook postInstall - ''; - npmDeps = pkgs.importNpmLock { npmRoot = src; }; - npmConfigHook = pkgs.importNpmLock.npmConfigHook; - }) - ); + mkdir -p $out + cp -r /build/.local/share/vicinae/extensions/${name}/* $out/ - lib.vicinae.mkRayCastExtension = ( - { - name, - sha256, - rev, - }: - let - src = - pkgs.fetchgit { - inherit rev sha256; - url = "https://github.com/raycast/extensions"; - sparseCheckout = [ - "/extensions/${name}" - ]; - } - + "/extensions/${name}"; - in - (pkgs.buildNpmPackage { - inherit name src; - installPhase = '' - runHook preInstall + runHook postInstall + ''; + npmDeps = pkgs.importNpmLock { npmRoot = src; }; + }); - mkdir -p $out - cp -r /build/.config/raycast/extensions/${name}/* $out/ + mkRayCastExtension = + { + name, + src ? null, + rev ? null, + sha256 ? null, + }: + let + resolvedSrc = + if src != null then + src + else + pkgs.fetchgit { + inherit rev sha256; + url = "https://github.com/raycast/extensions"; + sparseCheckout = [ "/extensions/${name}" ]; + } + + "/extensions/${name}"; + in + pkgs.buildNpmPackage { + inherit name; + inherit (pkgs.importNpmLock) npmConfigHook; + src = resolvedSrc; + installPhase = '' + runHook preInstall - runHook postInstall - ''; - npmDeps = pkgs.importNpmLock { npmRoot = src; }; - npmConfigHook = pkgs.importNpmLock.npmConfigHook; - }) - ); + mkdir -p $out + cp -r /build/.config/raycast/extensions/${name}/* $out/ + + runHook postInstall + ''; + npmDeps = pkgs.importNpmLock { npmRoot = resolvedSrc; }; + }; + }; home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];