aether/modules/streams/package.nix

69 lines
1.7 KiB
Nix

{
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
'';
}