feat: streams module (WIP)

This commit is contained in:
Kiana Sheibani 2025-04-01 22:58:44 -04:00
parent dedd95c442
commit 9624a019bd
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
6 changed files with 342 additions and 2 deletions

View file

@ -0,0 +1,69 @@
{
lib,
php,
src,
vendorHash,
addonRepos ? [],
themeRepos ? []
}:
php.buildComposerProject {
pname = "streams";
version = "25.4.2";
inherit src vendorHash;
postInstall = ''
# Override composerInstallHook's output location
rm -rf $out
cp -r . $out
# Ugly hack: These locations need to be writable,
# so link them to outside of the Nix store
ln -s /var/lib/streams/store $out/store
ln -s /var/lib/streams/cache $out/cache
ln -s /var/lib/streams/config.php $out/.htconfig.php
# Install addons and themes
mkdir $out/addon
for repo in ${lib.concatStringsSep " " addonRepos}; do
filelist=(`ls $repo`)
for a in "''${filelist[@]}" ; do
if [ $a = 'version.php' ]; then
if [ ! -x $out/addon/version.php ]; then
ln -s $repo/version.php $out/addon/version.php
fi
fi
base=`basename $a`
if [ $base = '.git' ]; then
continue;
fi
if [ ! -d $repo/$base ]; then
continue;
fi
if [ -x $out/addon/$base ]; then
continue;
fi
ln -s $repo/$base $out/addon/$base
done
done
for repo in ${lib.concatStringsSep " " themeRepos}; do
filelist=(`ls $repo`)
for a in "''${filelist[@]}" ; do
base=`basename $a`
if [ $base = '.git' ]; then
continue;
fi
if [ ! -d $repo/$base ]; then
continue;
fi
if [ -x $out/view/theme/$base ]; then
continue;
fi
ln -s $repo/$base $out/view/theme/$base
done
done
'';
}