ofborg/default.nix

77 lines
1.6 KiB
Nix
Raw Normal View History

2020-05-20 03:19:00 +00:00
{ pkgs ? import ./nix {
2020-05-24 11:11:37 +00:00
overlays = [ (import ./nix/overlay.nix) ];
}
, ofborgCrates ? import ./Cargo.nix {
inherit pkgs;
release = pkgs.stdenv.isDarwin;
}
2020-05-20 03:19:00 +00:00
}:
2020-05-24 11:11:37 +00:00
with ofborgCrates.workspaceMembers;
2020-05-24 11:11:37 +00:00
let
2017-12-05 01:43:40 +00:00
stripDeps = pkg: pkgs.runCommand "${pkg.name}-deps-stripped" {}
''
cp -r ${pkg} $out
chmod -R a+w $out
rm -rf $out/lib
find $out/bin -name '*.d' -delete
chmod -R a-w $out
'';
2020-05-24 11:11:37 +00:00
src = stripDeps ofborg.build;
in
{
2020-05-24 11:11:37 +00:00
inherit ofborgCrates;
ofborg.simple-build = ofborg-simple-build.build;
2020-04-25 12:32:42 +00:00
ofborg.rs = pkgs.runCommand "ofborg-rs-symlink-compat" { inherit src; } ''
mkdir -p $out/bin
for f in $(find $src -type f); do
bn=$(basename "$f")
ln -s "$f" "$out/bin/$bn"
# Rust 1.n? or Cargo starting outputting bins with dashes
# instead of underscores ... breaking all the callers.
if echo "$bn" | grep -q "-"; then
ln -s "$f" "$out/bin/$(echo "$bn" | tr '-' '_')"
fi
done
test -e $out/bin/builder
test -e $out/bin/github_comment_filter
test -e $out/bin/github_comment_poster
test -e $out/bin/log_message_collector
test -e $out/bin/evaluation_filter
# Verify that the outpath contains the version number matching the
# Cargo.toml
2020-05-24 11:11:37 +00:00
if ! grep -q 'version = "${ofborg.build.crateVersion}"' ${./ofborg/Cargo.toml}; then
cat <<EOF
Build failed because you bumped the Cargo
version without regenerating the Cargo.nix.
Run:
nix-shell --run ./nix/update-crates.sh
and commit those changes.
EOF
fi
'';
ofborg.php = import ./php { inherit pkgs; };
2017-11-30 03:32:33 +00:00
}