1 { lib, pkgs, config, ... }:
3 env = config.myEnv.tools.mediagoblin;
4 cfg = config.myServices.websites.tools.mediagoblin;
5 mcfg = config.services.mediagoblin;
7 options.myServices.websites.tools.mediagoblin = {
8 enable = lib.mkEnableOption "enable mediagoblin's website";
11 config = lib.mkIf cfg.enable {
12 services.duplyBackup.profiles.mgoblin = {
13 rootDir = mcfg.dataDir;
16 dest = "webapps/tools-mediagoblin";
18 group = "mediagoblin";
22 psql_url = with env.postgresql; "postgresql://${user}:${password}@:${port}/${database}?host=${socket}";
23 redis_url = with env.redis; "redis+socket://${socket}?virtual_host=${db}";
27 data_basedir = "${mcfg.dataDir}"
30 direct_remote_path = /mgoblin_static/
31 email_sender_address = "mediagoblin@tools.immae.eu"
33 #sql_engine = sqlite:///%(data_basedir)s/mediagoblin.db
34 sql_engine = ${psql_url}
36 email_debug_mode = false
37 allow_registration = false
38 allow_reporting = true
42 user_privilege_scheme = "uploader,commenter,reporter"
44 # We need to redefine them here since we override data_basedir
45 # cf /usr/share/webapps/mediagoblin/mediagoblin/config_spec.ini
46 workbench_path = %(data_basedir)s/media/workbench
47 crypto_path = %(data_basedir)s/crypto
48 theme_install_dir = %(data_basedir)s/themes/
49 theme_linked_assets_dir = %(data_basedir)s/theme_static/
50 plugin_linked_assets_dir = %(data_basedir)s/plugin_static/
53 base_dir = %(data_basedir)s/media/queue
56 base_dir = %(data_basedir)s/media/public
57 base_url = /mgoblin_media/
60 CELERY_RESULT_DBURI = ${redis_url}
61 BROKER_URL = ${redis_url}
62 CELERYD_CONCURRENCY = 1
65 [[mediagoblin.plugins.geolocation]]
66 [[mediagoblin.plugins.ldap]]
68 LDAP_SERVER_URI = 'ldaps://${env.ldap.host}:636'
69 LDAP_SEARCH_BASE = '${env.ldap.base}'
70 LDAP_BIND_DN = '${env.ldap.dn}'
71 LDAP_BIND_PW = '${env.ldap.password}'
72 LDAP_SEARCH_FILTER = '${env.ldap.filter}'
73 EMAIL_SEARCH_FIELD = 'mail'
74 [[mediagoblin.plugins.basicsearch]]
75 [[mediagoblin.plugins.piwigo]]
76 [[mediagoblin.plugins.processing_info]]
77 [[mediagoblin.media_types.image]]
78 [[mediagoblin.media_types.video]]
82 users.users.mediagoblin.extraGroups = [ "keys" ];
84 services.mediagoblin = {
86 package = pkgs.webapps.mediagoblin.withPlugins (p: [p.basicsearch]);
87 configFile = config.secrets.fullPaths."webapps/tools-mediagoblin";
89 services.filesWatcher.mediagoblin-web = {
91 paths = [ mcfg.configFile ];
93 services.filesWatcher.mediagoblin-celeryd = {
95 paths = [ mcfg.configFile ];
98 services.websites.env.tools.modules = [
101 users.users.wwwrun.extraGroups = [ "mediagoblin" ];
102 services.websites.env.tools.vhostConfs.mgoblin = {
103 certName = "eldiron";
105 hosts = ["mgoblin.immae.eu" ];
108 Alias /mgoblin_media ${mcfg.dataDir}/media/public
109 <Directory ${mcfg.dataDir}/media/public>
110 Options -Indexes +FollowSymLinks +MultiViews +Includes
114 Alias /theme_static ${mcfg.dataDir}/theme_static
115 <Directory ${mcfg.dataDir}/theme_static>
116 Options -Indexes +FollowSymLinks +MultiViews +Includes
120 Alias /plugin_static ${mcfg.dataDir}/plugin_static
121 <Directory ${mcfg.dataDir}/plugin_static>
122 Options -Indexes +FollowSymLinks +MultiViews +Includes
129 ProxyPass /mgoblin_media !
130 ProxyPass /theme_static !
131 ProxyPass /plugin_static !
132 ProxyPassMatch ^/.well-known/acme-challenge !
133 ProxyPass / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/
134 ProxyPassReverse / unix://${mcfg.sockets.paster}|http://mgoblin.immae.eu/