From ee58b84ef0ffd22b90ee902fedefb35c16f26c8e Mon Sep 17 00:00:00 2001 From: UGA Innovation Factory Date: Thu, 18 Dec 2025 18:58:25 -0500 Subject: [PATCH] Fix docker-compose.yml sed and enable submodules --- default.nix | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/default.nix b/default.nix index f45123e..f7d49e7 100644 --- a/default.nix +++ b/default.nix @@ -1,4 +1,4 @@ -{ inputs, ... }: +{ inputs, ... }@moduleArgs: # ============================================================================ # USDA Dashboard External System Module @@ -23,13 +23,28 @@ }: let + # Get the directory where this module is located + moduleDir = builtins.toString (builtins.dirOf moduleArgs); + # Create a derivation that packages the usda-vision directory usda-vision-app = pkgs.stdenv.mkDerivation { pname = "usda-vision"; version = "1.0.0"; - # Use the directory from this repository - src = ./usda-vision; + # Use the directory from this repository with explicit source filtering + src = lib.cleanSourceWith { + src = "${moduleDir}/usda-vision"; + filter = path: type: + let + baseName = baseNameOf path; + in + # Exclude git, but include everything else + baseName != ".git" && + baseName != ".cursor" && + baseName != "__pycache__" && + baseName != "node_modules" && + baseName != ".venv"; + }; nativeBuildInputs = [ pkgs.makeWrapper pkgs.rsync ]; @@ -56,11 +71,11 @@ let rm -f $out/opt/usda-vision/.env # Update docker-compose.yml to use /var/lib/usda-vision/.env + # Use temp file in /tmp to avoid permission issues if [ -f $out/opt/usda-vision/docker-compose.yml ]; then - ${pkgs.gnused}/bin/sed -i 's|env_file:.*management-dashboard-web-app/\.env|env_file: /var/lib/usda-vision/.env|g' \ - $out/opt/usda-vision/docker-compose.yml - ${pkgs.gnused}/bin/sed -i 's|\./management-dashboard-web-app/\.env|/var/lib/usda-vision/.env|g' \ - $out/opt/usda-vision/docker-compose.yml + ${pkgs.gnused}/bin/sed 's|env_file:.*management-dashboard-web-app/\.env|env_file: /var/lib/usda-vision/.env|g; s|\./management-dashboard-web-app/\.env|/var/lib/usda-vision/.env|g' \ + $out/opt/usda-vision/docker-compose.yml > /tmp/docker-compose.yml.tmp + mv /tmp/docker-compose.yml.tmp $out/opt/usda-vision/docker-compose.yml fi # Create convenience scripts