baikal: init at 0.10.1 (#370473)
This commit is contained in:
@@ -1490,6 +1490,7 @@
|
|||||||
./services/web-apps/archtika.nix
|
./services/web-apps/archtika.nix
|
||||||
./services/web-apps/artalk.nix
|
./services/web-apps/artalk.nix
|
||||||
./services/web-apps/audiobookshelf.nix
|
./services/web-apps/audiobookshelf.nix
|
||||||
|
./services/web-apps/baikal.nix
|
||||||
./services/web-apps/bluemap.nix
|
./services/web-apps/bluemap.nix
|
||||||
./services/web-apps/bookstack.nix
|
./services/web-apps/bookstack.nix
|
||||||
./services/web-apps/c2fmzq-server.nix
|
./services/web-apps/c2fmzq-server.nix
|
||||||
|
|||||||
141
nixos/modules/services/web-apps/baikal.nix
Normal file
141
nixos/modules/services/web-apps/baikal.nix
Normal file
@@ -0,0 +1,141 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
common-name = "baikal";
|
||||||
|
cfg = config.services.baikal;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
meta.maintainers = [ lib.maintainers.wrvsrx ];
|
||||||
|
options = {
|
||||||
|
services.baikal = {
|
||||||
|
enable = lib.mkEnableOption "baikal";
|
||||||
|
user = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = common-name;
|
||||||
|
description = ''
|
||||||
|
User account under which the web-application run.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
group = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = common-name;
|
||||||
|
description = ''
|
||||||
|
Group account under which the web-application run.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
pool = lib.mkOption {
|
||||||
|
type = lib.types.str;
|
||||||
|
default = common-name;
|
||||||
|
description = ''
|
||||||
|
Name of existing phpfpm pool that is used to run web-application.
|
||||||
|
If not specified a pool will be created automatically with
|
||||||
|
default values.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
virtualHost = lib.mkOption {
|
||||||
|
type = lib.types.nullOr lib.types.str;
|
||||||
|
default = common-name;
|
||||||
|
description = ''
|
||||||
|
Name of the nginx virtualhost to use and setup. If null, do not setup any virtualhost.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
phpPackage = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.php;
|
||||||
|
defaultText = "pkgs.php";
|
||||||
|
description = ''
|
||||||
|
php package to use for php fpm daemon.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
package = lib.mkOption {
|
||||||
|
type = lib.types.package;
|
||||||
|
default = pkgs.baikal;
|
||||||
|
defaultText = "pkgs.baikal";
|
||||||
|
description = ''
|
||||||
|
Baikal package to use.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
config = lib.mkIf cfg.enable {
|
||||||
|
services.phpfpm.pools = lib.mkIf (cfg.pool == "${common-name}") {
|
||||||
|
${common-name} = {
|
||||||
|
inherit (cfg) user phpPackage;
|
||||||
|
phpEnv = {
|
||||||
|
"BAIKAL_PATH_CONFIG" = "/var/lib/baikal/config/";
|
||||||
|
"BAIKAL_PATH_SPECIFIC" = "/var/lib/baikal/specific/";
|
||||||
|
};
|
||||||
|
settings = lib.mapAttrs (name: lib.mkDefault) {
|
||||||
|
"listen.owner" = "nginx";
|
||||||
|
"listen.group" = "nginx";
|
||||||
|
"listen.mode" = "0600";
|
||||||
|
"pm" = "dynamic";
|
||||||
|
"pm.max_children" = 75;
|
||||||
|
"pm.start_servers" = 1;
|
||||||
|
"pm.min_spare_servers" = 1;
|
||||||
|
"pm.max_spare_servers" = 4;
|
||||||
|
"pm.max_requests" = 500;
|
||||||
|
"pm.process_idle_timeout" = 30;
|
||||||
|
"catch_workers_output" = 1;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
services.nginx = lib.mkIf (cfg.virtualHost != null) {
|
||||||
|
enable = true;
|
||||||
|
virtualHosts."${cfg.virtualHost}" = {
|
||||||
|
root = "${cfg.package}/share/php/baikal/html";
|
||||||
|
locations = {
|
||||||
|
"/" = {
|
||||||
|
index = "index.php";
|
||||||
|
};
|
||||||
|
"/.well-known/".extraConfig = ''
|
||||||
|
rewrite ^/.well-known/caldav /dav.php redirect;
|
||||||
|
rewrite ^/.well-known/carddav /dav.php redirect;
|
||||||
|
'';
|
||||||
|
"~ /(\.ht|Core|Specific|config)".extraConfig = ''
|
||||||
|
deny all;
|
||||||
|
return 404;
|
||||||
|
'';
|
||||||
|
"~ ^(.+\.php)(.*)$".extraConfig = ''
|
||||||
|
try_files $fastcgi_script_name =404;
|
||||||
|
include ${config.services.nginx.package}/conf/fastcgi.conf;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(.*)$;
|
||||||
|
fastcgi_pass unix:${config.services.phpfpm.pools.${cfg.pool}.socket};
|
||||||
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.${cfg.user} = lib.mkIf (cfg.user == common-name) {
|
||||||
|
description = "baikal service user";
|
||||||
|
isSystemUser = true;
|
||||||
|
inherit (cfg) group;
|
||||||
|
};
|
||||||
|
|
||||||
|
users.groups.${cfg.group} = lib.mkIf (cfg.group == common-name) { };
|
||||||
|
|
||||||
|
systemd.tmpfiles.settings."baikal" = builtins.listToAttrs (
|
||||||
|
map
|
||||||
|
(x: {
|
||||||
|
name = "/var/lib/baikal/${x}";
|
||||||
|
value.d = {
|
||||||
|
mode = "0700";
|
||||||
|
inherit (cfg) user group;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
[
|
||||||
|
"config"
|
||||||
|
"specific"
|
||||||
|
"specific/db"
|
||||||
|
]
|
||||||
|
);
|
||||||
|
};
|
||||||
|
}
|
||||||
3208
pkgs/by-name/ba/baikal/composer.lock
generated
Normal file
3208
pkgs/by-name/ba/baikal/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
pkgs/by-name/ba/baikal/package.nix
Normal file
25
pkgs/by-name/ba/baikal/package.nix
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
php,
|
||||||
|
fetchFromGitHub,
|
||||||
|
lib,
|
||||||
|
}:
|
||||||
|
php.buildComposerProject rec {
|
||||||
|
pname = "baikal";
|
||||||
|
version = "0.10.1";
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "sabre-io";
|
||||||
|
repo = "Baikal";
|
||||||
|
tag = version;
|
||||||
|
hash = "sha256-YQQwTdwfHQZdUhO5HbScj/Bl8ype7TtPI3lHjvz2k04=";
|
||||||
|
};
|
||||||
|
# It doesn't provide a composer.lock file, we have to generate manually.
|
||||||
|
composerLock = ./composer.lock;
|
||||||
|
vendorHash = "sha256-R9DlgrULUJ02wBOGIdOQrcKiATSSZ/UApYODQ8485Qs=";
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Lightweight CalDAV+CardDAV server that offers an extensive web interface with easy management of users, address books and calendars";
|
||||||
|
homepage = "https://sabre.io/baikal/";
|
||||||
|
license = lib.licenses.gpl3Only;
|
||||||
|
maintainers = with lib.maintainers; [ wrvsrx ];
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user