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";
};
})

7
nix/packages/default.nix Normal file
View file

@ -0,0 +1,7 @@
{ pkgs }:
rec {
backend = pkgs.callPackage ./backend.nix { };
frontend = pkgs.callPackage ./frontend.nix { };
default = frontend;
}

46
nix/packages/frontend.nix Normal file
View file

@ -0,0 +1,46 @@
{
buildNpmPackage,
lib,
apiBaseUrl ? "",
}:
buildNpmPackage {
pname = "rabbi-gerzi-frontend";
version = "0.0.0";
src = lib.cleanSourceWith {
src = ../../frontend/rabbi_gerzi;
filter =
path: type:
let
relativePath = lib.removePrefix (toString ../../frontend/rabbi_gerzi + "/") (toString path);
in
!(
lib.hasPrefix ".env" relativePath
|| lib.hasPrefix "node_modules/" relativePath
|| lib.hasPrefix "dist/" relativePath
|| lib.hasPrefix "coverage/" relativePath
|| lib.hasSuffix ".tsbuildinfo" relativePath
|| lib.hasSuffix ".timestamp-" relativePath
);
};
npmDepsHash = "sha256-SF6YRzLySEkYAnwr5YYsftyvwbohtHQo0UpelHmJ7CY=";
npmFlags = [ "--legacy-peer-deps" ];
CYPRESS_INSTALL_BINARY = "0";
VITE_API_BASE_URL = apiBaseUrl;
installPhase = ''
runHook preInstall
mkdir -p $out
cp -R dist/* $out/
runHook postInstall
'';
meta = {
description = "Rabbi Gerzi Vue frontend";
};
}