From abd305b995f26f31cf704f4f7c560d79bd9a824f Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:04:33 +0200 Subject: [PATCH] Restructure flake --- .gitignore | 3 ++- flake.nix | 25 +++++++++++++------------ web-app/.gitignore | 1 - 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 0f293b7..0214a90 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.qcow2 \ No newline at end of file +*.qcow2 +result \ No newline at end of file diff --git a/flake.nix b/flake.nix index 2ac8daf..4056b08 100644 --- a/flake.nix +++ b/flake.nix @@ -44,18 +44,6 @@ { dev-vm = self.nixosConfigurations.${system}.dev-vm.config.system.build.vm; - api-setup = pkgs.writeShellScriptBin "api-setup" '' - source .env - - ${pkgs.postgresql_16}/bin/psql $DATABASE_URL -c "ALTER DATABASE archtika SET \"app.jwt_secret\" TO '$JWT_SECRET'" - - ${pkgs.dbmate}/bin/dbmate up - - echo "Running command: PGRST_DB_URI=\"$PGRST_DB_URI\" PGRST_JWT_SECRET=\"$JWT_SECRET\" ${pkgs.postgrest}/bin/postgrest postgrest.conf" - - PGRST_DB_URI="$PGRST_DB_URI" PGRST_JWT_SECRET="$JWT_SECRET" ${pkgs.postgrest}/bin/postgrest postgrest.conf - ''; - web = pkgs.buildNpmPackage { name = "archtika-web-app"; src = ./web-app; @@ -77,6 +65,19 @@ pkgs = nixpkgs.legacyPackages.${system}; in { + api = { + type = "app"; + program = "${pkgs.writeShellScriptBin "api-setup" '' + source .env + + ${pkgs.postgresql_16}/bin/psql $DATABASE_URL -c "ALTER DATABASE archtika SET \"app.jwt_secret\" TO '$JWT_SECRET'" + + ${pkgs.dbmate}/bin/dbmate up + + PGRST_DB_URI="$PGRST_DB_URI" PGRST_JWT_SECRET="$JWT_SECRET" ${pkgs.postgrest}/bin/postgrest postgrest.conf + ''}/bin/api-setup"; + }; + web = { type = "app"; program = "${pkgs.writeShellScriptBin "web-wrapper" '' diff --git a/web-app/.gitignore b/web-app/.gitignore index db048fc..f2b82b1 100644 --- a/web-app/.gitignore +++ b/web-app/.gitignore @@ -1,7 +1,6 @@ node_modules user-uploads user-websites -result # Output .output