blob: e692242ca6966415cc2a47e22bdc182853681d77 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# rocie - An enterprise grocery management system
#
# Copyright (C) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
# 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 <https://www.gnu.org/licenses/gpl-3.0.txt>.
{
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/
'';
}
|