feat(nix): add source filtering

this - along with garnix - should mostly eliminate unneeded (re)builds

Signed-off-by: seth <getchoo@tuta.io>
This commit is contained in:
seth 2023-09-09 15:10:15 -04:00
parent 6aa821df9c
commit 10192c540b
No known key found for this signature in database
GPG Key ID: D31BD0D494BBEE86
3 changed files with 34 additions and 1 deletions

16
flake.lock generated
View File

@ -89,6 +89,21 @@
"type": "github"
}
},
"nix-filter": {
"locked": {
"lastModified": 1693833173,
"narHash": "sha256-hlMABKrGbEiJD5dwUSfnw1CQ3bG7KKwDV+Nx3bEZd7U=",
"owner": "numtide",
"repo": "nix-filter",
"rev": "ac030bd9ba98e318e1f4c4328d60766ade8ebe8b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "nix-filter",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1693626178,
@ -156,6 +171,7 @@
"flake-compat": "flake-compat",
"flake-parts": "flake-parts",
"libnbtplusplus": "libnbtplusplus",
"nix-filter": "nix-filter",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks"
}

View File

@ -4,6 +4,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
nix-filter.url = "github:numtide/nix-filter";
pre-commit-hooks = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";

View File

@ -26,11 +26,27 @@
overlays.default = final: prev: let
version = builtins.substring 0 8 self.lastModifiedDate or "dirty";
filteredSelf = inputs.nix-filter.lib.filter {
root = ../.;
include = [
"buildconfig"
"cmake"
"launcher"
"libraries"
"program_info"
"tests"
../COPYING.md
../CMakeLists.txt
];
};
# common args for prismlauncher evaluations
unwrappedArgs = {
self = filteredSelf;
inherit (inputs) libnbtplusplus;
inherit ((final.darwin or prev.darwin).apple_sdk.frameworks) Cocoa;
inherit self version;
inherit version;
};
in {
prismlauncher-qt5-unwrapped = prev.libsForQt5.callPackage ./pkg unwrappedArgs;