diff options
author | Morgan Jones <me@numin.it> | 2021-12-31 01:54:41 -0700 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-12-31 23:49:00 -0500 |
commit | 38ee2de29de194c36475e35b47e1ff6dc734c96b (patch) | |
tree | c20621d3165bfc5d5deff8cc1fd804b3890ba3ea | |
parent | c37cb3b2434175c0cd271418f7023142e50a915a (diff) | |
download | nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar.gz nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar.bz2 nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar.lz nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar.xz nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.tar.zst nixpkgs-38ee2de29de194c36475e35b47e1ff6dc734c96b.zip |
nixos/mattermost: update service for 6.0+
-rw-r--r-- | nixos/modules/services/web-apps/mattermost.nix | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/nixos/modules/services/web-apps/mattermost.nix b/nixos/modules/services/web-apps/mattermost.nix index 8154457904c..310a673f511 100644 --- a/nixos/modules/services/web-apps/mattermost.nix +++ b/nixos/modules/services/web-apps/mattermost.nix @@ -78,6 +78,8 @@ let TeamSettings.SiteName = cfg.siteName; SqlSettings.DriverName = "postgres"; SqlSettings.DataSource = database; + PluginSettings.Directory = "${cfg.statePath}/plugins/server"; + PluginSettings.ClientDirectory = "${cfg.statePath}/plugins/client"; } cfg.extraConfig; @@ -88,9 +90,6 @@ let else { PluginSettings = { Enable = true; - EnableUploads = false; - Directory = "${cfg.statePath}/plugins/server"; - ClientDirectory = "${cfg.statePath}/plugins/client"; }; } ); @@ -274,7 +273,7 @@ in # The systemd service will fail to execute the preStart hook # if the WorkingDirectory does not exist system.activationScripts.mattermost = '' - mkdir -p ${cfg.statePath} + mkdir -p "${cfg.statePath}" ''; systemd.services.mattermost = { @@ -283,45 +282,41 @@ in after = [ "network.target" "postgresql.service" ]; preStart = '' - mkdir -p ${cfg.statePath}/{data,config,logs} - ln -sf ${cfg.package}/{bin,fonts,i18n,templates,client} ${cfg.statePath} + mkdir -p "${cfg.statePath}"/{data,config,logs,plugins} + mkdir -p "${cfg.statePath}/plugins"/{client,server} + ln -sf ${cfg.package}/{bin,fonts,i18n,templates,client} "${cfg.statePath}" '' + lib.optionalString (mattermostPlugins != null) '' - mkdir -p ${cfg.statePath}/plugins/{client,server} rm -rf "${cfg.statePath}/data/plugins" - ln -sf ${mattermostPlugins}/data/plugins ${cfg.statePath}/data + ln -sf ${mattermostPlugins}/data/plugins "${cfg.statePath}/data" '' + lib.optionalString (!cfg.mutableConfig) '' - rm -f ${cfg.statePath}/config/config.json - ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.package}/config/config.json ${mattermostConfJSON} > ${cfg.statePath}/config/config.json - ${cfg.package}/bin/mattermost config migrate ${cfg.statePath}/config/config.json ${database} + rm -f "${cfg.statePath}/config/config.json" + ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.package}/config/config.json ${mattermostConfJSON} > "${cfg.statePath}/config/config.json" '' + lib.optionalString cfg.mutableConfig '' if ! test -e "${cfg.statePath}/config/.initial-created"; then rm -f ${cfg.statePath}/config/config.json - ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.package}/config/config.json ${mattermostConfJSON} > ${cfg.statePath}/config/config.json - touch ${cfg.statePath}/config/.initial-created + ${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.package}/config/config.json ${mattermostConfJSON} > "${cfg.statePath}/config/config.json" + touch "${cfg.statePath}/config/.initial-created" fi '' + lib.optionalString (cfg.mutableConfig && cfg.preferNixConfig) '' - new_config="$(${pkgs.jq}/bin/jq -s '.[0] * .[1]' ${cfg.statePath}/config/config.json ${mattermostConfJSON})" + new_config="$(${pkgs.jq}/bin/jq -s '.[0] * .[1]' "${cfg.statePath}/config/config.json" ${mattermostConfJSON})" - rm -f ${cfg.statePath}/config/config.json - echo "$new_config" > ${cfg.statePath}/config/config.json + rm -f "${cfg.statePath}/config/config.json" + echo "$new_config" > "${cfg.statePath}/config/config.json" '' + lib.optionalString cfg.localDatabaseCreate (createDb {}) + '' # Don't change permissions recursively on the data, current, and symlinked directories (see ln -sf command above). - # This dramatically increases startup times for installations with a lot of files. + # This dramatically decreases startup times for installations with a lot of files. find . -maxdepth 1 -not -name data -not -name client -not -name templates -not -name i18n -not -name fonts -not -name bin -not -name . \ - -exec chown ${cfg.user}:${cfg.group} -R {} \; -exec chmod u+rw,g+r,o-rwx -R {} \; + -exec chown "${cfg.user}:${cfg.group}" -R {} \; -exec chmod u+rw,g+r,o-rwx -R {} \; - chown ${cfg.user}:${cfg.group} ${cfg.statePath}/data . - chmod u+rw,g+r,o-rwx ${cfg.statePath}/data . + chown "${cfg.user}:${cfg.group}" "${cfg.statePath}/data" . + chmod u+rw,g+r,o-rwx "${cfg.statePath}/data" . ''; serviceConfig = { PermissionsStartOnly = true; User = cfg.user; Group = cfg.group; - ExecStart = "${cfg.package}/bin/mattermost " + ( - escapeShellArgs - (lib.optionals (!cfg.mutableConfig) ["-c" database]) - ); + ExecStart = "${cfg.package}/bin/mattermost"; WorkingDirectory = "${cfg.statePath}"; Restart = "always"; RestartSec = "10"; |