mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Put nix package derivations in separate file and join symlinks
This commit is contained in:
41
flake.nix
41
flake.nix
@@ -41,27 +41,7 @@
|
||||
module-test = self.nixosConfigurations.${system}.module-test.config.system.build.vm;
|
||||
dev-vm = self.nixosConfigurations.${system}.dev-vm.config.system.build.vm;
|
||||
|
||||
web = pkgs.buildNpmPackage {
|
||||
name = "archtika-web-app";
|
||||
src = ./web-app;
|
||||
npmDepsHash = "sha256-DmIII/x5ANlEpKtnZC/JlbVAvhbgnSiNn8hkj+qVCZY=";
|
||||
npmFlags = [ "--legacy-peer-deps" ];
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp package.json $out
|
||||
cp -r node_modules $out
|
||||
cp -r build/* $out
|
||||
'';
|
||||
};
|
||||
|
||||
api = pkgs.stdenv.mkDerivation {
|
||||
name = "archtika-api";
|
||||
src = ./rest-api;
|
||||
installPhase = ''
|
||||
mkdir $out
|
||||
cp -r db/migrations $out
|
||||
'';
|
||||
};
|
||||
default = pkgs.callPackage ./nix/package.nix { };
|
||||
}
|
||||
);
|
||||
|
||||
@@ -76,7 +56,9 @@
|
||||
program = "${pkgs.writeShellScriptBin "api-setup" ''
|
||||
${pkgs.postgresql_16}/bin/psql postgres://postgres@localhost:15432/archtika -c "ALTER DATABASE archtika SET \"app.jwt_secret\" TO 'a42kVyAhTImYxZeebZkApoAZLmf0VtDA'"
|
||||
|
||||
${pkgs.dbmate}/bin/dbmate --url postgres://postgres@localhost:15432/archtika?sslmode=disable --migrations-dir ${self.packages.${system}.api}/migrations up
|
||||
${pkgs.dbmate}/bin/dbmate --url postgres://postgres@localhost:15432/archtika?sslmode=disable --migrations-dir ${
|
||||
self.packages.${system}.default
|
||||
}/rest-api/db/migrations up
|
||||
|
||||
PGRST_DB_SCHEMAS="api" PGRST_DB_ANON_ROLE="anon" PGRST_OPENAPI_MODE="ignore-privileges" PGRST_DB_URI="postgres://authenticator@localhost:15432/archtika" PGRST_JWT_SECRET="a42kVyAhTImYxZeebZkApoAZLmf0VtDA" ${pkgs.postgrest}/bin/postgrest
|
||||
''}/bin/api-setup";
|
||||
@@ -85,7 +67,9 @@
|
||||
web = {
|
||||
type = "app";
|
||||
program = "${pkgs.writeShellScriptBin "web-wrapper" ''
|
||||
ORIGIN=http://localhost:4000 HOST=127.0.0.1 PORT=4000 ${pkgs.nodejs_22}/bin/node ${self.packages.${system}.web}
|
||||
ORIGIN=http://localhost:4000 HOST=127.0.0.1 PORT=4000 ${pkgs.nodejs_22}/bin/node ${
|
||||
self.packages.${system}.default
|
||||
}/web-app
|
||||
''}/bin/web-wrapper";
|
||||
};
|
||||
}
|
||||
@@ -96,7 +80,7 @@
|
||||
inherit system;
|
||||
modules = [
|
||||
./nix/module-test.nix
|
||||
{ _module.args.archtikaPackages = self.packages.${system}; }
|
||||
{ _module.args.localArchtikaPackage = self.packages.${system}.default; }
|
||||
];
|
||||
};
|
||||
dev-vm = nixpkgs.lib.nixosSystem {
|
||||
@@ -105,15 +89,6 @@
|
||||
};
|
||||
});
|
||||
|
||||
nixosModules = {
|
||||
archtika =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ ./nix/module.nix ];
|
||||
_module.args.archtikaPackages = self.packages.${pkgs.system};
|
||||
};
|
||||
};
|
||||
|
||||
formatter = forAllSystems (
|
||||
system:
|
||||
let
|
||||
|
||||
Reference in New Issue
Block a user