Created
August 28, 2024 17:00
-
-
Save nyonson/fd51a3ec4b281ca746e539f604b5642f to your computer and use it in GitHub Desktop.
lsp-ai flake
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 = "A flake for lsp-ai, an AI-powered language server"; | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
# The repository is an input of the flake instead of just | |
# grabbing it at build time. This makes some things easier | |
# like referencing the Cargo.lock file. Also ties in to | |
# the flake's implicit reproducibility based on git tags. | |
lsp-ai-src = { | |
url = "github:SilasMarvin/lsp-ai/v0.6.2"; | |
flake = false; | |
}; | |
}; | |
outputs = { self, nixpkgs, lsp-ai-src }: | |
let | |
system = "x86_64-linux"; | |
pkgs = nixpkgs.legacyPackages.${system}; | |
in { | |
packages.${system}.default = pkgs.rustPlatform.buildRustPackage { | |
pname = "lsp-ai"; | |
version = "0.6.2"; | |
src = lsp-ai-src; | |
cargoLock = { | |
lockFile = "${lsp-ai-src}/Cargo.lock"; | |
# Complications with how Nix handles dependencies on other | |
# projects, specifically ones declared with git. Nix needs | |
# to know the exact content of all inputs including dependencies. | |
# This is very explicit. | |
# Can use `nix flake prefetch github:repo-owner/repo-name/commit-or-tag` to | |
# get the tag ahead of time. | |
outputHashes = { | |
"hf-hub-0.3.2" = "sha256-1AcishEVkTzO3bU0/cVBI2hiCFoQrrPduQ1diMHuEwo="; | |
"tree-sitter-zig-0.0.1" = "sha256-UXJCh8GvXzn+sssTrIsLViXD3TiBZhLFABYCKM+fNMQ="; | |
}; | |
}; | |
# Crate in a workspace. | |
buildAndTestSubdir = "crates/lsp-ai"; | |
# Complexities with getting openssl on the path | |
# for a Rust build. The Rust toolchain will sometimes | |
# try and just build the openssl crate itself implicitly | |
# which I guess is nice, but difficult in a super controlled | |
# Nix environment. The flips it to use a pre-built Nix | |
# version. | |
# The pkg-config is used to help find an provide correct compiler and linker flags | |
# can is often needed for openssl. | |
# Native build inputs are present only duruing build time, while build inputs are | |
# present for build time as well as runtime. | |
nativeBuildInputs = with pkgs; [ pkg-config ]; | |
buildInputs = with pkgs; [ openssl ]; | |
OPENSSL_NO_VENDOR = 1; | |
OPENSSL_DIR = "${pkgs.openssl.dev}"; | |
OPENSSL_LIB_DIR = "${pkgs.openssl.out}/lib"; | |
# I am going to trust they are running their checks, | |
# but also find it hard to setup a test environment in Nix. | |
doCheck = false; | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment