1{
2 lib,
3 fetchFromGitHub,
4 buildNpmPackage,
5 rustPlatform,
6 pkg-config,
7 openssl,
8}:
9rustPlatform.buildRustPackage rec {
10 pname = "cook-cli";
11 version = "0.12.1";
12
13 src = fetchFromGitHub {
14 owner = "cooklang";
15 repo = "cookcli";
16 rev = "v${version}";
17 hash = "sha256-2vY68PUoHDyyH3hJ/Fvjxbof7RzWFWYTg1UhsjWNpww=";
18 };
19
20 cargoHash = "sha256-H4soSp9fDwrqcv3eL5WqGYHWAt07gyVLoEVp1VbYchQ=";
21
22 nativeBuildInputs = [
23 pkg-config
24 openssl
25 ];
26
27 buildInputs = [
28 openssl
29 ];
30
31 postPatch = ''
32 rm -rf "ui/public"
33 ln -s ${passthru.ui} "ui/public"
34 '';
35
36 OPENSSL_NO_VENDOR = 1;
37
38 passthru.ui = buildNpmPackage {
39 name = "ui";
40 src = "${src}/ui";
41 npmDepsHash = "sha256-zx8G6Raop1EZAVy1YCF5ag5aL9NutRxbPfTARmjP2SY=";
42 makeCacheWritable = true;
43 npmFlags = [ "--legacy-peer-deps" ];
44 installPhase = ''
45 runHook preInstall
46 mv public/ $out
47 runHook postInstall
48 '';
49 };
50
51 meta = {
52 changelog = "https://github.com/cooklang/cookcli/releases/tag/v${version}";
53 description = "Suite of tools to create shopping lists and maintain recipes";
54 homepage = "https://cooklang.org/";
55 license = lib.licenses.mit;
56 mainProgram = "cook";
57 maintainers = [ lib.maintainers.emilioziniades ];
58 platforms = lib.platforms.linux ++ lib.platforms.darwin;
59 };
60}