nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildNpmPackage,
6 cargo-tauri,
7 fetchpatch,
8 nix-update-script,
9 openssl,
10 pkg-config,
11 rustPlatform,
12}:
13let
14 version = "0-unstable-2025-03-07";
15
16 src = fetchFromGitHub {
17 owner = "arg274";
18 repo = "cambia";
19 rev = "bef0975f72e15b925d881ab70d3bc556ecf4ff7f";
20 hash = "sha256-4/GKvU3r4JpOKgkLgSOKEHnSoIsjgjQU6pay2deiIng=";
21 };
22
23 meta = {
24 description = "Compact disc ripper log checking utility";
25 homepage = "https://github.com/arg274/cambia";
26 license = lib.licenses.mit;
27 maintainers = with lib.maintainers; [ ambroisie ];
28 };
29
30 frontend = buildNpmPackage (finalAttrs: {
31 pname = "cambia-frontend";
32 inherit version;
33
34 src = "${src}/web";
35 npmDepsHash = "sha256-U+2YfsC4u6rJdeMo2zxWiXGM3061MKCcFl0oZt0ug6o=";
36
37 installPhase = ''
38 runHook preInstall
39 cp -r build/ $out
40 runHook postInstall
41 '';
42
43 meta = meta // {
44 description = "Web UI for Cambia";
45 };
46 });
47in
48
49rustPlatform.buildRustPackage (finalAttrs: {
50 pname = "cambia";
51 inherit version src;
52
53 cargoHash = "sha256-dNgFQiJrakdP0ynyVcak6cKU02Z5dcw2nhh9XhlWsOg=";
54
55 cargoPatches = [
56 # https://github.com/arg274/cambia/pull/5
57 (fetchpatch {
58 name = "cargo.lock.patch";
59 url = "https://github.com/arg274/cambia/commit/b47944fbaf4e631ede25c560a4d7e684a2ad5014.patch";
60 hash = "sha256-y9WkEmzBaFJ0eHWK0hVmB6+IdWespp79N9lSuteZZAI=";
61 })
62 ];
63
64 postPatch = ''
65 cp -r ${finalAttrs.passthru.frontend} web/build/
66 '';
67
68 nativeBuildInputs = [
69 pkg-config
70 ];
71
72 buildInputs = [
73 openssl
74 ];
75
76 passthru = {
77 updateScript = nix-update-script {
78 extraArgs = [
79 "-s"
80 "frontend"
81 ];
82 };
83 inherit frontend;
84 };
85
86 meta = meta // {
87 mainProgram = "cambia";
88 };
89})