-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdefault.nix
35 lines (35 loc) · 936 Bytes
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{ pkgs ? import ./nix/pkgs.nix
, runTests ? true
}:
let
# sos21-database (that uses sqlx) needs cargo during compilation
cargoMetadataNoDeps = pkgs.writeShellScript "cargo-wrapped" ''
[ "$1" != "metadata" ] && exit 1
shift
${pkgs.cargo}/bin/cargo metadata "$@" --no-deps
'';
cargoNix = pkgs.callPackage ./Cargo.nix {
defaultCrateOverrides = pkgs.defaultCrateOverrides // {
sos21-database = oldAttrs: {
CARGO = "${cargoMetadataNoDeps}";
};
sos21-api-server = oldAttrs: {
src = pkgs.symlinkJoin {
name = "${oldAttrs.crateName}-src";
paths = [ oldAttrs.src ];
postBuild = ''
cp -r ${builtins.path {
name = "git";
path = ./.git;
}} $out/.git
'';
};
};
};
};
in
pkgs.lib.mapAttrs
(_: crate: crate.build.override {
inherit runTests;
})
cargoNix.workspaceMembers