mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2025-01-06 21:42:35 +03:00
Merge pull request #238307 from pacien/pixelfed-update
This commit is contained in:
commit
23a11416b9
@ -380,6 +380,12 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
script = ''
|
script = ''
|
||||||
|
# Before running any PHP program, cleanup the code cache.
|
||||||
|
# It's necessary if you upgrade the application otherwise you might
|
||||||
|
# try to import non-existent modules.
|
||||||
|
rm -f ${cfg.runtimeDir}/app.php
|
||||||
|
rm -rf ${cfg.runtimeDir}/cache/*
|
||||||
|
|
||||||
# Concatenate non-secret .env and secret .env
|
# Concatenate non-secret .env and secret .env
|
||||||
rm -f ${cfg.dataDir}/.env
|
rm -f ${cfg.dataDir}/.env
|
||||||
cp --no-preserve=all ${configFile} ${cfg.dataDir}/.env
|
cp --no-preserve=all ${configFile} ${cfg.dataDir}/.env
|
||||||
@ -406,11 +412,6 @@ in {
|
|||||||
# Install Horizon
|
# Install Horizon
|
||||||
# FIXME: require write access to public/ — should be done as part of install — pixelfed-manage horizon:publish
|
# FIXME: require write access to public/ — should be done as part of install — pixelfed-manage horizon:publish
|
||||||
|
|
||||||
# Before running any PHP program, cleanup the bootstrap.
|
|
||||||
# It's necessary if you upgrade the application otherwise you might
|
|
||||||
# try to import non-existent modules.
|
|
||||||
rm -rf ${cfg.runtimeDir}/bootstrap/*
|
|
||||||
|
|
||||||
# Perform the first migration.
|
# Perform the first migration.
|
||||||
[[ ! -f ${cfg.dataDir}/.initial-migration ]] && pixelfed-manage migrate --force && touch ${cfg.dataDir}/.initial-migration
|
[[ ! -f ${cfg.dataDir}/.initial-migration ]] && pixelfed-manage migrate --force && touch ${cfg.dataDir}/.initial-migration
|
||||||
|
|
||||||
|
@ -28,17 +28,19 @@ let
|
|||||||
});
|
});
|
||||||
in package.override rec {
|
in package.override rec {
|
||||||
pname = "pixelfed";
|
pname = "pixelfed";
|
||||||
version = "0.11.5";
|
version = "0.11.8";
|
||||||
|
|
||||||
# GitHub distribution does not include vendored files
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "pixelfed";
|
owner = "pixelfed";
|
||||||
repo = pname;
|
repo = pname;
|
||||||
rev = "v${version}";
|
rev = "v${version}";
|
||||||
hash = "sha256-ZrvYKMSx5WymWR46/UKr5jCsclXXzBeY21ju22zeqN0=";
|
hash = "sha256-du+xwSrMqt4KIzQRUos6EmVBRp+39gHuoLSRsgLe1CQ=";
|
||||||
};
|
};
|
||||||
|
|
||||||
passthru.tests = { inherit (nixosTests) pixelfed; };
|
passthru = {
|
||||||
|
tests = { inherit (nixosTests) pixelfed; };
|
||||||
|
updateScript = ./update.sh;
|
||||||
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A federated image sharing platform";
|
description = "A federated image sharing platform";
|
||||||
|
File diff suppressed because it is too large
Load Diff
36
pkgs/servers/web-apps/pixelfed/update.sh
Executable file
36
pkgs/servers/web-apps/pixelfed/update.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env nix-shell
|
||||||
|
#! nix-shell -I nixpkgs=../../../.. -i bash -p nix curl jq nix-update
|
||||||
|
|
||||||
|
# check if composer2nix is installed
|
||||||
|
if ! command -v composer2nix &> /dev/null; then
|
||||||
|
echo "Please install composer2nix (https://github.com/svanderburg/composer2nix) to run this script."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CURRENT_VERSION=$(nix eval -f ../../../.. --raw pixelfed.version)
|
||||||
|
TARGET_VERSION_REMOTE=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/pixelfed/pixelfed/releases/latest | jq -r ".tag_name")
|
||||||
|
TARGET_VERSION=${TARGET_VERSION_REMOTE:1}
|
||||||
|
PIXELFED=https://github.com/pixelfed/pixelfed/raw/$TARGET_VERSION_REMOTE
|
||||||
|
SHA256=$(nix-prefetch-url --unpack "https://github.com/pixelfed/pixelfed/archive/v$TARGET_VERSION/pixelfed.tar.gz")
|
||||||
|
SRI_HASH=$(nix hash to-sri --type sha256 "$SHA256")
|
||||||
|
|
||||||
|
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then
|
||||||
|
echo "pixelfed is up-to-date: ${CURRENT_VERSION}"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
curl -LO "$PIXELFED/composer.json"
|
||||||
|
curl -LO "$PIXELFED/composer.lock"
|
||||||
|
|
||||||
|
composer2nix --name "pixelfed" \
|
||||||
|
--composition=composition.nix \
|
||||||
|
--no-dev
|
||||||
|
rm composer.json composer.lock
|
||||||
|
|
||||||
|
# change version number
|
||||||
|
sed -e "s/version =.*;/version = \"$TARGET_VERSION\";/g" \
|
||||||
|
-e "s/hash =.*;/hash = \"$SRI_HASH\";/g" \
|
||||||
|
-i ./default.nix
|
||||||
|
|
||||||
|
cd ../../../..
|
||||||
|
nix-build -A pixelfed
|
Loading…
Reference in New Issue
Block a user