Created
February 16, 2026 09:07
-
-
Save mausch/d64942808b64042da1dafb66e1f31032 to your computer and use it in GitHub Desktop.
colgrep.nix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| description = "ColGREP - Semantic code search powered by ColBERT"; | |
| inputs = { | |
| nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
| flake-utils.url = "github:numtide/flake-utils"; | |
| rust-overlay = { | |
| url = "github:oxalica/rust-overlay"; | |
| inputs.nixpkgs.follows = "nixpkgs"; | |
| }; | |
| }; | |
| outputs = { self, nixpkgs, flake-utils, rust-overlay }: | |
| flake-utils.lib.eachDefaultSystem (system: | |
| let | |
| overlays = [ (import rust-overlay) ]; | |
| pkgs = import nixpkgs { | |
| inherit system overlays; | |
| }; | |
| rustToolchain = pkgs.rust-bin.stable.latest.default; | |
| # Platform-specific features | |
| features = if pkgs.stdenv.isDarwin then | |
| [ "accelerate" "coreml" ] | |
| else if pkgs.stdenv.isLinux then | |
| [ "openblas" ] | |
| else | |
| [ ]; | |
| # Platform-specific build inputs | |
| darwinBuildInputs = with pkgs; lib.optionals stdenv.isDarwin [ | |
| darwin.apple_sdk.frameworks.Accelerate | |
| darwin.apple_sdk.frameworks.CoreML | |
| darwin.apple_sdk.frameworks.Foundation | |
| ]; | |
| linuxBuildInputs = with pkgs; lib.optionals stdenv.isLinux [ | |
| openblas | |
| ]; | |
| in | |
| { | |
| packages.default = pkgs.rustPlatform.buildRustPackage rec { | |
| pname = "colgrep"; | |
| version = "1.0.7"; | |
| src = pkgs.fetchFromGitHub { | |
| owner = "lightonai"; | |
| repo = "next-plaid"; | |
| rev = version; # Tag is "1.0.7" not "v1.0.7" | |
| hash = "sha256-zqat1h7xGamXMFJ96d+QiQff9Pm/dHqd8vGMNlrl/2k="; | |
| }; | |
| cargoHash = "sha256-8UtcVqJF87rp7r9genvbeEN8E4sUMrrXRj3GKCLt18U="; | |
| # Build only colgrep binary | |
| cargoBuildFlags = [ "-p" "colgrep" ] ++ | |
| pkgs.lib.optionals (features != []) [ "--features" (pkgs.lib.concatStringsSep "," features) ]; | |
| nativeBuildInputs = with pkgs; [ | |
| pkg-config | |
| rustToolchain | |
| ]; | |
| buildInputs = with pkgs; [ | |
| openssl | |
| ] ++ darwinBuildInputs ++ linuxBuildInputs; | |
| # Skip tests since they may require network access or large models | |
| doCheck = false; | |
| meta = with pkgs.lib; { | |
| description = "Semantic code search for your terminal, built on NextPlaid"; | |
| homepage = "https://github.com/lightonai/next-plaid"; | |
| license = licenses.asl20; | |
| maintainers = [ ]; | |
| mainProgram = "colgrep"; | |
| }; | |
| }; | |
| # Convenience aliases | |
| packages.colgrep = self.packages.${system}.default; | |
| apps.default = { | |
| type = "app"; | |
| program = "${self.packages.${system}.default}/bin/colgrep"; | |
| }; | |
| } | |
| ); | |
| } |
Author
mausch
commented
Feb 16, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment