Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nix): use filesets #772

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,22 @@

# define the packages provided by this flake
packages = let
src = ./.;
fs = lib.fileset;
# nix source files (*.nix)
nixFs = fs.fileFilter (file: file.hasExt == "nix") ./.;
# rust source files
rustFs = fs.unions [
# Cargo.*
(fs.fileFilter (file: lib.hasPrefix "Cargo" file.name) ./.)
# *.rs
(fs.fileFilter (file: file.hasExt "rs") ./.)
# additional files
./.cargo
./rust-toolchain.toml
];
# nvim source files
# all that are not nix, nor rust
nvimFs = fs.difference ./. (fs.union nixFs rustFs);
version = "0.8.2";
in {
blink-fuzzy-lib = let
Expand All @@ -33,7 +48,11 @@
};
in rustPlatform.buildRustPackage {
pname = "blink-fuzzy-lib";
inherit src version;
inherit version;
src = fs.toSource {
root = ./.;
fileset = rustFs;
};
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
Expand All @@ -44,7 +63,11 @@

blink-cmp = pkgs.vimUtils.buildVimPlugin {
pname = "blink-cmp";
inherit src version;
inherit version;
src = fs.toSource {
root = ./.;
fileset = nvimFs;
};
preInstall = ''
mkdir -p target/release
ln -s ${self'.packages.blink-fuzzy-lib}/lib/libblink_cmp_fuzzy.* target/release/
Expand Down