mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 19:30:11 +00:00
committed by
github-actions[bot]
parent
f105bffca4
commit
78d69741b2
@@ -38,7 +38,10 @@ in package.override rec {
|
||||
hash = "sha256-ZrvYKMSx5WymWR46/UKr5jCsclXXzBeY21ju22zeqN0=";
|
||||
};
|
||||
|
||||
passthru.tests = { inherit (nixosTests) pixelfed; };
|
||||
passthru = {
|
||||
tests = { inherit (nixosTests) pixelfed; };
|
||||
updateScript = ./update.sh;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "A federated image sharing platform";
|
||||
|
||||
35
pkgs/servers/web-apps/pixelfed/update.sh
Executable file
35
pkgs/servers/web-apps/pixelfed/update.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/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")
|
||||
|
||||
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/sha256 =.*;/sha256 = \"$SHA256\";/g" \
|
||||
-i ./default.nix
|
||||
|
||||
cd ../../../..
|
||||
nix-build -A pixelfed
|
||||
Reference in New Issue
Block a user