This commit is contained in:
parent
39ac034de5
commit
53985917c9
3 changed files with 17895 additions and 7113 deletions
6
flake.lock
generated
6
flake.lock
generated
|
@ -80,7 +80,11 @@
|
|||
"cargo2nix",
|
||||
"flake-utils"
|
||||
],
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": [
|
||||
"cargo2nix",
|
||||
"rust-overlay"
|
||||
]
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
|
|
47
flake.nix
47
flake.nix
|
@ -29,34 +29,49 @@
|
|||
};
|
||||
|
||||
inputs.flake-utils.follows = "cargo2nix/flake-utils";
|
||||
inputs.rust-overlay.follows = "cargo2nix/rust-overlay";
|
||||
|
||||
outputs = { self, nixpkgs, cargo2nix, flake-utils, ... }:
|
||||
outputs = { self, nixpkgs, cargo2nix, flake-utils, rust-overlay, ... }:
|
||||
let
|
||||
git_version = self.lastModifiedDate;
|
||||
compile = import ./nix/compile.nix;
|
||||
in
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
};
|
||||
nativeBuild =
|
||||
pkgs.callPackage ./Cargo.nix {
|
||||
release = false;
|
||||
};
|
||||
crossBuild = target:
|
||||
let
|
||||
crossPkgs = import nixpkgs {
|
||||
inherit system;
|
||||
crossSystem = {
|
||||
config = target;
|
||||
};
|
||||
overlays = [ rust-overlay.overlays.default ];
|
||||
};
|
||||
buildRustCrateForPkgs = pkgs: pkgs.buildRustCrate.override {
|
||||
rustc = pkgs.rust-bin.stable."1.77.0".default;
|
||||
cargo = pkgs.rust-bin.stable."1.77.0".default;
|
||||
};
|
||||
in
|
||||
crossPkgs.callPackage ./Cargo.nix {
|
||||
inherit buildRustCrateForPkgs;
|
||||
release = false;
|
||||
};
|
||||
in
|
||||
{
|
||||
packages =
|
||||
let
|
||||
packageFor = target: (compile {
|
||||
inherit system git_version target;
|
||||
pkgsSrc = nixpkgs;
|
||||
cargo2nixOverlay = cargo2nix.overlays.default;
|
||||
release = true;
|
||||
}).workspace.garage { compileMode = "build"; };
|
||||
in
|
||||
{
|
||||
# default = native release build
|
||||
default = packageFor null;
|
||||
# other = cross-compiled, statically-linked builds
|
||||
amd64 = packageFor "x86_64-unknown-linux-musl";
|
||||
i386 = packageFor "i686-unknown-linux-musl";
|
||||
arm64 = packageFor "aarch64-unknown-linux-musl";
|
||||
arm = packageFor "armv6l-unknown-linux-musl";
|
||||
default = nativeBuild.workspaceMembers."garage".build;
|
||||
# cross-platform builds
|
||||
amd64 = (crossBuild "x86_64-linux").workspaceMembers."garage".build;
|
||||
i386 = (crossBuild "i686-linux").workspaceMembers."garage".build;
|
||||
};
|
||||
|
||||
# ---- developpment shell, for making native builds only ----
|
||||
|
|
Loading…
Add table
Reference in a new issue