Skip to content

Commit cc8baea

Browse files
committed
Use fileset to avoid rebuilds
1 parent fe5819e commit cc8baea

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

flake.nix

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,42 @@
77
{ self, nixpkgs }:
88

99
let
10+
inherit (nixpkgs) lib;
11+
1012
supportedSystems = [
1113
"x86_64-linux"
1214
"i686-linux"
1315
"aarch64-linux"
1416
];
15-
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
17+
forAllSystems = lib.genAttrs supportedSystems;
1618

17-
version = nixpkgs.lib.removeSuffix "\n" (builtins.readFile ./version);
19+
version = lib.removeSuffix "\n" (builtins.readFile ./version);
1820
pkgs = nixpkgs.legacyPackages.x86_64-linux;
1921

22+
src = lib.fileset.toSource {
23+
root = ./.;
24+
fileset = lib.fileset.unions [
25+
./COPYING
26+
./Makefile.am
27+
./README.md
28+
./completions
29+
./configure.ac
30+
./m4
31+
./patchelf.1
32+
./patchelf.spec.in
33+
./src
34+
./tests
35+
./version
36+
];
37+
};
38+
2039
patchelfFor =
2140
pkgs:
2241
let
2342
# this is only
2443
in
2544
pkgs.callPackage ./patchelf.nix {
26-
inherit version;
27-
src = self;
45+
inherit version src;
2846
};
2947

3048
in
@@ -38,9 +56,8 @@
3856
hydraJobs = {
3957
tarball = pkgs.releaseTools.sourceTarball rec {
4058
name = "patchelf-tarball";
41-
inherit version;
59+
inherit version src;
4260
versionSuffix = ""; # obsolete
43-
src = self;
4461
preAutoconf = "echo ${version} > version";
4562

4663
# portable configure shouldn't have a shebang pointing to the nix store
@@ -81,7 +98,7 @@
8198
);
8299

83100
# x86_64-linux seems to be only working clangStdenv at the moment
84-
build-sanitized-clang = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (
101+
build-sanitized-clang = lib.genAttrs [ "x86_64-linux" ] (
85102
system:
86103
self.hydraJobs.build-sanitized.${system}.override {
87104
stdenv = nixpkgs.legacyPackages.${system}.llvmPackages_latest.libcxxStdenv;
@@ -119,7 +136,7 @@
119136
glibc = self.packages.${system}.patchelf;
120137
default = self.devShells.${system}.glibc;
121138
}
122-
// nixpkgs.lib.optionalAttrs (system != "i686-linux") {
139+
// lib.optionalAttrs (system != "i686-linux") {
123140
musl = self.packages.${system}.patchelf-musl;
124141
}
125142
);
@@ -145,7 +162,7 @@
145162
NIX_CFLAGS_COMPILE = "-static";
146163
});
147164
}
148-
// nixpkgs.lib.optionalAttrs (system != "i686-linux") {
165+
// lib.optionalAttrs (system != "i686-linux") {
149166
patchelf-musl = patchelfFor nixpkgs.legacyPackages.${system}.pkgsMusl;
150167
}
151168
);

0 commit comments

Comments
 (0)