Combining frontend and backend

This commit is contained in:
rzuasti
2026-02-12 11:51:43 -05:00
parent 7908de9068
commit f5ffd6bcde
2 changed files with 32 additions and 50 deletions
+1 -1
View File
@@ -55,7 +55,7 @@
});
# A Nixpkgs overlay that provides a 'oott' package.
overlays.default = final: prev: {oott = final.callPackage ./nix/package.nix {};};
overlays.default = final: prev: {oott = final.callPackage ./nix/package.nix {inherit pkgsBySystem;};};
# Package definition
packages = forEachSystem (system: {
+31 -49
View File
@@ -1,43 +1,11 @@
# {
# lib,
# pkgs,
# }: let
# oott-backend = pkgs.rustPlatform.buildRustPackage rec {
# pname = "oott-backend";
# version = "0.0.1";
# src = ./../backend;
# cargoLock = {
# lockFile = ./../backend/Cargo.lock;
# };
# nativeBuildInputs = [pkgs.pkg-config];
# PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
# };
# oott-frontend = pkgs.flutter.buildFlutterApplication rec {
# pname = "oott-frontend";
# version = "0.0.1";
# src = ./../frontend;
# pubspecLock = lib.importJSON ./../frontend/pubspec.lock.json;
# # We need to create the pubspec.lock.json file beforehand, for now we do it manually before releasing a new version by
# # cat pubspec.lock | nix run nixpkgs#yj > pubspec.lock.json
# # buildInputs = [pkgs.yj];
# # preBuild = ''
# # cat $src/pubspec.lock | yj > $src/pubspec.lock.json
# # '';
# };
# in
# pkgs.stdenv.mkDerivation {
# name = "oott";
# buildInputs = [oott-frontend oott-backend];
# src = ./../extras;
# installPhase = ''
# mkdir -p $out/bin
# cp ${oott-backend}/bin/* $out/bin/
# '';
# }
{
lib,
pkgs,
pkgsBySystem,
}: let
system = "x86_64-linux";
pkgs = pkgsBySystem.${system};
androidSdk = pkgs.androidenv.androidPkgs.androidsdk;
oott-frontend = pkgs.stdenv.mkDerivation {
name = "oott-frontend";
version = "0.0.1";
@@ -45,37 +13,51 @@
doCheck = false;
dontFixup = true;
nativeBuildInputs = [pkgs.cacert pkgs.wget];
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
buildInputs = [pkgs.flutter];
nativeBuildInputs = [pkgs.cacert];
buildInputs = with pkgs; [
openssl
flutter
android-tools
androidSdk
jdk17
];
buildPhase = ''
runHook preBuild
mkdir -p $out/web
# pwd
# ls -la
# HOME=$out flutter build web -o $out/web/ --verbose --disable-analytics
# ls -la $out/web
HOME=$out flutter doctor
echo "done3"
HOME=$out flutter build web
cp -r build/web/* $out/web/
runHook postBuild
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-p/tQCa0AvRHUGYiqdsILo0AEFOvXC4ZBtp8cMDv5hI0=";
outputHash = "sha256-f9cizZBn8inksSxAgAzHOsicYpZfplm/fVfL8pPRRNU=";
# outputHash = pkgs.lib.fakeHash;
};
oott-backend = pkgs.rustPlatform.buildRustPackage {
pname = "oott-backend";
version = "0.0.1";
src = ./../backend;
cargoLock = {
lockFile = ./../backend/Cargo.lock;
};
nativeBuildInputs = [pkgs.pkg-config];
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig";
};
in
pkgs.stdenv.mkDerivation {
name = "oott";
buildInputs = [oott-frontend];
buildInputs = [oott-frontend oott-backend];
src = ./../extras;
installPhase = ''
mkdir -p $out/bin
mkdir -p $out/web
ls -la ${oott-frontend}
ls -la ${oott-frontend}/web
cp -r ${oott-backend}/bin/* $out/bin/
cp -r ${oott-frontend}/web/* $out/web/
'';
}