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",
|
"cargo2nix",
|
||||||
"flake-utils"
|
"flake-utils"
|
||||||
],
|
],
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": [
|
||||||
|
"cargo2nix",
|
||||||
|
"rust-overlay"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-overlay": {
|
"rust-overlay": {
|
||||||
|
|
47
flake.nix
47
flake.nix
|
@ -29,34 +29,49 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
inputs.flake-utils.follows = "cargo2nix/flake-utils";
|
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
|
let
|
||||||
git_version = self.lastModifiedDate;
|
git_version = self.lastModifiedDate;
|
||||||
compile = import ./nix/compile.nix;
|
compile = import ./nix/compile.nix;
|
||||||
in
|
in
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
flake-utils.lib.eachDefaultSystem (system:
|
||||||
let
|
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
|
in
|
||||||
{
|
{
|
||||||
packages =
|
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 = native release build
|
||||||
default = packageFor null;
|
default = nativeBuild.workspaceMembers."garage".build;
|
||||||
# other = cross-compiled, statically-linked builds
|
# cross-platform builds
|
||||||
amd64 = packageFor "x86_64-unknown-linux-musl";
|
amd64 = (crossBuild "x86_64-linux").workspaceMembers."garage".build;
|
||||||
i386 = packageFor "i686-unknown-linux-musl";
|
i386 = (crossBuild "i686-linux").workspaceMembers."garage".build;
|
||||||
arm64 = packageFor "aarch64-unknown-linux-musl";
|
|
||||||
arm = packageFor "armv6l-unknown-linux-musl";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# ---- developpment shell, for making native builds only ----
|
# ---- developpment shell, for making native builds only ----
|
||||||
|
|
Loading…
Add table
Reference in a new issue