Merge pull request #330634 from r-ryantm/auto-update/circumflex
[NixPkgs.git] / pkgs / servers / grocy / default.nix
blobdbca9773ab6534f330a6cad0d650aefd0965b5ca
1 { lib
2 , fetchFromGitHub
3 , fetchYarnDeps
4 , php
5 , yarn
6 , fixup-yarn-lock
7 , nixosTests
8 }:
10 php.buildComposerProject (finalAttrs: {
11   pname = "grocy";
12   version = "4.2.0";
14   src = fetchFromGitHub {
15     owner = "grocy";
16     repo = "grocy";
17     rev = "v${finalAttrs.version}";
18     hash = "sha256-aX3DMy9Jv8rNp1/VIvUtNXYXGBrCgBMs5GsDf4XXSj0=";
19   };
21   vendorHash = "sha256-KaYvA0Rd4pd1s/L8QbVUgkE+SjH+jv4+6RvIaGOpews=";
23   offlineCache = fetchYarnDeps {
24     yarnLock = finalAttrs.src + "/yarn.lock";
25     hash = "sha256-UvWY8+qSRvzJbm7z3CmLyeUHxemzNUB7dHYP95ZVtcI=";
26   };
28   nativeBuildInputs = [
29     yarn
30     fixup-yarn-lock
31   ];
33   # Upstream composer.json file is missing the name, description and license fields
34   composerStrictValidation = false;
36   # NOTE: if patches are created from a git checkout, those should be modified
37   # with `unix2dos` to make sure those apply here.
38   patches = [
39     ./0001-Define-configs-with-env-vars.patch
40     ./0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch
41   ];
43   configurePhase = ''
44     runHook preConfigure
46     export HOME=$(mktemp -d)
47     yarn config --offline set yarn-offline-mirror $offlineCache
48     fixup-yarn-lock yarn.lock
49     yarn install --offline --frozen-lockfile --no-progress --non-interactive
51     runHook postConfigure
52   '';
54   installPhase = ''
55     runHook preInstall
57     mv $out/share/php/grocy/* $out
58     rm -r $out/share
60     runHook postInstall
61   '';
63   passthru.tests = { inherit (nixosTests) grocy; };
65   meta = with lib; {
66     license = licenses.mit;
67     maintainers = with maintainers; [ n0emis ];
68     description = "ERP beyond your fridge - grocy is a web-based self-hosted groceries & household management solution for your home";
69     homepage = "https://grocy.info/";
70   };