69 lines
1.6 KiB
Nix
69 lines
1.6 KiB
Nix
{
|
|
description = "A Nix-flake-based Rust development environment";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
|
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
rust-overlay,
|
|
}:
|
|
let
|
|
supportedSystems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
forEachSupportedSystem =
|
|
f:
|
|
nixpkgs.lib.genAttrs supportedSystems (
|
|
system:
|
|
f (rec {
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
overlays = [ (import rust-overlay) ];
|
|
config = {
|
|
allowUnfreePredicate =
|
|
pkg:
|
|
builtins.elem (nixpkgs.lib.getName pkg) [
|
|
"spacetimedb"
|
|
];
|
|
};
|
|
};
|
|
|
|
rustToolchainFor = pkgs: pkgs.rust-bin.fromRustupToolchainFile ./server/rust-toolchain.toml;
|
|
rustToolchain = rustToolchainFor pkgs;
|
|
})
|
|
);
|
|
in
|
|
{
|
|
devShells = forEachSupportedSystem (
|
|
{ pkgs, rustToolchain, ... }:
|
|
{
|
|
default = pkgs.mkShell {
|
|
packages = with pkgs; [
|
|
rustToolchain
|
|
spacetimedb
|
|
binaryen
|
|
pnpm
|
|
nodejs
|
|
oxlint
|
|
eslint
|
|
nixfmt-rfc-style
|
|
typescript
|
|
typescript-language-server
|
|
];
|
|
};
|
|
}
|
|
);
|
|
};
|
|
}
|