2024-05-15 15:35:15 +00:00
|
|
|
{ lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchYarnDeps
|
|
|
|
, php
|
|
|
|
, yarn
|
|
|
|
, fixup-yarn-lock
|
|
|
|
, nixosTests
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
php.buildComposerProject (finalAttrs: {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "grocy";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "4.2.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grocy";
|
|
|
|
repo = "grocy";
|
|
|
|
rev = "v${finalAttrs.version}";
|
|
|
|
hash = "sha256-aX3DMy9Jv8rNp1/VIvUtNXYXGBrCgBMs5GsDf4XXSj0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
vendorHash = "sha256-KaYvA0Rd4pd1s/L8QbVUgkE+SjH+jv4+6RvIaGOpews=";
|
|
|
|
|
|
|
|
offlineCache = fetchYarnDeps {
|
|
|
|
yarnLock = finalAttrs.src + "/yarn.lock";
|
|
|
|
hash = "sha256-UvWY8+qSRvzJbm7z3CmLyeUHxemzNUB7dHYP95ZVtcI=";
|
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
yarn
|
|
|
|
fixup-yarn-lock
|
|
|
|
];
|
|
|
|
|
|
|
|
# Upstream composer.json file is missing the name, description and license fields
|
|
|
|
composerStrictValidation = false;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-12-25 13:55:36 +00:00
|
|
|
# NOTE: if patches are created from a git checkout, those should be modified
|
2024-05-15 15:35:15 +00:00
|
|
|
# with `unix2dos` to make sure those apply here.
|
2020-04-24 23:36:52 +00:00
|
|
|
patches = [
|
|
|
|
./0001-Define-configs-with-env-vars.patch
|
|
|
|
./0002-Remove-check-for-config-file-as-it-s-stored-in-etc-g.patch
|
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
configurePhase = ''
|
|
|
|
runHook preConfigure
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
yarn config --offline set yarn-offline-mirror $offlineCache
|
|
|
|
fixup-yarn-lock yarn.lock
|
|
|
|
yarn install --offline --frozen-lockfile --no-progress --non-interactive
|
|
|
|
|
|
|
|
runHook postConfigure
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
2024-05-15 15:35:15 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
mv $out/share/php/grocy/* $out
|
|
|
|
rm -r $out/share
|
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
passthru.tests = { inherit (nixosTests) grocy; };
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2023-08-22 20:05:09 +00:00
|
|
|
maintainers = with maintainers; [ n0emis ];
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "ERP beyond your fridge - grocy is a web-based self-hosted groceries & household management solution for your home";
|
|
|
|
homepage = "https://grocy.info/";
|
|
|
|
};
|
2024-05-15 15:35:15 +00:00
|
|
|
})
|