export nix module

This commit is contained in:
Yisroel Baum 2026-07-02 01:31:58 +03:00
parent fee174ec05
commit e288b3a63b
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 522 additions and 4 deletions

55
nix/packages/backend.nix Normal file
View file

@ -0,0 +1,55 @@
{
lib,
makeWrapper,
php,
}:
let
phpPackage = php.withExtensions (
{ enabled, all }:
enabled
++ [
all.pdo_pgsql
]
);
in
phpPackage.buildComposerProject2 (finalAttrs: {
pname = "rabbi-gerzi-backend";
version = "0.0.0";
src = lib.cleanSourceWith {
src = ../../backend;
filter =
path: type:
let
relativePath = lib.removePrefix (toString ../../backend + "/") (toString path);
in
!(
lib.hasPrefix ".env" relativePath
|| lib.hasPrefix "vendor/" relativePath
|| lib.hasPrefix ".phpunit" relativePath
|| lib.hasPrefix "storage/logs/" relativePath
|| lib.hasPrefix "storage/framework/views/" relativePath
|| lib.hasSuffix "~" relativePath
);
};
php = phpPackage;
nativeBuildInputs = [ makeWrapper ];
vendorHash = "sha256-EhBxKo3qjEuVTlxK/F+vx6ZBGbApBjcgOK8+3u8UiNk=";
postInstall = ''
mkdir -p $out/bin
makeWrapper ${phpPackage}/bin/php $out/bin/rabbi-gerzi-artisan \
--add-flags "$out/share/php/${finalAttrs.pname}/artisan"
'';
passthru = {
php = phpPackage;
};
meta = {
description = "Rabbi Gerzi Laravel backend";
mainProgram = "rabbi-gerzi-artisan";
};
})