143 lines
4 KiB
Nix
143 lines
4 KiB
Nix
{
|
|
description = "Description for the project";
|
|
|
|
inputs = {
|
|
devenv-root = {
|
|
url = "file+file:///dev/null";
|
|
flake = false;
|
|
};
|
|
nixpkgs.url = "github:cachix/devenv-nixpkgs/rolling";
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
|
flake-parts.inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
devenv.url = "github:cachix/devenv";
|
|
nix2container.url = "github:nlewo/nix2container";
|
|
nix2container.inputs.nixpkgs.follows = "nixpkgs";
|
|
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
|
|
|
|
fenix.url = "github:nix-community/fenix/monthly";
|
|
fenix.inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
|
|
nixConfig = {
|
|
extra-trusted-public-keys = [
|
|
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
|
|
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
|
|
];
|
|
extra-substituters = [
|
|
"https://devenv.cachix.org"
|
|
"https://nix-community.cachix.org"
|
|
];
|
|
};
|
|
|
|
outputs =
|
|
inputs@{ flake-parts, devenv-root, ... }:
|
|
flake-parts.lib.mkFlake { inherit inputs; } {
|
|
imports = [
|
|
inputs.devenv.flakeModule
|
|
];
|
|
systems = [
|
|
"x86_64-linux"
|
|
"i686-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-linux"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
perSystem =
|
|
{
|
|
config,
|
|
self',
|
|
inputs',
|
|
pkgs,
|
|
system,
|
|
...
|
|
}:
|
|
{
|
|
devenv.shells.default =
|
|
let
|
|
fnx = inputs'.fenix.packages;
|
|
rustToolchain = fnx.combine [
|
|
fnx.complete.cargo
|
|
fnx.complete.clippy
|
|
fnx.complete.rust-src
|
|
fnx.complete.rustc
|
|
fnx.complete.rustfmt
|
|
fnx.targets.wasm32-unknown-unknown.latest.rust-std
|
|
];
|
|
|
|
wasmBindgen =
|
|
with pkgs;
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "wasm-bindgen-cli";
|
|
version = "0.2.114";
|
|
|
|
src = fetchCrate {
|
|
pname = pname;
|
|
version = version;
|
|
hash = "sha256-xrCym+rFY6EUQFWyWl6OPA+LtftpUAE5pIaElAIVqW0=";
|
|
};
|
|
|
|
cargoDeps = rustPlatform.fetchCargoVendor {
|
|
inherit src;
|
|
inherit (src) pname version;
|
|
hash = "sha256-Z8+dUXPQq7S+Q7DWNr2Y9d8GMuEdSnq00quUR0wDNPM=";
|
|
};
|
|
|
|
nativeBuildInputs = [ pkg-config ];
|
|
|
|
buildInputs = [
|
|
openssl
|
|
]
|
|
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
|
curl
|
|
];
|
|
|
|
nativeCheckInputs = [ nodejs_latest ];
|
|
|
|
# tests require it to be ran in the wasm-bindgen monorepo
|
|
doCheck = false;
|
|
};
|
|
in
|
|
{
|
|
name = "my-project";
|
|
|
|
env = {
|
|
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
|
|
};
|
|
|
|
packages = [
|
|
pkgs.dioxus-cli
|
|
pkgs.cargo-expand
|
|
pkgs.cargo-deny
|
|
pkgs.cargo-nextest
|
|
pkgs.typos
|
|
pkgs.binaryen # wasm-opt
|
|
rustToolchain
|
|
fnx.rust-analyzer
|
|
wasmBindgen
|
|
|
|
pkgs.libxkbcommon
|
|
|
|
pkgs.clang
|
|
pkgs.llvmPackages.libclang
|
|
|
|
];
|
|
|
|
scripts.checkall.exec = ''
|
|
set -xeuo pipefail
|
|
|
|
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
|
cargo deny check all -D warnings
|
|
cargo fmt --all -- --check
|
|
cargo nextest run --workspace --all-targets --all-features --status-level all
|
|
cargo test
|
|
'';
|
|
# DO NOT ENABLE RUST because devenv messes up the ability
|
|
# to build rust-src
|
|
# languages.rust = {};
|
|
};
|
|
|
|
};
|
|
flake = { };
|
|
};
|
|
}
|