summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSavyasachee Jha <genghizkhan91@hawkradius.com>2024-06-24 20:44:08 +0530
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2024-07-19 16:55:26 +0000
commit14fdb8777aebba6964e28b32266e4b6eaf863017 (patch)
treed7e0361d69f48c10fba07bcb0e9eeaf2acee83d8
parentMerge pull request #328052 from NixOS/backport-326095-to-release-24.05 (diff)
downloadnixpkgs-14fdb8777aebba6964e28b32266e4b6eaf863017.tar.gz
firefly-iii: Streamlined derivation
- Removed firefly-iii-assets package and compressed build into one - Added PatrickDaG as maintainer in addition to myself - Added update script (cherry picked from commit 42b1bc89a230a74d5cf7a7db6d60a78621a0b036)
-rw-r--r--pkgs/by-name/fi/firefly-iii/package.nix69
1 files changed, 50 insertions, 19 deletions
diff --git a/pkgs/by-name/fi/firefly-iii/package.nix b/pkgs/by-name/fi/firefly-iii/package.nix
index 0a15b4eaa921..d8495f64e299 100644
--- a/pkgs/by-name/fi/firefly-iii/package.nix
+++ b/pkgs/by-name/fi/firefly-iii/package.nix
@@ -1,8 +1,12 @@
{ lib
, fetchFromGitHub
-, buildNpmPackage
+, stdenvNoCC
+, nodejs
+, fetchNpmDeps
+, buildPackages
, php83
, nixosTests
+, nix-update-script
, dataDir ? "/var/lib/firefly-iii"
}:
@@ -10,6 +14,7 @@ let
pname = "firefly-iii";
version = "6.1.18";
phpPackage = php83;
+ npmDepsHash = "sha256-MoxkNxfVeIFkiNVzfehQ9FpC65kBj8ZmvwaRf4MVRIg=";
src = fetchFromGitHub {
owner = "firefly-iii";
@@ -17,36 +22,62 @@ let
rev = "v${version}";
hash = "sha256-mA7gvKhHouUUz1Aix7253O/+VcufoEFwdcJeZxnazEo=";
};
-
- assets = buildNpmPackage {
- pname = "${pname}-assets";
- inherit version src;
- npmDepsHash = "sha256-MoxkNxfVeIFkiNVzfehQ9FpC65kBj8ZmvwaRf4MVRIg=";
- dontNpmBuild = true;
- installPhase = ''
- runHook preInstall
- npm run prod --workspace=v1
- npm run build --workspace=v2
- cp -r ./public $out/
- runHook postInstall
- '';
- };
in
-phpPackage.buildComposerProject (finalAttrs: {
+stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname src version;
+ buildInputs = [ phpPackage ];
+
+ nativeBuildInputs = [
+ nodejs
+ nodejs.python
+ buildPackages.npmHooks.npmConfigHook
+ phpPackage.composerHooks.composerInstallHook
+ phpPackage.packages.composer-local-repo-plugin
+ ];
+
+ composerNoDev = true;
+ composerNoPlugins = true;
+ composerNoScripts = true;
+ composerStrictValidation = true;
+ strictDeps = true;
+
vendorHash = "sha256-EpMypgj6lZDz6T94bGoCUH9IVwh7VB4Ds08AcCsreRw=";
+ npmDeps = fetchNpmDeps {
+ inherit src;
+ name = "${pname}-npm-deps";
+ hash = npmDepsHash;
+ };
+
+ composerRepository = phpPackage.mkComposerRepository {
+ inherit (finalAttrs)
+ pname
+ src
+ vendorHash
+ version
+ ;
+ composerNoDev = true;
+ composerNoPlugins = true;
+ composerNoScripts = true;
+ composerStrictValidation = true;
+ };
+
+ preInstall = ''
+ npm run prod --workspace=v1
+ npm run build --workspace=v2
+ '';
+
passthru = {
inherit phpPackage;
tests = nixosTests.firefly-iii;
+ updateScript = nix-update-script { };
};
postInstall = ''
mv $out/share/php/${pname}/* $out/
- rm -R $out/share $out/storage $out/bootstrap/cache $out/public
- cp -a ${assets} $out/public
+ rm -R $out/share $out/storage $out/bootstrap/cache $out/node_modules
ln -s ${dataDir}/storage $out/storage
ln -s ${dataDir}/cache $out/bootstrap/cache
'';
@@ -56,6 +87,6 @@ phpPackage.buildComposerProject (finalAttrs: {
description = "Firefly III: a personal finances manager";
homepage = "https://github.com/firefly-iii/firefly-iii";
license = lib.licenses.agpl3Only;
- maintainers = [ lib.maintainers.savyajha ];
+ maintainers = [ lib.maintainers.savyajha lib.maintainers.patrickdag ];
};
})