cursor-mover-app/flake.nix

143 lines
4 KiB
Nix
Raw Normal View History

2026-02-27 21:30:42 +01:00
{
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 =
{
2026-03-03 18:08:02 +01:00
#config,
#self',
2026-02-27 21:30:42 +01:00
inputs',
pkgs,
2026-03-03 18:08:02 +01:00
#system,
2026-02-27 21:30:42 +01:00
...
}:
{
devenv.shells.default =
let
fnx = inputs'.fenix.packages;
2026-02-28 22:24:42 +01:00
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
];
2026-03-02 22:06:15 +01:00
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;
2026-02-28 22:24:42 +01:00
};
2026-02-27 21:30:42 +01:00
in
{
name = "my-project";
2026-03-02 22:06:15 +01:00
env = {
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
};
2026-02-27 21:30:42 +01:00
packages = [
pkgs.dioxus-cli
pkgs.cargo-expand
pkgs.cargo-deny
pkgs.cargo-nextest
pkgs.typos
2026-03-02 22:06:15 +01:00
pkgs.binaryen # wasm-opt
2026-02-27 21:30:42 +01:00
rustToolchain
fnx.rust-analyzer
2026-02-28 22:24:42 +01:00
wasmBindgen
2026-02-27 21:30:42 +01:00
2026-03-02 22:06:15 +01:00
pkgs.libxkbcommon
2026-02-27 21:30:42 +01:00
];
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
2026-03-03 18:08:02 +01:00
cargo nextest run --workspace --all-targets --all-features --status-level all --no-tests warn
# TODO Doctests
echo "==== checkall success ===="
2026-02-27 21:30:42 +01:00
'';
# DO NOT ENABLE RUST because devenv messes up the ability
# to build rust-src
# languages.rust = {};
};
};
flake = { };
};
}