Files
nix/modules/server/nextcloud.nix
Gustavo "Guz" L. de Mello 5ce99497d7 refactor!: I went too close into the sun
Simlified everything, things were getting out of control
2024-04-08 16:37:29 -03:00

64 lines
1.3 KiB
Nix

{
config,
lib,
pkgs,
...
}: let
cfg = config.server.nextcloud;
in {
imports = [];
options.server.nextcloud = with lib;
with lib.types; {
enable = mkEnableOption "";
user = mkOption {
type = str;
default = "nextcloud";
};
package = mkOption {
type = package;
default = pkgs.nextcloud28;
};
domain = mkOption {
type = str;
default = "nextcloud." + config.server.domain;
};
port = mkOption {
type = port;
default = 3030;
};
data = {
root = mkOption {
type = path;
default = config.server.storage + /nextcloud;
};
};
configureRedis = mkOption {
type = bool;
default = false;
};
settings = {
admin.user = mkOption {
type = str;
default = cfg.user;
};
admin.passwordFile = mkOption {
type = path;
};
};
};
config = lib.mkIf cfg.enable {
services.nextcloud = {
config = {
adminuser = cfg.settings.admin.user;
adminpassFile = toString cfg.settings.admin.passwordFile;
};
configureRedis = cfg.configureRedis;
enable = true;
home = toString cfg.data.root;
hostName = cfg.domain;
https = true;
package = cfg.package;
};
};
}