1
0
Fork 0

make documentRoot and argument for ttrss and simplify definition

This commit is contained in:
ibizaman 2022-05-15 00:44:06 -07:00
parent addd852c9b
commit e0c1af94da

View file

@ -2,19 +2,22 @@
, 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}')";
in
stdenv.mkDerivation rec {
name = "ttrss";
src = pkgs.tt-rss;
buildCommand =
let
configFile = pkgs.writeText "config.php" (asTtrssConfig {
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;
@ -22,13 +25,13 @@ stdenv.mkDerivation rec {
db_pass = TtrssPostgresDB.postgresPassword;
db_port = builtins.toString TtrssPostgresDB.postgresPort;
self_url_path = "https://tt-rss.tiserbox.com/";
self_url_path = self_url_path;
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";
lock_directory = "/run/ttrss/lock";
cache_dir = "/run/ttrss/cache";
icons_dir = "feed-icons";
icons_url = "feed-icons";
@ -52,37 +55,32 @@ stdenv.mkDerivation rec {
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 (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/
'';
}