2022-04-22 01:30:20 +02:00
|
|
|
{ stdenv
|
|
|
|
, pkgs
|
|
|
|
, lib
|
|
|
|
}:
|
2022-06-07 20:55:56 +02:00
|
|
|
{ document_root
|
2022-05-18 09:06:32 +02:00
|
|
|
, name ? "ttrss"
|
2022-05-15 09:44:06 +02:00
|
|
|
, user ? "http"
|
|
|
|
, group ? "http"
|
2022-06-07 20:55:56 +02:00
|
|
|
, lock_directory
|
|
|
|
, cache_directory
|
|
|
|
, feed_icons_directory
|
|
|
|
, db_host
|
|
|
|
, db_port
|
|
|
|
, db_username
|
|
|
|
, db_database
|
|
|
|
, db_password
|
2022-10-02 05:59:40 +02:00
|
|
|
# , domain
|
|
|
|
# , smtp_host
|
|
|
|
# , smtp_login
|
|
|
|
# , smtp_password
|
|
|
|
# , feedback_url ? ""
|
|
|
|
, allow_remote_user_auth ? false
|
|
|
|
, enabled_plugins ? [ "auth_internal" "note" ]
|
2022-05-15 09:44:06 +02:00
|
|
|
}:
|
2022-04-22 01:30:20 +02:00
|
|
|
{ TtrssPostgresDB
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2022-05-15 09:44:06 +02:00
|
|
|
asTtrssConfig = attrs: builtins.concatStringsSep "\n" (
|
|
|
|
["<?php" ""]
|
|
|
|
++ lib.attrsets.mapAttrsToList wrapPutenv attrs
|
|
|
|
++ [""] # Needs a newline at the end
|
|
|
|
);
|
|
|
|
wrapPutenv = key: value: "putenv('TTRSS_${lib.toUpper key}=${value}');";
|
|
|
|
|
|
|
|
config = self_url_path: {
|
|
|
|
db_type = "pgsql";
|
2022-06-07 20:55:56 +02:00
|
|
|
db_host = db_host {inherit TtrssPostgresDB;};
|
|
|
|
db_port = builtins.toString db_port;
|
|
|
|
db_user = db_username;
|
|
|
|
db_name = db_database;
|
|
|
|
db_pass = db_password;
|
2022-05-15 09:44:06 +02:00
|
|
|
|
|
|
|
self_url_path = self_url_path;
|
2022-10-02 05:59:40 +02:00
|
|
|
single_user_mode = "false";
|
2022-05-15 09:44:06 +02:00
|
|
|
simple_update_mode = "false";
|
2022-05-18 09:06:32 +02:00
|
|
|
php_executable = "${pkgs.php}/bin/php";
|
2022-05-15 09:44:06 +02:00
|
|
|
|
2022-05-18 09:06:32 +02:00
|
|
|
lock_directory = "${lock_directory}";
|
2022-06-07 20:55:56 +02:00
|
|
|
cache_dir = "${cache_directory}";
|
|
|
|
icons_dir = "${feed_icons_directory}";
|
2022-05-15 09:44:06 +02:00
|
|
|
icons_url = "feed-icons";
|
|
|
|
|
|
|
|
auth_auto_create = "true";
|
|
|
|
auth_auto_login = "true";
|
2022-10-02 05:59:40 +02:00
|
|
|
allow_remote_user_auth = if allow_remote_user_auth then "true" else "false";
|
|
|
|
enable_registration = "false";
|
2022-05-15 09:44:06 +02:00
|
|
|
|
|
|
|
force_article_purge = "0";
|
|
|
|
sphinx_server = "localhost:9312";
|
|
|
|
sphinx_index = "ttrss, delta";
|
|
|
|
|
2022-10-02 05:59:40 +02:00
|
|
|
session_check_address = "true";
|
|
|
|
session_cookie_lifetime = "0";
|
|
|
|
session_expire_time = "86400";
|
2022-05-15 09:44:06 +02:00
|
|
|
|
|
|
|
smtp_from_name = "Tiny Tiny RSS";
|
2022-10-02 05:59:40 +02:00
|
|
|
# smtp_from_address = "noreply@${domain}";
|
|
|
|
# inherit smtp_host smtp_login smtp_password;
|
|
|
|
# inherit feedback_url;
|
|
|
|
digest_enable = "true";
|
|
|
|
digest_email_limit = "10";
|
2022-05-15 09:44:06 +02:00
|
|
|
digest_subject = "[tt-rss] New headlines for last 24 hours";
|
|
|
|
|
2022-10-02 05:59:40 +02:00
|
|
|
deamon_sends_digest = "true";
|
|
|
|
|
|
|
|
check_for_new_version = "false";
|
|
|
|
plugins = builtins.concatStringsSep ", " enabled_plugins;
|
2022-05-15 09:44:06 +02:00
|
|
|
|
|
|
|
log_destination = "syslog";
|
|
|
|
};
|
2022-04-22 01:30:20 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2022-05-18 09:06:32 +02:00
|
|
|
inherit name;
|
2022-04-22 01:30:20 +02:00
|
|
|
src = pkgs.tt-rss;
|
2022-05-15 09:44:06 +02:00
|
|
|
|
2022-04-22 01:30:20 +02:00
|
|
|
buildCommand =
|
|
|
|
let
|
2022-05-15 09:44:06 +02:00
|
|
|
configFile = pkgs.writeText "config.php" (asTtrssConfig (config "https://${name}.tiserbox.com/"));
|
2022-06-07 20:55:56 +02:00
|
|
|
dr = dirOf document_root;
|
2022-04-22 01:30:20 +02:00
|
|
|
in
|
|
|
|
''
|
2022-05-15 09:44:06 +02:00
|
|
|
mkdir -p $out/${name}
|
|
|
|
cp -ra $src/* $out/${name}
|
|
|
|
cp ${configFile} $out/${name}/config.php
|
2022-04-22 01:30:20 +02:00
|
|
|
|
2022-06-07 20:55:56 +02:00
|
|
|
echo "${dr}" > $out/.dysnomia-targetdir
|
2022-05-15 09:44:06 +02:00
|
|
|
echo "${user}:${group}" > $out/.dysnomia-filesetowner
|
2022-04-22 01:30:20 +02:00
|
|
|
|
|
|
|
cat > $out/.dysnomia-fileset <<FILESET
|
2022-05-15 09:44:06 +02:00
|
|
|
symlink $out/${name}
|
2022-06-07 20:55:56 +02:00
|
|
|
target ${dr}
|
2022-04-22 01:30:20 +02:00
|
|
|
FILESET
|
|
|
|
'';
|
|
|
|
}
|