make documentRoot and argument for ttrss and simplify definition
This commit is contained in:
parent
addd852c9b
commit
e0c1af94da
1 changed files with 64 additions and 66 deletions
|
@ -2,87 +2,85 @@
|
|||
, pkgs
|
||||
, lib
|
||||
}:
|
||||
{ documentRoot
|
||||
, user ? "http"
|
||||
, group ? "http"
|
||||
}:
|
||||
{ TtrssPostgresDB
|
||||
}:
|
||||
|
||||
let
|
||||
asTtrssConfig = attrs: builtins.concatStringsSep "\n" (["<php"] ++ lib.attrsets.mapAttrsToList wrapPutenv attrs);
|
||||
wrapPutenv = key: value: "putenv('TTRSS_${lib.toUpper key}=${value}')";
|
||||
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
|
||||
];
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
name = "ttrss";
|
||||
src = pkgs.tt-rss;
|
||||
|
||||
buildCommand =
|
||||
let
|
||||
configFile = pkgs.writeText "config.php" (asTtrssConfig {
|
||||
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 = "https://tt-rss.tiserbox.com/";
|
||||
single_user_mode = "true";
|
||||
simple_update_mode = "false";
|
||||
php_executable = pkgs.php;
|
||||
|
||||
lock_directory = "/usr/share/webapps/tt-rss/lock";
|
||||
cache_dir = "/var/cache/tt-rss";
|
||||
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";
|
||||
});
|
||||
configFile = pkgs.writeText "config.php" (asTtrssConfig (config "https://${name}.tiserbox.com/"));
|
||||
in
|
||||
''
|
||||
mkdir -p $out/webapps/${name}
|
||||
cp -ra $src/* $out/webapps/${name}
|
||||
mkdir -p $out/${name}
|
||||
cp -ra $src/* $out/${name}
|
||||
cp ${configFile} $out/${name}/config.php
|
||||
|
||||
mkdir -p $out/etc/ttrss
|
||||
cp ${configFile} $out/etc/ttrss/config.php
|
||||
|
||||
echo "/usr/share/webapps" > $out/.dysnomia-targetdir
|
||||
# echo "http:http" > $out/.dysnomia-filesetowner
|
||||
echo "${documentRoot}" > $out/.dysnomia-targetdir
|
||||
echo "${user}:${group}" > $out/.dysnomia-filesetowner
|
||||
|
||||
cat > $out/.dysnomia-fileset <<FILESET
|
||||
mkdir /etc/ttrss
|
||||
|
||||
symlink $out/etc/ttrss/config.php
|
||||
target /etc/ttrss
|
||||
|
||||
mkdir /usr/share/webapps
|
||||
|
||||
symlink $out/webapps/ttrss
|
||||
target /usr/share/webapps
|
||||
symlink $out/${name}
|
||||
target ${documentRoot}
|
||||
FILESET
|
||||
|
||||
# mkdir -p $out/webapps/${name}
|
||||
# cp -ra $src/* $out/webapps/${name}
|
||||
|
||||
# mkdir -p $out/etc/tt-rss/
|
||||
# cp ${configFile} $out/etc/tt-rss/config.php
|
||||
|
||||
# mkdir -p $out/usr/share/webapps/tt-rss/
|
||||
# cp -ra $src/* $out/usr/share/webapps/tt-rss/
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue