From b27591a97d94e9337af14fcdfa77a12bc79e08a4 Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 13 Apr 2024 13:05:16 +0200 Subject: [PATCH] feat: firefly build from source --- modules/fireflyIII.nix | 4 ++-- pkgs/firefly-iii.nix | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/modules/fireflyIII.nix b/modules/fireflyIII.nix index b1eb9e1..9f54e28 100644 --- a/modules/fireflyIII.nix +++ b/modules/fireflyIII.nix @@ -16,9 +16,9 @@ mkDefault ; - package = cfg.package.override { + package = "${cfg.package.override { inherit (cfg) dataDir; - }; + }}/share/php/firefly-iii"; in { options.services.firefly-iii = { enable = mkEnableOption "firefly-iii"; diff --git a/pkgs/firefly-iii.nix b/pkgs/firefly-iii.nix index 6d4de79..ce706b3 100644 --- a/pkgs/firefly-iii.nix +++ b/pkgs/firefly-iii.nix @@ -1,20 +1,25 @@ { - stdenv, lib, - fetchurl, dataDir ? "/var/lib/firefly-iii", + php83, + fetchFromGitHub, + buildNpmPackage, }: let version = "6.1.13"; - src = fetchurl { - url = "https://github.com/firefly-iii/firefly-iii/releases/download/v${version}/FireflyIII-v${version}.tar.gz"; - hash = "sha256-uQzk3pgdZ0baqmBouHfcuzrymwrsDy6b4IwSY3br6f0="; + src = fetchFromGitHub { + owner = "firefly-iii"; + repo = "firefly-iii"; + rev = "v${version}"; + hash = "sha256-85zI8uCyyoCflzxDkvba6FWa9B3kh179DJfQ2Um6MGM="; }; -in - stdenv.mkDerivation rec { + frontend = buildNpmPackage { inherit src version; pname = "firefly-iii"; - sourceRoot = "."; + npmDepsHash = "sha256-wuPUE6XuzzgKjpxZVgwh2wGut15M61WSBFG+YIZwOFM="; installPhase = '' + mkdir -p $out + rm -rf ./node_modules + cp -r ./ $out mkdir -p $out/storage cp -r ./ $out rm -Rf $out/storage @@ -22,6 +27,13 @@ in rm -Rf $out/bootstrap/cache ln -fs ${dataDir}/bootstrap/cache $out/bootstrap/cache ''; + }; +in + php83.buildComposerProject rec { + inherit version; + src = frontend; + pname = "firefly-iii"; + vendorHash = "sha256-CVGKyyLp5hjjpEulDNEYfljU4OgPBaFcYQQAUf6GeGs="; meta = with lib; { description = "Firefly III: a personal finances manager";