nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 157 lines 4.2 kB view raw
1{ 2 lib, 3 stdenv, 4 rustPlatform, 5 fetchFromGitHub, 6 jre_minimal, 7 pkg-config, 8 autoPatchelfHook, 9 alsa-lib, 10 wayland, 11 libXcursor, 12 libXrandr, 13 libXi, 14 libX11, 15 libxcb, 16 vulkan-loader, 17 udev, 18 libxkbcommon, 19 openh264, 20 writeShellApplication, 21 curl, 22 jq, 23 nix-update, 24 withX11 ? true, 25 withRuffleTools ? false, 26}: 27 28rustPlatform.buildRustPackage (finalAttrs: { 29 pname = "ruffle"; 30 version = "0.2.0-nightly-2026-01-12"; 31 32 src = fetchFromGitHub { 33 owner = "ruffle-rs"; 34 repo = "ruffle"; 35 tag = lib.strings.removePrefix "0.2.0-" finalAttrs.version; 36 hash = "sha256-hEfxvRcjxj3ND/qM8WQQVTgOLR7Rf0P9Wfhyx38kxY4="; 37 }; 38 39 postPatch = 40 let 41 versionList = lib.versions.splitVersion openh264.version; 42 major = lib.elemAt versionList 0; 43 minor = lib.elemAt versionList 1; 44 patch = lib.elemAt versionList 2; 45 in 46 '' 47 substituteInPlace video/external/src/decoder/openh264.rs \ 48 --replace-fail "OpenH264Version(2, 4, 1)" \ 49 "OpenH264Version(${major}, ${minor}, ${patch})" 50 ''; 51 52 cargoHash = "sha256-MY+K/KZP2xxewoh413+mjjPj+40gq2GhzdMKteJhRLc="; 53 cargoBuildFlags = lib.optional withRuffleTools "--workspace"; 54 55 env = 56 let 57 tag = lib.strings.removePrefix "0.2.0-" finalAttrs.version; 58 versionDate = lib.strings.removePrefix "0.2.0-nightly-" finalAttrs.version; 59 in 60 { 61 VERGEN_IDEMPOTENT = "1"; 62 VERGEN_GIT_SHA = tag; 63 VERGEN_GIT_COMMIT_DATE = versionDate; 64 VERGEN_GIT_COMMIT_TIMESTAMP = "${versionDate}T00:00:00Z"; 65 }; 66 67 nativeBuildInputs = [ 68 jre_minimal 69 ] 70 ++ lib.optionals stdenv.hostPlatform.isLinux [ 71 pkg-config 72 autoPatchelfHook 73 ] 74 ++ lib.optionals stdenv.hostPlatform.isDarwin [ rustPlatform.bindgenHook ]; 75 76 buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ 77 alsa-lib 78 udev 79 (lib.getLib stdenv.cc.cc) 80 ]; 81 82 runtimeDependencies = lib.optionals stdenv.hostPlatform.isLinux ( 83 [ 84 wayland 85 libxkbcommon 86 vulkan-loader 87 openh264 88 ] 89 ++ lib.optionals withX11 [ 90 libXcursor 91 libXrandr 92 libXi 93 libX11 94 libxcb 95 ] 96 ); 97 98 postInstall = '' 99 mv $out/bin/ruffle_desktop $out/bin/ruffle 100 install -Dm644 LICENSE.md -t $out/share/doc/ruffle 101 install -Dm644 README.md -t $out/share/doc/ruffle 102 '' 103 + lib.optionalString stdenv.hostPlatform.isLinux '' 104 install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.desktop \ 105 -t $out/share/applications/ 106 107 install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.svg \ 108 -t $out/share/icons/hicolor/scalable/apps/ 109 110 install -Dm644 desktop/packages/linux/rs.ruffle.Ruffle.metainfo.xml \ 111 -t $out/share/metainfo/ 112 ''; 113 114 passthru = { 115 updateScript = lib.getExe (writeShellApplication { 116 name = "ruffle-update"; 117 runtimeInputs = [ 118 curl 119 jq 120 nix-update 121 ]; 122 text = '' 123 version="$( \ 124 curl https://api.github.com/repos/ruffle-rs/ruffle/releases?per_page=1 | \ 125 jq -r ".[0].tag_name" \ 126 )" 127 exec nix-update --version "0.2.0-$version" ruffle 128 ''; 129 }); 130 }; 131 132 meta = { 133 description = "Cross platform Adobe Flash Player emulator"; 134 longDescription = '' 135 Ruffle is a cross platform emulator for running and preserving 136 Adobe Flash content. It is capable of running ActionScript 1, 2 137 and 3 programs with machine-native performance thanks to being 138 written in the Rust programming language. 139 140 Additionally, overriding the `withRuffleTools` input to 141 `true` will build all the available packages in the ruffle 142 project, including the `exporter` and `scanner` utilities. 143 ''; 144 homepage = "https://ruffle.rs/"; 145 downloadPage = "https://ruffle.rs/downloads"; 146 license = [ 147 lib.licenses.mit 148 lib.licenses.asl20 149 ]; 150 changelog = "https://github.com/ruffle-rs/ruffle/releases/tag/${lib.strings.removePrefix "0.2.0-" finalAttrs.version}"; 151 maintainers = [ 152 lib.maintainers.jchw 153 ]; 154 mainProgram = "ruffle"; 155 platforms = lib.platforms.linux ++ lib.platforms.darwin; 156 }; 157})