From 86663f1789aecdb62e44a4be46e0ed111b795a09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Tue, 7 May 2019 15:02:33 +0200 Subject: Move ttrss to pkgs --- nixops/modules/websites/tools/tools/default.nix | 2 +- nixops/modules/websites/tools/tools/tt-rss.json | 14 - .../tools/ttrss-af-feedmod_type_replace.patch | 12 - .../websites/tools/tools/ttrss-af_feedmod.json | 15 - .../websites/tools/tools/ttrss-auth-ldap.json | 15 - .../websites/tools/tools/ttrss-feediron.json | 15 - .../tools/tools/ttrss-feediron_json_reformat.patch | 18 -- .../websites/tools/tools/ttrss-ff_instagram.json | 15 - .../websites/tools/tools/ttrss-tumblr_gdpr_ua.json | 15 - nixops/modules/websites/tools/tools/ttrss.nix | 304 +++++++++------------ 10 files changed, 128 insertions(+), 297 deletions(-) delete mode 100644 nixops/modules/websites/tools/tools/tt-rss.json delete mode 100644 nixops/modules/websites/tools/tools/ttrss-af-feedmod_type_replace.patch delete mode 100644 nixops/modules/websites/tools/tools/ttrss-af_feedmod.json delete mode 100644 nixops/modules/websites/tools/tools/ttrss-auth-ldap.json delete mode 100644 nixops/modules/websites/tools/tools/ttrss-feediron.json delete mode 100644 nixops/modules/websites/tools/tools/ttrss-feediron_json_reformat.patch delete mode 100644 nixops/modules/websites/tools/tools/ttrss-ff_instagram.json delete mode 100644 nixops/modules/websites/tools/tools/ttrss-tumblr_gdpr_ua.json (limited to 'nixops/modules/websites') diff --git a/nixops/modules/websites/tools/tools/default.nix b/nixops/modules/websites/tools/tools/default.nix index 433927e..22588fb 100644 --- a/nixops/modules/websites/tools/tools/default.nix +++ b/nixops/modules/websites/tools/tools/default.nix @@ -5,7 +5,7 @@ let env = myconfig.env.tools.ympd; }; ttrss = pkgs.callPackage ./ttrss.nix { - inherit (mylibs) fetchedGithub fetchedGit; + inherit (pkgs.webapps) ttrss ttrss-plugins; env = myconfig.env.tools.ttrss; }; roundcubemail = pkgs.callPackage ./roundcubemail.nix { diff --git a/nixops/modules/websites/tools/tools/tt-rss.json b/nixops/modules/websites/tools/tools/tt-rss.json deleted file mode 100644 index e2731b0..0000000 --- a/nixops/modules/websites/tools/tools/tt-rss.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "tag": "986ca25-master", - "meta": { - "name": "tt-rss", - "url": "https://git.tt-rss.org/fox/tt-rss.git", - "branch": "master" - }, - "git": { - "url": "https://git.tt-rss.org/fox/tt-rss.git", - "rev": "986ca251f995f7754a0470d3e0c44538a545081f", - "sha256": "0xkafkh7l9zazm5d6snlq03kdfxfhkb4c8fdsb32wn8b9bhdzf5s", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss-af-feedmod_type_replace.patch b/nixops/modules/websites/tools/tools/ttrss-af-feedmod_type_replace.patch deleted file mode 100644 index d622577..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-af-feedmod_type_replace.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- a/init.php 2014-06-16 14:21:06.995480038 +0200 -+++ b/init.php 2014-06-16 14:22:00.151027654 +0200 -@@ -147,6 +147,9 @@ - } - } - break; -+ case 'replace': -+ $article['content'] = preg_replace("/".$config['pattern']."/",$config['replacement'],$article['content']); -+ break; - - default: - // unknown type or invalid config diff --git a/nixops/modules/websites/tools/tools/ttrss-af_feedmod.json b/nixops/modules/websites/tools/tools/ttrss-af_feedmod.json deleted file mode 100644 index e57fcce..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-af_feedmod.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "0ea2092-master", - "meta": { - "name": "ttrss-af_feedmod", - "url": "https://github.com/mbirth/ttrss_plugin-af_feedmod", - "branch": "master" - }, - "github": { - "owner": "mbirth", - "repo": "ttrss_plugin-af_feedmod", - "rev": "0ea2092dd34067ecd898802cfca3570023d1ecfe", - "sha256": "02ibf47zcrsc2rr45wsix8gxyyf371davj8n8i0gj1zdq95klvnv", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss-auth-ldap.json b/nixops/modules/websites/tools/tools/ttrss-auth-ldap.json deleted file mode 100644 index c8aaab5..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-auth-ldap.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "4d751b0-master", - "meta": { - "name": "ttrss-auth-ldap", - "url": "https://github.com/hydrian/TTRSS-Auth-LDAP", - "branch": "master" - }, - "github": { - "owner": "hydrian", - "repo": "TTRSS-Auth-LDAP", - "rev": "4d751b095c29a8dbe2dc7bb07777742956136e94", - "sha256": "0b9fl86acrzpcv41r7pj3bl8b3n72hpkdywzx9zjyfqv5pskxyim", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss-feediron.json b/nixops/modules/websites/tools/tools/ttrss-feediron.json deleted file mode 100644 index 5dbec92..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-feediron.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "407168c-master", - "meta": { - "name": "ttrss-feediron", - "url": "https://github.com/m42e/ttrss_plugin-feediron", - "branch": "master" - }, - "github": { - "owner": "m42e", - "repo": "ttrss_plugin-feediron", - "rev": "407168c628880b5ced572cc549db6d50e866d3c8", - "sha256": "17b95ifpcph6m03hjd1mhi8gi1hw9yd3fnffmw66fqr5c9l3zd9r", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss-feediron_json_reformat.patch b/nixops/modules/websites/tools/tools/ttrss-feediron_json_reformat.patch deleted file mode 100644 index e1c44d9..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-feediron_json_reformat.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/init.php b/init.php -index 3c0f2f9..1aad146 100644 ---- a/init.php -+++ b/init.php -@@ -600,10 +600,11 @@ class Feediron extends Plugin implements IHandler - return false; - } - -- $this->host->set($this, 'json_conf', Feediron_Json::format($json_conf)); -+ $new_conf = json_encode(json_decode($json_conf), JSON_PRETTY_PRINT); -+ $this->host->set($this, 'json_conf', $new_conf); - $json_reply['success'] = true; - $json_reply['message'] = __('Configuration saved.'); -- $json_reply['json_conf'] = Feediron_Json::format($json_conf); -+ $json_reply['json_conf'] = $new_conf; - echo json_encode($json_reply); - } - diff --git a/nixops/modules/websites/tools/tools/ttrss-ff_instagram.json b/nixops/modules/websites/tools/tools/ttrss-ff_instagram.json deleted file mode 100644 index 1f241b9..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-ff_instagram.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "0366ffb-master", - "meta": { - "name": "ttrss-ff_instagram", - "url": "https://github.com/wltb/ff_instagram", - "branch": "master" - }, - "github": { - "owner": "wltb", - "repo": "ff_instagram", - "rev": "0366ffb18c4d490c8fbfba2f5f3367a5af23cfe8", - "sha256": "0vvzl6wi6jmrqknsfddvckjgsgfizz1d923d1nyrpzjfn6bda1vk", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss-tumblr_gdpr_ua.json b/nixops/modules/websites/tools/tools/ttrss-tumblr_gdpr_ua.json deleted file mode 100644 index eafbcfe..0000000 --- a/nixops/modules/websites/tools/tools/ttrss-tumblr_gdpr_ua.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "tag": "287c584-master", - "meta": { - "name": "ttrss-tumblr_gdpr_ua", - "url": "https://github.com/hkockerbeck/ttrss-tumblr-gdpr-ua", - "branch": "master" - }, - "github": { - "owner": "hkockerbeck", - "repo": "ttrss-tumblr-gdpr-ua", - "rev": "287c584e68845d524f920156bff0b2eaa6f65117", - "sha256": "1fviawgcclqky4k4xv1sqzvpb8i74w9f0pclm09m78s8l85wh9py", - "fetchSubmodules": true - } -} diff --git a/nixops/modules/websites/tools/tools/ttrss.nix b/nixops/modules/websites/tools/tools/ttrss.nix index e6cad56..05c8cab 100644 --- a/nixops/modules/websites/tools/tools/ttrss.nix +++ b/nixops/modules/websites/tools/tools/ttrss.nix @@ -1,181 +1,131 @@ -{ lib, php, env, writeText, stdenv, fetchedGit, fetchedGithub }: -let - ttrss = let - plugins = { - auth_ldap = stdenv.mkDerivation (fetchedGithub ./ttrss-auth-ldap.json // rec { - installPhase = '' - mkdir $out - cp plugins/auth_ldap/init.php $out - ''; - }); - af_feedmod = stdenv.mkDerivation (fetchedGithub ./ttrss-af_feedmod.json // rec { - patches = [ ./ttrss-af-feedmod_type_replace.patch ]; - installPhase = '' - mkdir $out - cp init.php $out - ''; - }); - feediron = stdenv.mkDerivation (fetchedGithub ./ttrss-feediron.json // rec { - patches = [ ./ttrss-feediron_json_reformat.patch ]; - installPhase = '' - mkdir $out - cp -a . $out - ''; - }); - ff_instagram = stdenv.mkDerivation (fetchedGithub ./ttrss-ff_instagram.json // rec { - installPhase = '' - mkdir $out - cp -a . $out - ''; - }); - tumblr_gdpr_ua = stdenv.mkDerivation (fetchedGithub ./ttrss-tumblr_gdpr_ua.json // rec { - installPhase = '' - mkdir $out - cp -a . $out - ''; - }); - }; - in rec { - varDir = "/var/lib/ttrss"; - activationScript = { - deps = [ "wrappers" ]; - text = '' - install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ - ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons - install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \ - ${varDir}/cache/feeds/ \ - ${varDir}/cache/images/ \ - ${varDir}/cache/js/ \ - ${varDir}/cache/simplepie/ \ - ${varDir}/cache/upload/ - touch ${varDir}/feed-icons/index.html - install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions +{ php, env, ttrss, ttrss-plugins }: +rec { + varDir = "/var/lib/ttrss"; + activationScript = { + deps = [ "wrappers" ]; + text = '' + install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir} \ + ${varDir}/lock ${varDir}/cache ${varDir}/feed-icons + install -m 0755 -o ${apache.user} -g ${apache.group} -d ${varDir}/cache/export/ \ + ${varDir}/cache/feeds/ \ + ${varDir}/cache/images/ \ + ${varDir}/cache/js/ \ + ${varDir}/cache/simplepie/ \ + ${varDir}/cache/upload/ + touch ${varDir}/feed-icons/index.html + install -m 0750 -o ${apache.user} -g ${apache.group} -d ${varDir}/phpSessions + ''; + }; + keys = [{ + dest = "webapps/tools-ttrss"; + user = apache.user; + group = apache.group; + permissions = "0400"; + text = '' + + DirectoryIndex index.php + + SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" + + + AllowOverride All + Options FollowSymlinks + Require all granted + ''; - installPhase = '' - cp -a . $out - ln -s /var/secrets/webapps/tools-ttrss $out/config.php - ${builtins.concatStringsSep "\n" ( - lib.attrsets.mapAttrsToList (name: value: "ln -sf ${value} $out/plugins/${name}") plugins - )} + }; + phpFpm = rec { + serviceDeps = [ "postgresql.service" "openldap.service" ]; + basedir = builtins.concatStringsSep ":" ( + [ webRoot "/var/secrets/webapps/tools-ttrss" varDir ] + ++ webRoot.plugins); + socket = "/var/run/phpfpm/ttrss.sock"; + pool = '' + listen = ${socket} + user = ${apache.user} + group = ${apache.group} + listen.owner = ${apache.user} + listen.group = ${apache.group} + pm = ondemand + pm.max_children = 60 + pm.process_idle_timeout = 60 + + ; Needed to avoid clashes in browser cookies (same domain) + php_value[session.name] = TtrssPHPSESSID + php_admin_value[open_basedir] = "${basedir}:/tmp" + php_admin_value[session.save_path] = "${varDir}/phpSessions" ''; - }); - apache = rec { - user = "wwwrun"; - group = "wwwrun"; - modules = [ "proxy_fcgi" ]; - webappName = "tools_ttrss"; - root = "/run/current-system/webapps/${webappName}"; - vhostConf = '' - Alias /ttrss "${root}" - - DirectoryIndex index.php - - SetHandler "proxy:unix:${phpFpm.socket}|fcgi://localhost" - - - AllowOverride All - Options FollowSymlinks - Require all granted - - ''; - }; - phpFpm = rec { - serviceDeps = [ "postgresql.service" "openldap.service" ]; - basedir = builtins.concatStringsSep ":" ( - [ webRoot "/var/secrets/webapps/tools-ttrss" varDir ] - ++ lib.attrsets.mapAttrsToList (name: value: value) plugins); - socket = "/var/run/phpfpm/ttrss.sock"; - pool = '' - listen = ${socket} - user = ${apache.user} - group = ${apache.group} - listen.owner = ${apache.user} - listen.group = ${apache.group} - pm = ondemand - pm.max_children = 60 - pm.process_idle_timeout = 60 - - ; Needed to avoid clashes in browser cookies (same domain) - php_value[session.name] = TtrssPHPSESSID - php_admin_value[open_basedir] = "${basedir}:/tmp" - php_admin_value[session.save_path] = "${varDir}/phpSessions" - ''; - }; }; -in - ttrss +} -- cgit v1.2.3