# rocie - An enterprise grocery management system # # Copyright (C) 2024 Benedikt Peetz # Copyright (C) 2025 Benedikt Peetz # SPDX-License-Identifier: GPL-3.0-or-later # # This file is part of Rocie. # # You should have received a copy of the License along with this program. # If not, see . { lib, craneLib, # nativeBuildInputs trunk, tailwindcss, wasm-bindgen-cli_0_2_104, binaryen, imagemagick, }: craneLib.buildPackage { pname = "rocie-mobile"; inherit ((builtins.fromTOML (builtins.readFile ../Cargo.toml)).package) version ; src = lib.cleanSourceWith { src = lib.cleanSource ./..; filter = name: type: (type == "directory") || (builtins.elem (builtins.baseNameOf name) [ "Cargo.toml" "Cargo.lock" "tailwind.config.js" "index.html" "input.css" "Trunk.toml" "manifest.json" "logo.svg" "generate_logo.sh" ]) || (lib.strings.hasSuffix ".rs" (builtins.baseNameOf name)); }; strictDeps = true; cargoExtraArgs = "--target wasm32-unknown-unknown"; # Tests currently need to be run via `cargo wasi` which # isn't packaged in nixpkgs yet... doCheck = false; nativeBuildInputs = [ trunk tailwindcss wasm-bindgen-cli_0_2_104 binaryen # for wasm-opt imagemagick # needed for the generate_logo.sh command ]; buildInputs = [ ]; postInstall = '' trunk --offline --verbose build --release --locked --frozen --dist "./dist" rm --recursive $out/bin cp --recursive ./dist/. $out/ ''; }