From dc4408b814eba1603e94b4065b8eafc42b6952e7 Mon Sep 17 00:00:00 2001 From: BENDI Date: Mon, 8 Sep 2025 02:03:48 +0200 Subject: [PATCH] feat: cleanup nix build This removes unnecessary build instructions from the nix build recipe It also brings the package definition closer to what nixpkgs packages look like --- flake.nix | 2 +- vicinae.nix => package.nix | 114 ++++++++++++++----------------------- 2 files changed, 43 insertions(+), 73 deletions(-) rename vicinae.nix => package.nix (56%) diff --git a/flake.nix b/flake.nix index 58d5fe104..5b26943e7 100644 --- a/flake.nix +++ b/flake.nix @@ -21,7 +21,7 @@ system: let pkgs = nixpkgs.legacyPackages.${system}; - vicinaePkg = pkgs.callPackage ./vicinae.nix { }; + vicinaePkg = pkgs.callPackage ./package.nix { }; nix-update-script = pkgs.writeShellScriptBin "nix-update-script" '' OLD_API_DEPS_HASH=$(${pkgs.lib.getExe pkgs.nix} eval --raw .#packages.x86_64-linux.default.passthru.apiDeps.hash) OLD_EXT_MAN_DEPS_HASH=$(${pkgs.lib.getExe pkgs.nix} eval --raw .#packages.x86_64-linux.default.passthru.extensionManagerDeps.hash) diff --git a/vicinae.nix b/package.nix similarity index 56% rename from vicinae.nix rename to package.nix index 863aa398d..63c1532d8 100644 --- a/vicinae.nix +++ b/package.nix @@ -1,28 +1,25 @@ { stdenv, - fetchFromGitHub, + lib, cmake, pkg-config, + ninja, + fetchNpmDeps, + npmHooks, + autoPatchelfHook, + + qt6, kdePackages, + + wayland, + minizip, rapidfuzz-cpp, protobuf, grpc-tools, nodejs, - minizip-ng, cmark-gfm, libqalculate, - ninja, - lib, - fetchNpmDeps, - protoc-gen-js, - rsync, - which, - autoPatchelfHook, - writeShellScriptBin, - minizip, - qt6, - typescript, - wayland, + }: let src = ./.; @@ -47,20 +44,22 @@ let src = src + /api; hash = "sha256-7rsaGjs1wMe0zx+/BD1Mx7DQj3IAEZQvdS768jVLl3E="; }; - ts-protoc-gen-wrapper = writeShellScriptBin "protoc-gen-ts_proto" '' - exec node /build/source/vicinae-upstream/api/node_modules/.bin/protoc-gen-ts_proto - ''; # Prepare node_modules for extension-manager folder extensionManagerDeps = fetchNpmDeps { src = src + /extension-manager; hash = "sha256-zoTe/n7PmC7h3bEYFX8OtLKr6T8WA7ijNhAekIhsgLc="; }; + in -stdenv.mkDerivation rec { - name = "vicinae"; +stdenv.mkDerivation (finalAttrs: { + pname = "vicinae"; + version = manifest.tag; inherit src; + passthru = { + inherit apiDeps extensionManagerDeps; + }; cmakeFlags = [ "-DVICINAE_GIT_TAG=${manifest.tag}" @@ -72,92 +71,63 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ - ts-protoc-gen-wrapper - extensionManagerDeps - autoPatchelfHook cmake ninja nodejs pkg-config qt6.wrapQtAppsHook - rapidfuzz-cpp - protoc-gen-js - protobuf - grpc-tools - which - rsync - typescript + autoPatchelfHook ]; buildInputs = [ qt6.qtbase qt6.qtsvg - qt6.qttools qt6.qtwayland - qt6.qtdeclarative - qt6.qt5compat + + protobuf + rapidfuzz-cpp wayland kdePackages.qtkeychain kdePackages.layer-shell-qt - minizip grpc-tools protobuf nodejs - minizip-ng + minizip cmark-gfm libqalculate ]; - configurePhase = '' - cmake -G Ninja -B build $cmakeFlags + postPatch = '' + local postPatchHooks=() + source ${npmHooks.npmConfigHook}/nix-support/setup-hook + npmRoot=api npmDeps=${apiDeps} npmConfigHook + npmRoot=extension-manager npmDeps=${extensionManagerDeps} npmConfigHook ''; - buildPhase = '' - buildDir=$PWD - echo $buildDir - export npm_config_cache=${apiDeps} - cd $buildDir/api - npm i --ignore-scripts - patchShebangs $buildDir/api - npm rebuild --foreground-scripts - export npm_config_cache=${extensionManagerDeps} - cd $buildDir/extension-manager - npm i --ignore-scripts - patchShebangs $buildDir/extension-manager - npm rebuild --foreground-scripts - cd $buildDir - substituteInPlace cmake/ExtensionApi.cmake cmake/ExtensionManager.cmake --replace "COMMAND npm install" "" - cmake --build build - cd $buildDir - ''; - - dontWrapQtApps = true; - preFixup = '' - wrapQtApp "$out/bin/vicinae" --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath buildInputs} - ''; postFixup = '' wrapProgram $out/bin/vicinae \ --prefix PATH : ${ lib.makeBinPath [ nodejs - qt6.qtwayland - wayland (placeholder "out") ] } ''; - installPhase = '' - cmake --install build - ''; + meta = { + description = "A raycast-like, high-performance, native launcher for your desktop"; + longDescription = '' + Vicinae (pronounced "vih-SIN-ay") is a high-performance, native launcher for your desktop — built with C++ and Qt. - meta = with lib; { - description = "A focused launcher for your desktop — native, fast, extensible"; - homepage = "https://github.com/vicinaehq/vicinae"; - license = licenses.gpl3Plus; + It includes a set of built-in modules, and extensions can be developed quickly using fully server-side React/TypeScript — with no browser or Electron involved. + + Inspired by the popular Raycast launcher, Vicinae provides a mostly compatible extension API, allowing reuse of many existing Raycast extensions with minimal modification. + + Vicinae is designed for developers and power users who want fast, keyboard-first access to common system actions — without unnecessary overhead. + ''; + license = lib.licenses.gpl3; mainProgram = "vicinae"; + homepage = "https://github.com/vicinaehq/vicinae"; + # maintainers = with lib.maintainers []; }; - passthru = { - inherit apiDeps extensionManagerDeps; - }; -} +})