feat: add firefly pico

This commit is contained in:
oddlama 2025-04-26 14:39:43 +02:00
parent d7fbce7a1e
commit d7b79ab6e9
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
13 changed files with 587 additions and 11 deletions

View file

@ -19,6 +19,7 @@ _inputs: [
# ];
mdns-repeater = prev.callPackage ./mdns-repeater.nix { };
firefly-pico = prev.callPackage ./firefly-pico.nix { };
formats = prev.formats // {
ron = import ./ron.nix { inherit (prev) lib pkgs; };

View file

@ -0,0 +1,50 @@
{
src,
version,
stdenvNoCC,
nodejs,
fetchNpmDeps,
buildPackages,
php84,
nixosTests,
nix-update-script,
meta,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "firefly-pico-frontend";
inherit version src;
sourceRoot = "source/front";
nativeBuildInputs = [
nodejs
nodejs.python
buildPackages.npmHooks.npmConfigHook
];
npmDeps = fetchNpmDeps {
inherit (finalAttrs) src;
sourceRoot = "source/front";
name = "${finalAttrs.pname}-npm-deps";
hash = "sha256-+YpWPp0ufPuuSkTn0WDD2E80S9bs5ZTQ8TzFFtgfTqU=";
};
passthru = {
phpPackage = php84;
tests = nixosTests.firefly-pico;
updateScript = nix-update-script { };
};
env.NUXT_TELEMETRY_DISABLED = 1;
buildPhase = ''
runHook preBuild
npm run generate
runHook postBuild
'';
postInstall = ''
mkdir -p $out/share/firefly-pico
cp -r .output/public $out/share/firefly-pico/
'';
inherit meta;
})

73
pkgs/firefly-pico.nix Normal file
View file

@ -0,0 +1,73 @@
{
lib,
fetchFromGitHub,
stdenvNoCC,
nodejs,
callPackage,
php84,
nixosTests,
nix-update-script,
dataDir ? "/var/lib/firefly-pico",
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "firefly-pico";
version = "1.7.0";
src = fetchFromGitHub {
owner = "cioraneanu";
repo = "firefly-pico";
tag = "${finalAttrs.version}";
hash = "sha256-Ef64WZYAtViW5lCSCtTzjs6KJL7BxW9innqLSy0N2xQ=";
};
sourceRoot = "source/back";
buildInputs = [ php84 ];
nativeBuildInputs = [
nodejs
nodejs.python
php84.composerHooks2.composerInstallHook
];
composerVendor = php84.mkComposerVendor {
inherit (finalAttrs) pname src version;
sourceRoot = "source/back";
composerNoDev = true;
composerNoPlugins = true;
composerNoScripts = true;
composerStrictValidation = true;
strictDeps = true;
vendorHash = "sha256-hwbmsvD91lX/vYa1Xk1WEo8pB6b+DTRDVd2DJ7TjocI=";
};
passthru = {
phpPackage = php84;
tests = nixosTests.firefly-pico;
updateScript = nix-update-script { };
frontend = callPackage ./firefly-pico-frontend.nix {
inherit (finalAttrs)
src
version
meta
;
};
};
postInstall = ''
chmod +x $out/share/php/firefly-pico/artisan
rm -R $out/share/php/firefly-pico/{storage,bootstrap/cache}
ln -s ${dataDir}/storage $out/share/php/firefly-pico/storage
ln -s ${dataDir}/cache $out/share/php/firefly-pico/bootstrap/cache
'';
meta = {
changelog = "https://github.com/cioraneanu/firefly-pico/releases/tag/${finalAttrs.version}";
description = "Firefly III: a personal finances manager";
homepage = "https://github.com/cioraneanu/firefly-pico";
license = lib.licenses.agpl3Only;
maintainers = [
lib.maintainers.patrickdag
];
hydraPlatforms = lib.platforms.linux; # build hangs on both Darwin platforms, needs investigation
};
})