depot/third_party/nixpkgs/pkgs/by-name/fi/firefly-iii-data-importer/package.nix
Default email 159e378cbb Project import generated by Copybara.
GitOrigin-RevId: c04d5652cfa9742b1d519688f65d1bbccea9eb7e
2024-09-19 17:19:46 +03:00

91 lines
2.1 KiB
Nix

{
lib,
fetchFromGitHub,
stdenvNoCC,
nodejs,
fetchNpmDeps,
buildPackages,
php83,
nixosTests,
nix-update-script,
dataDir ? "/var/lib/firefly-iii-data-importer",
}:
let
pname = "firefly-iii-data-importer";
version = "1.5.5";
src = fetchFromGitHub {
owner = "firefly-iii";
repo = "data-importer";
rev = "v${version}";
hash = "sha256-nAeLXxUwaw/wHYh3NywI4/mFi82i/2b3McFfCFGAIjE=";
};
in
stdenvNoCC.mkDerivation (finalAttrs: {
inherit pname src version;
buildInputs = [ php83 ];
nativeBuildInputs = [
nodejs
nodejs.python
buildPackages.npmHooks.npmConfigHook
php83.composerHooks.composerInstallHook
php83.packages.composer-local-repo-plugin
];
composerNoDev = true;
composerNoPlugins = true;
composerNoScripts = true;
composerStrictValidation = true;
strictDeps = true;
vendorHash = "sha256-yLu/FMKn/uUy5g6td3mfPAb9ptjJne4vd478fjaS9U0=";
npmDeps = fetchNpmDeps {
inherit src;
name = "${pname}-npm-deps";
hash = "sha256-35mS+0Ea69CAwV9liTU3lcKp3ww3qLbTRWlF0AQNx5w=";
};
composerRepository = php83.mkComposerRepository {
inherit (finalAttrs)
pname
src
vendorHash
version
;
composerNoDev = true;
composerNoPlugins = true;
composerNoScripts = true;
composerStrictValidation = true;
};
preInstall = ''
npm run build --workspace=v2
'';
passthru = {
phpPackage = php83;
tests = nixosTests.firefly-iii-data-importer;
updateScript = nix-update-script { };
};
postInstall = ''
rm -R $out/share/php/firefly-iii-data-importer/{storage,bootstrap/cache,node_modules}
mv $out/share/php/firefly-iii-data-importer/* $out/
rm -R $out/share
ln -s ${dataDir}/storage $out/storage
ln -s ${dataDir}/cache $out/bootstrap/cache
'';
meta = {
changelog = "https://github.com/firefly-iii/data-importer/releases/tag/v${version}";
description = "Firefly III Data Importer can import data into Firefly III.";
homepage = "https://github.com/firefly-iii/data-importer";
license = lib.licenses.agpl3Only;
maintainers = [ lib.maintainers.savyajha ];
};
})