2022-04-22 01:30:20 +02:00
|
|
|
{ stdenv
|
|
|
|
, pkgs
|
|
|
|
, lib
|
|
|
|
}:
|
2022-05-15 09:44:06 +02:00
|
|
|
{ documentRoot
|
|
|
|
, user ? "http"
|
|
|
|
, group ? "http"
|
|
|
|
}:
|
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";
|
|
|
|
db_host = TtrssPostgresDB.target.properties.hostname;
|
|
|
|
db_user = TtrssPostgresDB.postgresUsername;
|
|
|
|
db_name = TtrssPostgresDB.postgresDatabase;
|
|
|
|
db_pass = TtrssPostgresDB.postgresPassword;
|
|
|
|
db_port = builtins.toString TtrssPostgresDB.postgresPort;
|
|
|
|
|
|
|
|
self_url_path = self_url_path;
|
|
|
|
single_user_mode = "true";
|
|
|
|
simple_update_mode = "false";
|
|
|
|
php_executable = pkgs.php;
|
|
|
|
|
|
|
|
lock_directory = "/run/ttrss/lock";
|
|
|
|
cache_dir = "/run/ttrss/cache";
|
|
|
|
icons_dir = "feed-icons";
|
|
|
|
icons_url = "feed-icons";
|
|
|
|
|
|
|
|
auth_auto_create = "true";
|
|
|
|
auth_auto_login = "true";
|
|
|
|
|
|
|
|
force_article_purge = "0";
|
|
|
|
sphinx_server = "localhost:9312";
|
|
|
|
sphinx_index = "ttrss, delta";
|
|
|
|
|
|
|
|
enable_registration = "false";
|
|
|
|
reg_notify_address = "user@your.domain.dom";
|
|
|
|
reg_max_users = "10";
|
|
|
|
|
|
|
|
session_cookie_lifetime = "86400";
|
|
|
|
smtp_from_name = "Tiny Tiny RSS";
|
|
|
|
smtp_from_address = "noreply@tiserbox.com";
|
|
|
|
digest_subject = "[tt-rss] New headlines for last 24 hours";
|
|
|
|
|
|
|
|
check_for_updates = "true";
|
|
|
|
plugins = "auth_internal, note";
|
|
|
|
|
|
|
|
log_destination = "syslog";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputDirs = [
|
|
|
|
config.cache_dir
|
|
|
|
config.lock_directory
|
|
|
|
];
|
2022-04-22 01:30:20 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "ttrss";
|
|
|
|
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-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-05-15 09:44:06 +02:00
|
|
|
echo "${documentRoot}" > $out/.dysnomia-targetdir
|
|
|
|
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}
|
|
|
|
target ${documentRoot}
|
2022-04-22 01:30:20 +02:00
|
|
|
FILESET
|
|
|
|
'';
|
|
|
|
}
|