fix examples in flake

This commit is contained in:
Vinzenz Schroeter 2024-11-23 22:57:10 +01:00
parent 843f5a03a6
commit 0fe885e231

View file

@ -54,7 +54,11 @@
lzma lzma
]; ];
makeExample = makeExample =
package: example: {
package,
example,
features ? "",
}:
naersk'.buildPackage { naersk'.buildPackage {
pname = example; pname = example;
cargoBuildOptions = cargoBuildOptions =
@ -68,9 +72,12 @@
nativeBuildInputs = nativeBuildInputs; nativeBuildInputs = nativeBuildInputs;
strictDeps = true; strictDeps = true;
buildInputs = buildInputs; buildInputs = buildInputs;
gitSubmodules = true;
overrideMain = old: { overrideMain = old: {
preConfigure = '' preConfigure = ''
cargo_build_options="$cargo_build_options --example ${example}" cargo_build_options="$cargo_build_options --example ${example} ${
if features == "" then "" else "--features " + features
}"
''; '';
}; };
}; };
@ -95,11 +102,28 @@
in in
rec { rec {
servicepoint = makePackage "servicepoint"; servicepoint = makePackage "servicepoint";
announce = makeExample "servicepoint" "announce"; announce = makeExample {
game-of-life = makeExample "servicepoint" "game_of_life"; package = "servicepoint";
moving-line = makeExample "servicepoint" "moving_line"; example = "announce";
random-brightness = makeExample "servicepoint" "random_brightness"; };
wiping-clear = makeExample "servicepoint" "wiping_clear"; game-of-life = makeExample {
package = "servicepoint";
example = "game_of_life";
features = "rand";
};
moving-line = makeExample {
package = "servicepoint";
example = "moving_line";
};
random-brightness = makeExample {
package = "servicepoint";
example = "random_brightness";
features = "rand";
};
wiping-clear = makeExample {
package = "servicepoint";
example = "wiping_clear";
};
} }
); );