trailbase.nix (1612B)
1 { lib 2 , stdenv 3 , fetchzip 4 , autoPatchelfHook 5 , zlib 6 , openssl 7 }: 8 9 let 10 # Map Nix system to TrailBase release architecture 11 platformInfo = { 12 "x86_64-linux" = { 13 arch = "x86_64_linux"; 14 sha256 = "sha256-cHm3gDDiitJgd8QFenbfAOfEF5ynGjBrSQxWm0qs4wc="; 15 }; 16 "aarch64-linux" = { 17 arch = "arm64_linux"; 18 sha256 = lib.fakeSha256; 19 }; 20 "x86_64-darwin" = { 21 arch = "x86_64_apple_darwin"; 22 sha256 = lib.fakeSha256; 23 }; 24 "aarch64-darwin" = { 25 arch = "arm64_apple_darwin"; 26 sha256 = "sha256-bUTGA9WJohFjhPXt5bOdBuy8z5TytWJ5hLJX2yMYvbM="; 27 }; 28 }; 29 30 platform = platformInfo.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}"); 31 in 32 stdenv.mkDerivation rec { 33 pname = "trailbase"; 34 version = "0.23.0"; 35 36 src = fetchzip { 37 url = "https://github.com/trailbaseio/trailbase/releases/download/v${version}/trailbase_v${version}_${platform.arch}.zip"; 38 sha256 = platform.sha256; 39 stripRoot = false; 40 }; 41 42 nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ]; 43 44 buildInputs = lib.optionals stdenv.isLinux [ 45 stdenv.cc.cc.lib 46 zlib 47 openssl 48 ]; 49 50 installPhase = '' 51 runHook preInstall 52 53 mkdir -p $out/bin 54 cp trail $out/bin/ 55 chmod +x $out/bin/trail 56 57 runHook postInstall 58 ''; 59 60 meta = with lib; { 61 description = "A blazingly fast, open-source application server built on Rust & SQLite"; 62 homepage = "https://github.com/trailbaseio/trailbase"; 63 license = licenses.osl3; 64 platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; 65 maintainers = [ ]; 66 }; 67 } 68