{ description = "A Nix-flake-based Rust development environment"; nixConfig = { extra-substituters = [ "https://nixcache.vlt81.de" ]; extra-trusted-public-keys = [ "nixcache.vlt81.de:nw0FfUpePtL6P3IMNT9X6oln0Wg9REZINtkkI9SisqQ=" ]; }; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; rust-overlay.url = "github:oxalica/rust-overlay"; flake-utils.url = "github:numtide/flake-utils"; devshell.url = "github:numtide/devshell"; npmlock2nix = { url = "github:nix-community/npmlock2nix"; flake = false; }; }; outputs = { self , nixpkgs , rust-overlay , flake-utils , devshell , npmlock2nix , }: flake-utils.lib.eachDefaultSystem (system: let overlays = [ rust-overlay.overlays.default devshell.overlays.default (final: prev: { customRustToolchain = prev.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; }) (final: prev: { npmlock2nix = import npmlock2nix { pkgs = prev; }; }) ]; pkgs = import nixpkgs { inherit system overlays; }; customNodeModules = pkgs.npmlock2nix.v2.node_modules { src = ./.; nodejs = pkgs.nodejs_20; }; buildInputs = with pkgs; [ harfbuzz openssl pango sqlite mariadb zlib clang libclang gzip coreutils glib glibc ]; in { apps.devshell = self.outputs.devShells.${system}.default.flakeApp; packages = { cargo-leptos = pkgs.callPackage ./.nix/cargo-leptos.nix { }; }; devShells.default = pkgs.mkShell { packages = with pkgs; [ customNodeModules customRustToolchain binaryen cacert cargo-bloat cargo-docset cargo-machete cargo-limit cargo-deny cargo-edit cargo-watch cargo-make cargo-udeps self.packages.${system}.cargo-leptos (wasm-bindgen-cli.override { version = "0.2.92"; hash = "sha256-1VwY8vQy7soKEgbki4LD+v259751kKxSxmo/gqE6yV0="; cargoHash = "sha256-aACJ+lYNEU8FFBs158G1/JG8sc6Rq080PeKCMnwdpH0="; }) cargo-outdated cargo-release calc jre8 # needed for xmlls dart-sass fish inotify-tools leptosfmt mold nodejs_20 pkg-config rustywind sccache sqlx-cli unzip ] ++ buildInputs; buildInputs = buildInputs; shellHook = '' # setup node-modules export NPM_LOCAL_PREFIX=${customNodeModules}/node_modules (ln -s $NPM_LOCAL_PREFIX ./node_modules 2>/dev/null || unlink ./node_modules) && ln -s $NPM_LOCAL_PREFIX ./node_modules 2>/dev/null # export NIX_LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}:$NIX_LD_LIBRARY_PATH export LEPTOS_SASS_VERSION=1.71.0 export LEPTOS_TAILWIND_VERSION=3.4.1 export MALLOC_CONF=thp:always,metadata_thp:always ''; }; }); }