Skip to content

Commit

Permalink
revert example flake overwrite
Browse files Browse the repository at this point in the history
  • Loading branch information
shivaraj-bh committed Sep 5, 2023
1 parent 4c68490 commit 7a2f1c2
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion example/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,43 @@
imports = [
inputs.services-flake.processComposeModules.default
];
services.mysql.m1.enable = true;

services.postgres."pg1" = {
enable = true;
listen_addresses = "127.0.0.1";
initialDatabases = [
{
name = dbName;
schema = "${inputs.northwind}/northwind.sql";
}
];
};

services.postgres."pg2" = {
enable = true;
listen_addresses = "127.0.0.1";
port = 5433;
};

settings.processes.pgweb =
let
pgcfg = config.services.postgres.pg1;
in
{
environment.PGWEB_DATABASE_URL = "postgres://$USER@${pgcfg.listen_addresses}:${builtins.toString pgcfg.port}/${dbName}";
command = pkgs.pgweb;
depends_on."pg1".condition = "process_healthy";
};
settings.processes.test = {
command = pkgs.writeShellApplication {
name = "pg1-test";
runtimeInputs = [ config.services.postgres.pg1.package ];
text = ''
echo 'SELECT version();' | psql -h 127.0.0.1 ${dbName}
'';
};
depends_on."pg1".condition = "process_healthy";
};
};

devShells.default = pkgs.mkShell {
Expand Down

0 comments on commit 7a2f1c2

Please sign in to comment.