diff --git a/flake.lock b/flake.lock index 57fd4c199..c1e45c677 100644 --- a/flake.lock +++ b/flake.lock @@ -75,6 +75,21 @@ "type": "github" } }, + "nix-filter": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1718318537, @@ -109,6 +124,7 @@ "fenix": "fenix", "flake-compat": "flake-compat", "flake-parts": "flake-parts", + "nix-filter": "nix-filter", "nixpkgs": "nixpkgs", "treefmt-nix": "treefmt-nix" } diff --git a/flake.nix b/flake.nix index 963dee119..608b748a1 100644 --- a/flake.nix +++ b/flake.nix @@ -11,6 +11,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + nix-filter.url = "github:numtide/nix-filter"; + crane = { url = "github:ipetkov/crane"; inputs.nixpkgs.follows = "nixpkgs"; @@ -33,6 +35,7 @@ nixpkgs, flake-parts, treefmt-nix, + nix-filter, fenix, crane, ... @@ -64,6 +67,8 @@ cargoToml = builtins.fromTOML (builtins.readFile ./Cargo.toml); rustfmtToml = builtins.fromTOML (builtins.readFile ./rustfmt.toml); + filter = nix-filter.lib; + craneLib = crane.mkLib pkgs; rev = self.shortRev or self.dirtyShortRev or (substring 0 8 self.lastModifiedDate); @@ -74,7 +79,14 @@ commonArgs = { inherit version; - src = self; + src = filter { + root = self; + exclude = [ + "checks" + "doc" + "tests" + ]; + }; env = { PKG_CONFIG_SYSTEMD_SYSTEMDSYSTEMUNITDIR = "${placeholder "out"}/lib/systemd/system";