2024-04-25 14:33:59 +03:00
|
|
|
{
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
|
|
|
|
fenix.url = github:nix-community/fenix;
|
|
|
|
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
|
|
|
outputs = { self, nixpkgs, fenix }:
|
|
|
|
let
|
|
|
|
forAllSystems = with nixpkgs.lib; f: foldAttrs mergeAttrs { }
|
|
|
|
(map (s: { ${s} = f s; }) systems.flakeExposed);
|
|
|
|
in
|
|
|
|
{
|
|
|
|
devShell = forAllSystems
|
|
|
|
(system:
|
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
rust = fenix.packages.${system}.fromToolchainFile {
|
|
|
|
dir = ./.;
|
2024-08-22 14:49:12 +03:00
|
|
|
sha256 = "sha256-IeUO263mdpDxBzWTY7upaZqX+ODkuK1JLTHdR3ItlkY=";
|
2024-04-25 14:33:59 +03:00
|
|
|
};
|
2024-10-07 18:50:13 +03:00
|
|
|
isOnLinux = pkgs.lib.hasInfix "linux" system;
|
|
|
|
rust-jni =
|
|
|
|
if isOnLinux then with fenix.packages.${system}; combine [
|
|
|
|
minimal.cargo
|
|
|
|
minimal.rustc
|
|
|
|
targets.x86_64-unknown-linux-musl.latest.rust-std
|
|
|
|
] else fenix.packages.${system}.minimal.toolchain;
|
2024-04-25 14:33:59 +03:00
|
|
|
in
|
2024-07-16 12:55:45 +03:00
|
|
|
pkgs.mkShell rec {
|
|
|
|
buildInputs = with pkgs; [
|
2024-10-07 18:50:13 +03:00
|
|
|
# === Graal dependencies ===
|
|
|
|
libxcrypt-legacy
|
2024-10-30 14:15:37 +03:00
|
|
|
] ++ (if !isOnLinux then [
|
|
|
|
# === macOS-specific dependencies ===
|
|
|
|
darwin.apple_sdk.frameworks.IOKit # Required by `enso-formatter`.
|
|
|
|
darwin.apple_sdk.frameworks.Security # Required by `enso-formatter`.
|
|
|
|
] else [ ]);
|
2024-07-16 12:55:45 +03:00
|
|
|
|
2024-04-25 14:33:59 +03:00
|
|
|
packages = with pkgs; [
|
|
|
|
# === TypeScript dependencies ===
|
2024-07-16 12:55:45 +03:00
|
|
|
nodejs_20
|
2024-04-25 14:33:59 +03:00
|
|
|
corepack
|
|
|
|
# === Electron ===
|
|
|
|
electron
|
|
|
|
# === node-gyp dependencies ===
|
|
|
|
python3
|
|
|
|
gnumake
|
|
|
|
# === WASM parser dependencies ===
|
|
|
|
rust
|
|
|
|
wasm-pack
|
|
|
|
];
|
|
|
|
|
|
|
|
shellHook = ''
|
2024-10-07 18:50:13 +03:00
|
|
|
SHIMS_PATH=$HOME/.local/share/enso/nix-shims
|
2024-04-25 14:33:59 +03:00
|
|
|
# `sccache` can be used to speed up compile times for Rust crates.
|
|
|
|
# `~/.cargo/bin/sccache` is provided by `cargo install sccache`.
|
|
|
|
# `~/.cargo/bin` must be in the `PATH` for the binary to be accessible.
|
2024-07-16 12:55:45 +03:00
|
|
|
export PATH=$SHIMS_PATH:${rust.out}:$HOME/.cargo/bin:$PATH
|
2024-10-07 18:50:13 +03:00
|
|
|
export LD_LIBRARY_PATH="${pkgs.lib.makeLibraryPath buildInputs}:$LD_LIBRARY_PATH"
|
2024-07-16 12:55:45 +03:00
|
|
|
|
2024-10-07 18:50:13 +03:00
|
|
|
# `rustup` shim
|
|
|
|
mkdir -p $SHIMS_PATH
|
|
|
|
cat <<END > $SHIMS_PATH/rustup
|
2024-07-16 12:55:45 +03:00
|
|
|
if [ "\$3" = "x86_64-unknown-linux-musl" ]; then
|
2024-10-07 18:50:13 +03:00
|
|
|
echo 'Installing Nix Rust shims'
|
|
|
|
ln -s ${rust-jni.out}/bin/rustc $SHIMS_PATH
|
|
|
|
ln -s ${rust-jni.out}/bin/cargo $SHIMS_PATH
|
|
|
|
else
|
|
|
|
echo 'Uninstalling Nix Rust shims (if installed)'
|
|
|
|
rm -f $SHIMS_PATH/{rustc,cargo}
|
|
|
|
fi
|
|
|
|
END
|
|
|
|
chmod +x $SHIMS_PATH/rustup
|
|
|
|
# Uninstall shims if already installed
|
|
|
|
$SHIMS_PATH/rustup
|
2024-04-25 14:33:59 +03:00
|
|
|
'';
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|