castopod: init at 1.6.4
This commit is contained in:
parent
9d7860c7e7
commit
17f036f4fb
51
pkgs/applications/audio/castopod/default.nix
Normal file
51
pkgs/applications/audio/castopod/default.nix
Normal file
|
@ -0,0 +1,51 @@
|
|||
{ stdenv
|
||||
, fetchurl
|
||||
, ffmpeg-headless
|
||||
, lib
|
||||
, stateDirectory ? "/var/lib/castopod"
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "castopod";
|
||||
version = "1.6.4";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://code.castopod.org/adaures/castopod/uploads/ce56d4f149242f12bedd20f9a2b0916d/castopod-1.6.4.tar.gz";
|
||||
sha256 = "080jj91yxbn3xsbs0sywzwa2f5in9bp9qi2zwqcfqpaxlq9ga62v";
|
||||
};
|
||||
|
||||
dontBuild = true;
|
||||
dontFixup = true;
|
||||
|
||||
postPatch = ''
|
||||
# not configurable at runtime unfortunately:
|
||||
substituteInPlace app/Config/Paths.php \
|
||||
--replace "__DIR__ . '/../../writable'" "'${stateDirectory}/writable'"
|
||||
|
||||
# configuration file must be writable, place it to ${stateDirectory}
|
||||
substituteInPlace modules/Install/Controllers/InstallController.php \
|
||||
--replace "ROOTPATH" "'${stateDirectory}/'"
|
||||
substituteInPlace public/index.php spark \
|
||||
--replace "DotEnv(ROOTPATH)" "DotEnv('${stateDirectory}')"
|
||||
|
||||
# ffmpeg is required for Video Clips feature
|
||||
substituteInPlace modules/MediaClipper/VideoClipper.php \
|
||||
--replace "ffmpeg" "${ffmpeg-headless}/bin/ffmpeg"
|
||||
substituteInPlace modules/Admin/Controllers/VideoClipsController.php \
|
||||
--replace "which ffmpeg" "echo ${ffmpeg-headless}/bin/ffmpeg"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/castopod
|
||||
cp -r . $out/share/castopod
|
||||
'';
|
||||
|
||||
passthru.updateScript = ./update.sh;
|
||||
|
||||
meta = with lib; {
|
||||
description = "An open-source hosting platform made for podcasters who want to engage and interact with their audience";
|
||||
homepage = "https://castopod.org";
|
||||
license = licenses.agpl3Only;
|
||||
maintainers = with maintainers; [ alexoundos misuzu ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
89
pkgs/applications/audio/castopod/update.sh
Executable file
89
pkgs/applications/audio/castopod/update.sh
Executable file
|
@ -0,0 +1,89 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p curl jq
|
||||
set -euo pipefail
|
||||
|
||||
nixpkgs="$(git rev-parse --show-toplevel)"
|
||||
castopod_nix="$nixpkgs/pkgs/applications/audio/castopod/default.nix"
|
||||
|
||||
# https://www.meetup.com/api/guide/#p02-querying-section
|
||||
query='
|
||||
query allReleases($fullPath: ID!, $first: Int, $last: Int, $before: String, $after: String, $sort: ReleaseSort) {
|
||||
project(fullPath: $fullPath) {
|
||||
id
|
||||
releases(
|
||||
first: $first
|
||||
last: $last
|
||||
before: $before
|
||||
after: $after
|
||||
sort: $sort
|
||||
) {
|
||||
nodes {
|
||||
...Release
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
}
|
||||
|
||||
fragment Release on Release {
|
||||
id
|
||||
name
|
||||
tagName
|
||||
releasedAt
|
||||
createdAt
|
||||
upcomingRelease
|
||||
historicalRelease
|
||||
assets {
|
||||
links {
|
||||
nodes {
|
||||
id
|
||||
name
|
||||
url
|
||||
directAssetUrl
|
||||
linkType
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
__typename
|
||||
}
|
||||
'
|
||||
variables='{
|
||||
"fullPath": "adaures/castopod",
|
||||
"first": 1,
|
||||
"sort": "RELEASED_AT_DESC"
|
||||
}'
|
||||
|
||||
post=$(cat <<EOF
|
||||
{"query": "$(echo $query)", "variables": $(echo $variables)}
|
||||
EOF
|
||||
)
|
||||
|
||||
json="$(curl -s -X POST https://code.castopod.org/api/graphql \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "$post")"
|
||||
|
||||
echo "$json"
|
||||
TAG=$(echo $json | jq -r '.data.project.releases.nodes[].tagName')
|
||||
ASSET_URL=$(echo $json | jq -r '.data.project.releases.nodes[].assets.links.nodes[].url' | grep .tar.gz$)
|
||||
|
||||
CURRENT_VERSION=$(nix eval -f "$nixpkgs" --raw castopod.version)
|
||||
VERSION=${TAG:1}
|
||||
|
||||
if [[ "$CURRENT_VERSION" == "$VERSION" ]]; then
|
||||
echo "castopod is up-to-date: ${CURRENT_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
SHA256=$(nix-prefetch-url "$ASSET_URL")
|
||||
|
||||
URL=$(echo $ASSET_URL | sed -e 's/[\/&]/\\&/g')
|
||||
|
||||
sed -e "s/version =.*;/version = \"$VERSION\";/g" \
|
||||
-e "s/url =.*;/url = \"$URL\";/g" \
|
||||
-e "s/sha256 =.*;/sha256 = \"$SHA256\";/g" \
|
||||
-i "$castopod_nix"
|
|
@ -3583,6 +3583,8 @@ with pkgs;
|
|||
|
||||
callaudiod = callPackage ../applications/audio/callaudiod { };
|
||||
|
||||
castopod = callPackage ../applications/audio/castopod { };
|
||||
|
||||
calls = callPackage ../applications/networking/calls { };
|
||||
|
||||
castnow = callPackage ../tools/networking/castnow { };
|
||||
|
|
Loading…
Reference in a new issue