mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/nixos/think-gtcm.nix
This commit is contained in:
@@ -6,8 +6,19 @@
|
||||
}:
|
||||
let
|
||||
cfg = config.services.think-greaterchiangmai;
|
||||
think-gtcm = pkgs.think-gtcm.override { dataDir = cfg.dataDir; };
|
||||
think-backend-gtcm = pkgs.think-backend-gtcm.override { dataDir = cfg.dataDir; };
|
||||
defaultUser = "gtcm";
|
||||
defaultGroup = "gtcm";
|
||||
|
||||
env-nonfile-values = lib.attrsets.filterAttrs (n: v: !lib.strings.hasSuffix "_FILE" n) cfg.settings;
|
||||
|
||||
think-gtcm-maintenance = pkgs.writeShellScript "think-gtcm-maintenance.sh" ''
|
||||
set -a
|
||||
${lib.strings.toShellVars env-nonfile-values}
|
||||
set +a
|
||||
|
||||
'';
|
||||
in
|
||||
{
|
||||
options.services.think-greaterchiangmai = {
|
||||
@@ -111,13 +122,6 @@ in
|
||||
PUSHER_PORT=443
|
||||
PUSHER_SCHEME=https
|
||||
PUSHER_APP_CLUSTER=mt1
|
||||
|
||||
VITE_APP_NAME="''${APP_NAME}"
|
||||
VITE_PUSHER_APP_KEY="''${PUSHER_APP_KEY}"
|
||||
VITE_PUSHER_HOST="''${PUSHER_HOST}"
|
||||
VITE_PUSHER_PORT="''${PUSHER_PORT}"
|
||||
VITE_PUSHER_SCHEME="''${PUSHER_SCHEME}"
|
||||
VITE_PUSHER_APP_CLUSTER="''${PUSHER_APP_CLUSTER}"
|
||||
}
|
||||
'';
|
||||
type = lib.types.submodule {
|
||||
@@ -215,28 +219,47 @@ in
|
||||
log_errors = on
|
||||
'';
|
||||
};
|
||||
|
||||
systemd.services.think-gtcm-setup = {
|
||||
description = "think.greaterchiangmai installation";
|
||||
requiredBy = [ "phpfpm-think-greaterchiangmai.service" ];
|
||||
before = [ "phpfpm-think-greaterchiangmai.service" ];
|
||||
requires = [ "mysql.service" ];
|
||||
after = [ "mysql.service" ];
|
||||
path = [ config.services.phpfpm.phpPackage ];
|
||||
serviceConfig = {
|
||||
RemainAfterExit = true;
|
||||
User = cfg.user;
|
||||
UMask = 77;
|
||||
WorkingDirectory = "${agorakit}";
|
||||
RuntimeDirectory = "agorakit/cache";
|
||||
RuntimeDirectoryMode = 700;
|
||||
ExecStart = think-gtcm-maintenance;
|
||||
};
|
||||
};
|
||||
|
||||
services.nginx = {
|
||||
enable = true;
|
||||
virtualHosts."${cfg.domain}" = {
|
||||
root = "${cfg.package}/share/php/think-gtcm/public";
|
||||
locations."~ \\.php$".extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.think-greaterchiangmai.socket};
|
||||
fastcgi_index site.php;
|
||||
'';
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
};
|
||||
virtualHosts."${cfg.backendDomain}" = {
|
||||
root = "${cfg.packageBackend}/share/php/think-backend-gtcm/public";
|
||||
locations."~ \\.php$".extraConfig = ''
|
||||
fastcgi_pass unix:${config.services.phpfpm.pools.think-greaterchiangmai.socket};
|
||||
fastcgi_index site.php;
|
||||
fastcgi_index index.php;
|
||||
'';
|
||||
extraConfig = ''
|
||||
index index.php;
|
||||
'';
|
||||
};
|
||||
# virtualHosts."${cfg.backendDomain}" = {
|
||||
# root = "${cfg.packageBackend}/share/php/think-backend-gtcm/public";
|
||||
# locations."~ \\.php$".extraConfig = ''
|
||||
# fastcgi_pass unix:${config.services.phpfpm.pools.think-greaterchiangmai.socket};
|
||||
# fastcgi_index index.php;
|
||||
# '';
|
||||
# extraConfig = ''
|
||||
# index index.php;
|
||||
# '';
|
||||
# };
|
||||
};
|
||||
|
||||
services.mysql = {
|
||||
|
||||
Reference in New Issue
Block a user