Nix: filter src using fileset
Allows reusing already-built derivation when changing files outside the ones defined in the fileset.
This commit is contained in:
parent
aea8132001
commit
5a348fb7df
1 changed files with 25 additions and 9 deletions
|
|
@ -53,12 +53,12 @@
|
||||||
hidpiXWayland ? false,
|
hidpiXWayland ? false,
|
||||||
legacyRenderer ? false,
|
legacyRenderer ? false,
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) baseNameOf foldl' readFile;
|
inherit (builtins) foldl' readFile;
|
||||||
inherit (lib.asserts) assertMsg;
|
inherit (lib.asserts) assertMsg;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.lists) flatten concatLists optional optionals;
|
inherit (lib.lists) flatten concatLists optional optionals;
|
||||||
inherit (lib.sources) cleanSourceWith cleanSource;
|
inherit (lib.strings) makeBinPath optionalString mesonBool mesonEnable trim;
|
||||||
inherit (lib.strings) hasSuffix makeBinPath optionalString mesonBool mesonEnable trim;
|
fs = lib.fileset;
|
||||||
|
|
||||||
adapters = flatten [
|
adapters = flatten [
|
||||||
stdenvAdapters.useMoldLinker
|
stdenvAdapters.useMoldLinker
|
||||||
|
|
@ -75,12 +75,28 @@ in
|
||||||
pname = "hyprland${optionalString debug "-debug"}";
|
pname = "hyprland${optionalString debug "-debug"}";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = cleanSourceWith {
|
src = fs.toSource {
|
||||||
filter = name: _type: let
|
root = ../.;
|
||||||
baseName = baseNameOf (toString name);
|
fileset =
|
||||||
in
|
fs.intersection
|
||||||
! (hasSuffix ".nix" baseName);
|
# allows non-flake builds to only include files tracked by git
|
||||||
src = cleanSource ../.;
|
(fs.gitTracked ../.)
|
||||||
|
(fs.unions [
|
||||||
|
../assets/hyprland-portals.conf
|
||||||
|
../assets/install
|
||||||
|
../hyprctl
|
||||||
|
../hyprland.pc.in
|
||||||
|
../LICENSE
|
||||||
|
../meson_options.txt
|
||||||
|
../protocols
|
||||||
|
../src
|
||||||
|
../systemd
|
||||||
|
../VERSION
|
||||||
|
(fs.fileFilter (file: file.hasExt "1") ../docs)
|
||||||
|
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "desktop") ../example)
|
||||||
|
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
|
||||||
|
(fs.fileFilter (file: file.name == "meson.build") ../.)
|
||||||
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue