Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(mongodb): Use mongodb-ce; Enable test on darwin #360

Merged
merged 2 commits into from
Oct 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions doc/mongodb.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,22 @@ Because of the licensing of MongoDB, the Nixpkgs derivation that provides the bi

If you are using this for your own development, you should either put in place a [local binary cache](https://nixos.wiki/wiki/Binary_Cache) to match your flake, or be aware that the first time you spin up the service it could possibly take a long time to build.

## Pre-built binaries

[mongodb-ce](https://github.com/NixOS/nixpkgs/blob/e58a261efb95afd52fb4a1cf35185a017327a96d/pkgs/by-name/mo/mongodb-ce/package.nix) package from [nixpkgs](https://github.com/NixOS/nixpkgs) fetches pre-built binaries[^why-pre-built]. You can also build the binary from scratch using [mongodb](https://github.com/NixOS/nixpkgs/blob/924e8aa12419c6ac57690ed47c1d9af580c818a2/pkgs/servers/nosql/mongodb/mongodb.nix) package:

```nix
# Inside `process-compose.<name>`
{
services.mongodb."m1" = {
enable = true;
package = pkgs.mongodb;
};
}
```

[why-pre-built]: For more context on why pre-built binary is used, see: https://github.com/juspay/services-flake/pull/360

## Usage example

<https://github.com/juspay/services-flake/blob/main/nix/services/mongodb_test.nix>
2 changes: 1 addition & 1 deletion nix/services/mongodb.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
in
{
options = {
package = lib.mkPackageOption pkgs "mongodb" { };
package = lib.mkPackageOption pkgs "mongodb-ce" { };

bind = lib.mkOption {
type = types.nullOr types.str;
Expand Down
5 changes: 1 addition & 4 deletions test/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"${inputs.services-flake}/nix/services/elasticsearch_test.nix"
"${inputs.services-flake}/nix/services/grafana_test.nix"
"${inputs.services-flake}/nix/services/memcached_test.nix"
"${inputs.services-flake}/nix/services/mongodb_test.nix"
"${inputs.services-flake}/nix/services/nginx/nginx_test.nix"
"${inputs.services-flake}/nix/services/ollama_test.nix"
"${inputs.services-flake}/nix/services/open-webui_test.nix"
Expand All @@ -51,10 +52,6 @@
"${inputs.services-flake}/nix/services/tika_test.nix"
"${inputs.services-flake}/nix/services/weaviate_test.nix"
"${inputs.services-flake}/nix/services/zookeeper_test.nix"
] ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [
# Due to a dependency problem, MongoDB does not build on Darwin,
# See https://github.com/NixOS/nixpkgs/issues/346003
"${inputs.services-flake}/nix/services/mongodb_test.nix"
]));
};
};
Expand Down