Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build!: Fix cross compilation #332

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 11 additions & 40 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,20 @@
};
make-zellij = {
makeRustPlatform,
rustPlatform,
cargo,
rustc,
stdenv,
pkg-config,
protobuf,
openssl,
rust-bin,
patchPlugins ? true,
is_cross ? false,
}:
(
if is_cross
then rustPlatform
else (makeRustPlatform {inherit cargo rustc;})
)
}: let
rustToolchainTOML = rust-bin.fromRustupToolchainFile (
src + /rust-toolchain.toml
);
rustc = rustToolchainTOML;
cargo = rustToolchainTOML;
in
(makeRustPlatform {inherit cargo rustc;})
.buildRustPackage
{
inherit
Expand Down Expand Up @@ -100,9 +99,6 @@
targets = ["wasm32-wasi"];
};

rustc = rustToolchainTOML;
cargo = rustToolchainTOML;

devInputs = [
rustToolchainTOML
pkgs.binaryen
Expand All @@ -125,21 +121,10 @@
packages = rec {
# The default build compiles the plugins from src
default = zellij;
zellij = pkgs.callPackage make-zellij {inherit stdenv rustc cargo;};
zellij = pkgs.callPackage make-zellij {inherit stdenv;};
# The upstream build relies on precompiled binary plugins that are included in the upstream src
zellij-upstream = pkgs.callPackage make-zellij {
inherit stdenv rustc cargo;
patchPlugins = false;
};
# The cross build doesn't use an overlay to always pull in the exact version of rust
# that upstream is using
zellij-cross = pkgs.callPackage make-zellij {
inherit stdenv rustc cargo;
is_cross = true;
};
zellij-cross-upstream = pkgs.callPackage make-zellij {
inherit stdenv rustc cargo;
is_cross = false;
inherit stdenv;
patchPlugins = false;
};
};
Expand All @@ -166,9 +151,7 @@
devShells = {
default = pkgs.mkShell {
inherit name;
# buildInputs;
nativeBuildInputs = devInputs;
# nativeBuildInputs ++ devInputs;
RUST_BACKTRACE = 1;
};
fmtShell = pkgs.mkShell {buildInputs = fmtInputs;};
Expand All @@ -180,8 +163,6 @@
(self.outputs.packages.${system})
default
zellij-upstream
zellij-cross
zellij-cross-upstream
;
inherit
(self.outputs.plugins.${system})
Expand All @@ -200,22 +181,12 @@
default = final: _: {
zellij = final.callPackage make-zellij {};
zellij-upstream = final.callPackage make-zellij {patchPlugins = false;};
zellij-cross = final.callPackage make-zellij {is_cross = true;};
zellij-cross-upstream = final.callPackage make-zellij {
is_cross = false;
patchPlugins = false;
};
};
nightly = final: _: {
zellij-nightly = final.callPackage make-zellij {};
zellij-upstream-nightly = final.callPackage make-zellij {
patchPlugins = false;
};
zellij-cross = final.callPackage make-zellij {is_cross = true;};
zellij-cross-upstream = final.callPackage make-zellij {
is_cross = false;
patchPlugins = false;
};
};
};
};
Expand Down
Loading