diff --git a/flake.lock b/flake.lock index 3ae64d01f15c..78ca9a9e27cb 100644 --- a/flake.lock +++ b/flake.lock @@ -78,6 +78,26 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1673226411, @@ -98,6 +118,7 @@ "crane": "crane", "flake-parts": "flake-parts", "flake-utils": "flake-utils", + "gitignore": "gitignore", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } diff --git a/flake.nix b/flake.nix index 3d195673b1f0..996cb2c21443 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,10 @@ url = "github:hercules-ci/flake-parts"; inputs.nixpkgs-lib.follows = "nixpkgs"; }; + gitignore = { + url = "github:hercules-ci/gitignore.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; rust-overlay = { url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/nix/all-engines.nix b/nix/all-engines.nix index b0186cc3676b..073bf66f9fdf 100644 --- a/nix/all-engines.nix +++ b/nix/all-engines.nix @@ -1,17 +1,22 @@ -{ craneLib, pkgs, flakeInputs, ... }: +{ pkgs, flakeInputs, lib, ... }: let - srcPath = builtins.path { path = ../.; name = "prisma-engines-workspace-root-path"; }; - src = pkgs.lib.cleanSourceWith { filter = enginesSourceFilter; src = srcPath; }; + srcPath = ../.; + srcFilter = flakeInputs.gitignore.lib.gitignoreFilterWith { + basePath = srcPath; + extraRules = '' + /nix + /flake.* + ''; + }; + src = lib.cleanSourceWith { + filter = srcFilter; + src = srcPath; + name = "prisma-engines-source"; + }; craneLib = flakeInputs.crane.mkLib pkgs; deps = craneLib.vendorCargoDeps { inherit src; }; libSuffix = if pkgs.stdenv.isDarwin then "dylib" else "so"; - - enginesSourceFilter = path: type: (builtins.match "\\.pest$" path != null) || - (builtins.match "\\.README.md$" path != null) || - (builtins.match "^\\.git/HEAD" path != null) || - (builtins.match "^\\.git/refs" path != null) || - (craneLib.filterCargoSources path type != null); in { packages.prisma-engines-deps = deps;