Skip to content

Commit d82fd30

Browse files
authored
nix: avoid constant rebuilds of kernel-builder/kernel-abi-check (#478)
Since we switched to a Cargo workspace, the source filter was too lenient, resulting in rebuilds all the time. Fixes #469.
1 parent 2449324 commit d82fd30

5 files changed

Lines changed: 31 additions & 114 deletions

File tree

kernel-abi-check/flake.nix

Lines changed: 0 additions & 58 deletions
This file was deleted.

kernel-builder/flake.nix

Lines changed: 0 additions & 49 deletions
This file was deleted.

nix-builder/pkgs/kernel-abi-check/default.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,17 @@ rustPlatform.buildRustPackage {
2626
|| file.hasExt "rs"
2727
|| file.name == "stable_abi.toml";
2828
in
29-
lib.fileset.toSource {
29+
with lib.fileset;
30+
toSource {
3031
root = ../../..;
31-
fileset = lib.fileset.fileFilter sourceFiles ../../..;
32+
fileset = unions [
33+
../../../Cargo.lock
34+
../../../Cargo.toml
35+
(fileFilter sourceFiles ../../../kernel-abi-check)
36+
# Cargo wants access to the whole workspace.
37+
(fileFilter sourceFiles ../../../kernel-builder)
38+
(fileFilter sourceFiles ../../../kernels-data)
39+
];
3240
};
3341

3442
cargoLock = {

nix-builder/pkgs/kernel-builder/default.nix

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ rustPlatform.buildRustPackage {
2525
file:
2626
file.name == "Cargo.toml"
2727
|| file.name == "Cargo.lock"
28+
|| file.name == "flake.nix"
2829
|| file.name == "pyproject.toml"
2930
|| file.name == "pyproject_universal.toml"
3031
|| file.name == "python_dependencies.json"
@@ -39,15 +40,22 @@ rustPlatform.buildRustPackage {
3940
"md"
4041
"metal"
4142
"mm"
42-
"nix"
4343
"py"
4444
"rs"
4545
"toml"
4646
]);
4747
in
48-
lib.fileset.toSource {
48+
with lib.fileset;
49+
toSource {
4950
root = ../../..;
50-
fileset = lib.fileset.fileFilter sourceFiles ../../..;
51+
fileset = unions [
52+
../../../Cargo.lock
53+
../../../Cargo.toml
54+
(fileFilter sourceFiles ../../../kernel-builder)
55+
# Cargo wants access to the whole workspace.
56+
(fileFilter sourceFiles ../../../kernel-abi-check)
57+
(fileFilter sourceFiles ../../../kernels-data)
58+
];
5159
};
5260

5361
cargoLock = {

nix-builder/pkgs/python-modules/kernel-abi-check/default.nix

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,17 @@ buildPythonPackage {
3030
|| file.hasExt "rs"
3131
|| file.name == "stable_abi.toml";
3232
in
33-
lib.fileset.toSource {
33+
with lib.fileset;
34+
toSource {
3435
root = ../../../..;
35-
fileset = lib.fileset.fileFilter sourceFiles ../../../..;
36+
fileset = unions [
37+
../../../../Cargo.lock
38+
../../../../Cargo.toml
39+
(fileFilter sourceFiles ../../../../kernel-abi-check)
40+
# Cargo wants access to the whole workspace.
41+
(fileFilter sourceFiles ../../../../kernel-builder)
42+
(fileFilter sourceFiles ../../../../kernels-data)
43+
];
3644
};
3745

3846
cargoDeps = rustPlatform.importCargoLock {

0 commit comments

Comments
 (0)