wip: altserver from source

This commit is contained in:
Sean Kovacs 2026-01-15 16:27:18 -05:00
commit fdda29ecb9
Signed by: sckova
GPG key ID: 00F325187C68651A
2 changed files with 95 additions and 40 deletions

View file

@ -157,7 +157,6 @@
mosh mosh
spotify-player spotify-player
gh gh
altserver-linux
# development & tooling # development & tooling
jdk21_headless jdk21_headless

View file

@ -1,55 +1,111 @@
{ {
stdenv,
fetchurl,
lib, lib,
clangStdenv,
fetchFromGitHub,
fetchgit,
requireFile,
cmake,
ninja,
pkg-config,
boost179,
openssl,
avahi,
zlib,
libuuid,
python3,
git,
libimobiledevice,
libplist,
libimobiledevice-glue,
libusbmuxd,
minizip,
websocketpp,
unzip,
}: let }: let
sources = { cpprestsdk = fetchFromGitHub {
x86_64-linux = { owner = "microsoft";
arch = "x86_64"; repo = "cpprestsdk";
hash = "sha256-C+fDrcaewRd6FQMrO443xdDk/vtHycQ5zWLCOLPqF/s="; rev = "v2.10.18";
}; sha256 = "sha256-RCt6BIFxRDTGiIjo5jhIxBeCOQsttWViQcib7M0wZ5Y=";
i686-linux = { fetchSubmodules = true;
arch = "i586";
hash = "sha256-xxucxefmFOiZn6fgAnKZ6yzxcG+mSpXvLzxlli493EI=";
};
aarch64-linux = {
arch = "aarch64";
hash = "sha256-iGAgqkS1DTgiUgUZZ9bsSsNfWggjSIem+Mluc6Xz3ik=";
};
armv7l-linux = {
arch = "armv7";
hash = "sha256-99olJlOMEMbZtFILpSRumZUj146IcyD3HrM5AimZPbg=";
};
}; };
source = sources.${stdenv.hostPlatform.system};
in in
stdenv.mkDerivation (finalAttrs: { clangStdenv.mkDerivation {
pname = "altserver-linux"; pname = "altserver";
version = "0.0.5"; version = "unstable";
src = fetchurl { src = fetchgit {
url = "https://github.com/NyaMisty/AltServer-Linux/releases/download/v${finalAttrs.version}/AltServer-${source.arch}"; url = "https://github.com/sckova/AltServer-Linux";
hash = source.hash; rev = "f9173b0805b64517a856fc133955753fde361c63";
hash = "sha256-ts2YnGTdI5/Ze+7900Wvyxm2YJyQQ0qBlyLMRCAN20c=";
fetchSubmodules = true;
deepClone = true;
}; };
dontUnpack = true; nativeBuildInputs = [
cmake
ninja
pkg-config
git
unzip
];
buildInputs = [
boost179
openssl
avahi
zlib
libuuid
python3
libimobiledevice
libplist
libimobiledevice-glue
libusbmuxd
minizip
websocketpp
];
NIX_CFLAGS_COMPILE = toString [
"-D_GNU_SOURCE"
"-Wno-error=implicit-function-declaration"
"-Wno-error=incompatible-pointer-types"
"-Wno-error=int-conversion"
];
cmakeFlags = [
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
"-DCMAKE_C_FLAGS=-Wno-error=incompatible-pointer-types -Wno-implicit-function-declaration"
"-DCMAKE_CXX_FLAGS=-Wno-error=incompatible-pointer-types -Wno-implicit-function-declaration"
"-Wno-dev"
"-D_XOPEN_SOURCE=700"
"-DFETCHCONTENT_FULLY_DISCONNECTED=ON"
"-DFETCHCONTENT_SOURCE_DIR_CPPRESTSDK=${cpprestsdk}"
];
postPatch = ''
# The build system tries to link a non-existent static library 'corecrypto_static'.
# We remove this dependency so it relies on the OpenSSL shims/libraries instead.
substituteInPlace cmake/CoreCrypto/CMakeLists.txt \
--replace-fail "corecrypto_static" ""
'';
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p $out/bin mkdir -p $out/bin
cp $src $out/bin/alt-server # Copy the resulting binary (name may vary slightly by fork, finding executable)
chmod u+x $out/bin/alt-server find . -maxdepth 2 -type f -executable -name "AltServer" -exec cp {} $out/bin/ \;
runHook postInstall runHook postInstall
''; '';
meta = { meta = with lib; {
homepage = "https://github.com/NyaMisty/AltServer-Linux"; description = "AltServer for Linux (fork)";
description = "AltServer for AltStore, but on-device. Requires root privileges as well as running a custom anisette server currently"; homepage = "https://github.com/sckova/AltServer-Linux";
license = lib.licenses.agpl3Only; license = licenses.unfree;
mainProgram = "alt-server"; platforms = platforms.linux;
sourceProvenance = with lib.sourceTypes; [binaryNativeCode]; maintainers = with maintainers; [];
platforms = ["x86_64-linux" "i686-linux" "aarch64-linux" "armv7l-linux"];
maintainers = with lib.maintainers; [max-amb];
}; };
}) }