mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 19:55:41 +03:00

Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:
nix-build ci -A fmt.check
This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).
This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).
Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase
).
If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
114 lines
3.1 KiB
Nix
114 lines
3.1 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
let
|
|
cfg = config.services.ferretdb;
|
|
in
|
|
{
|
|
|
|
meta.maintainers = with lib.maintainers; [
|
|
julienmalka
|
|
camillemndn
|
|
];
|
|
|
|
options = {
|
|
services.ferretdb = {
|
|
enable = lib.mkEnableOption "FerretDB, an Open Source MongoDB alternative";
|
|
|
|
package = lib.mkOption {
|
|
type = lib.types.package;
|
|
example = lib.literalExpression "pkgs.ferretdb";
|
|
default = pkgs.ferretdb;
|
|
defaultText = "pkgs.ferretdb";
|
|
description = "FerretDB package to use.";
|
|
};
|
|
|
|
settings = lib.mkOption {
|
|
type = lib.types.submodule {
|
|
freeformType = with lib.types; attrsOf str;
|
|
options = {
|
|
FERRETDB_HANDLER = lib.mkOption {
|
|
type = lib.types.enum [
|
|
"sqlite"
|
|
"pg"
|
|
];
|
|
default = "sqlite";
|
|
description = "Backend handler";
|
|
};
|
|
|
|
FERRETDB_SQLITE_URL = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "file:/var/lib/ferretdb/";
|
|
description = "SQLite URI (directory) for 'sqlite' handler";
|
|
};
|
|
|
|
FERRETDB_POSTGRESQL_URL = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "postgres://ferretdb@localhost/ferretdb?host=/run/postgresql";
|
|
description = "PostgreSQL URL for 'pg' handler";
|
|
};
|
|
|
|
FERRETDB_TELEMETRY = lib.mkOption {
|
|
type = lib.types.enum [
|
|
"enable"
|
|
"disable"
|
|
];
|
|
default = "disable";
|
|
description = ''
|
|
Enable or disable basic telemetry.
|
|
|
|
See <https://docs.ferretdb.io/telemetry/> for more information.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
example = {
|
|
FERRETDB_LOG_LEVEL = "warn";
|
|
FERRETDB_MODE = "normal";
|
|
};
|
|
description = ''
|
|
Additional configuration for FerretDB, see
|
|
<https://docs.ferretdb.io/configuration/flags/>
|
|
for supported values.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
services.ferretdb.settings = { };
|
|
|
|
systemd.services.ferretdb = {
|
|
description = "FerretDB";
|
|
after = [ "network.target" ];
|
|
wantedBy = [ "multi-user.target" ];
|
|
environment = cfg.settings;
|
|
serviceConfig = {
|
|
Type = "simple";
|
|
StateDirectory = "ferretdb";
|
|
WorkingDirectory = "/var/lib/ferretdb";
|
|
ExecStart = "${cfg.package}/bin/ferretdb";
|
|
Restart = "on-failure";
|
|
ProtectHome = true;
|
|
ProtectSystem = "strict";
|
|
PrivateTmp = true;
|
|
PrivateDevices = true;
|
|
ProtectHostname = true;
|
|
ProtectClock = true;
|
|
ProtectKernelTunables = true;
|
|
ProtectKernelModules = true;
|
|
ProtectKernelLogs = true;
|
|
ProtectControlGroups = true;
|
|
NoNewPrivileges = true;
|
|
RestrictRealtime = true;
|
|
RestrictSUIDSGID = true;
|
|
RemoveIPC = true;
|
|
PrivateMounts = true;
|
|
DynamicUser = true;
|
|
};
|
|
};
|
|
};
|
|
}
|