mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos/mattermost: silence startup warnings from chmod/chown; improve API
This commit is contained in:
parent
7cf6855c7f
commit
c37cb3b243
1 changed files with 8 additions and 9 deletions
|
@ -29,8 +29,7 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
mattermostPluginDerivations = with pkgs;
|
mattermostPluginDerivations = with pkgs;
|
||||||
if cfg.plugins == null then null
|
map (plugin: stdenv.mkDerivation {
|
||||||
else map (plugin: stdenv.mkDerivation {
|
|
||||||
name = "mattermost-plugin";
|
name = "mattermost-plugin";
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/share
|
mkdir -p $out/share
|
||||||
|
@ -44,7 +43,7 @@ let
|
||||||
}) cfg.plugins;
|
}) cfg.plugins;
|
||||||
|
|
||||||
mattermostPlugins = with pkgs;
|
mattermostPlugins = with pkgs;
|
||||||
if mattermostPluginDerivations == null then null
|
if mattermostPluginDerivations == [] then null
|
||||||
else stdenv.mkDerivation {
|
else stdenv.mkDerivation {
|
||||||
name = "${cfg.package.name}-plugins";
|
name = "${cfg.package.name}-plugins";
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
|
@ -177,8 +176,8 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = mkOption {
|
plugins = mkOption {
|
||||||
type = types.nullOr (types.listOf (types.oneOf [types.path types.package]));
|
type = types.listOf (types.oneOf [types.path types.package]);
|
||||||
default = null;
|
default = [];
|
||||||
example = "[ ./com.github.moussetc.mattermost.plugin.giphy-2.0.0.tar.gz ]";
|
example = "[ ./com.github.moussetc.mattermost.plugin.giphy-2.0.0.tar.gz ]";
|
||||||
description = ''
|
description = ''
|
||||||
Plugins to add to the configuration. Overrides any installed if non-null.
|
Plugins to add to the configuration. Overrides any installed if non-null.
|
||||||
|
@ -306,11 +305,11 @@ in
|
||||||
rm -f ${cfg.statePath}/config/config.json
|
rm -f ${cfg.statePath}/config/config.json
|
||||||
echo "$new_config" > ${cfg.statePath}/config/config.json
|
echo "$new_config" > ${cfg.statePath}/config/config.json
|
||||||
'' + lib.optionalString cfg.localDatabaseCreate (createDb {}) + ''
|
'' + lib.optionalString cfg.localDatabaseCreate (createDb {}) + ''
|
||||||
find . -maxdepth 1 -not -name data -not -name . -exec chown ${cfg.user}:${cfg.group} -R {} \;
|
# Don't change permissions recursively on the data, current, and symlinked directories (see ln -sf command above).
|
||||||
find . -maxdepth 1 -not -name data -not -name . -exec chmod u+rw,g+r,o-rwx -R {} \;
|
|
||||||
|
|
||||||
# Don't change permissions recursively on the data and current directory.
|
|
||||||
# This dramatically increases startup times for installations with a lot of files.
|
# This dramatically increases 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 {} \;
|
||||||
|
|
||||||
chown ${cfg.user}:${cfg.group} ${cfg.statePath}/data .
|
chown ${cfg.user}:${cfg.group} ${cfg.statePath}/data .
|
||||||
chmod u+rw,g+r,o-rwx ${cfg.statePath}/data .
|
chmod u+rw,g+r,o-rwx ${cfg.statePath}/data .
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue