nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 147 lines 3.3 kB view raw
1{ 2 lib, 3 stdenv, 4 darwin, 5 fetchFromGitHub, 6 rustPlatform, 7 nixosTests, 8 nix-update-script, 9 10 autoPatchelfHook, 11 cmake, 12 ncurses, 13 pkg-config, 14 15 gcc-unwrapped, 16 fontconfig, 17 libGL, 18 vulkan-loader, 19 libxkbcommon, 20 21 withX11 ? !stdenv.hostPlatform.isDarwin, 22 libX11, 23 libXcursor, 24 libXi, 25 libXrandr, 26 libxcb, 27 28 withWayland ? !stdenv.hostPlatform.isDarwin, 29 wayland, 30 31 testers, 32 rio, 33}: 34let 35 rlinkLibs = 36 lib.optionals stdenv.hostPlatform.isLinux [ 37 (lib.getLib gcc-unwrapped) 38 fontconfig 39 libGL 40 libxkbcommon 41 vulkan-loader 42 ] 43 ++ lib.optionals withX11 [ 44 libX11 45 libXcursor 46 libXi 47 libXrandr 48 libxcb 49 ] 50 ++ lib.optionals withWayland [ 51 wayland 52 ]; 53in 54rustPlatform.buildRustPackage (finalAttrs: { 55 pname = "rio"; 56 version = "0.2.23"; 57 58 src = fetchFromGitHub { 59 owner = "raphamorim"; 60 repo = "rio"; 61 tag = "v${finalAttrs.version}"; 62 hash = "sha256-hhKlXuhv0PP8/xCIZ0lFGtCYCzOzH0gUeh48GdKpG6A="; 63 }; 64 65 cargoHash = "sha256-+pfudGeWq4EARQDu+HAZczWlzStuzDPArMm1oCZGfKU="; 66 67 nativeBuildInputs = [ 68 ncurses 69 ] 70 ++ lib.optionals stdenv.hostPlatform.isLinux [ 71 cmake 72 pkg-config 73 autoPatchelfHook 74 ]; 75 76 runtimeDependencies = rlinkLibs; 77 78 buildInputs = 79 rlinkLibs 80 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 81 darwin.libutil 82 ]; 83 84 outputs = [ 85 "out" 86 "terminfo" 87 ]; 88 89 buildNoDefaultFeatures = true; 90 buildFeatures = [ ] ++ lib.optional withX11 "x11" ++ lib.optional withWayland "wayland"; 91 92 checkFlags = [ 93 # Fail to run in sandbox environment. 94 "--skip=sys::unix::eventedfd::EventedFd" 95 ]; 96 97 postInstall = '' 98 install -D -m 644 misc/rio.desktop -t $out/share/applications 99 install -D -m 644 misc/logo.svg \ 100 $out/share/icons/hicolor/scalable/apps/rio.svg 101 102 install -dm 755 "$terminfo/share/terminfo/r/" 103 tic -xe rio,rio-direct -o "$terminfo/share/terminfo" misc/rio.terminfo 104 mkdir -p $out/nix-support 105 echo "$terminfo" >> $out/nix-support/propagated-user-env-packages 106 '' 107 + lib.optionalString stdenv.hostPlatform.isDarwin '' 108 mkdir $out/Applications/ 109 mv misc/osx/Rio.app/ $out/Applications/ 110 mkdir $out/Applications/Rio.app/Contents/MacOS/ 111 ln -s $out/bin/rio $out/Applications/Rio.app/Contents/MacOS/ 112 ''; 113 114 passthru = { 115 updateScript = nix-update-script { 116 extraArgs = [ 117 "--version-regex" 118 "v([0-9.]+)" 119 ]; 120 }; 121 122 tests = { 123 version = testers.testVersion { package = rio; }; 124 } 125 // lib.optionalAttrs stdenv.buildPlatform.isLinux { 126 # FIXME: Restrict test execution inside nixosTests for Linux devices as ofborg 127 # 'passthru.tests' nixosTests are failing on Darwin architectures. 128 # 129 # Ref: https://github.com/NixOS/nixpkgs/issues/345825 130 test = nixosTests.terminal-emulators.rio; 131 }; 132 }; 133 134 meta = { 135 description = "Hardware-accelerated GPU terminal emulator powered by WebGPU"; 136 homepage = "https://raphamorim.io/rio"; 137 license = lib.licenses.mit; 138 maintainers = with lib.maintainers; [ 139 tornax 140 otavio 141 oluceps 142 ]; 143 platforms = lib.platforms.unix; 144 changelog = "https://github.com/raphamorim/rio/blob/v${finalAttrs.version}/docs/docs/releases.md"; 145 mainProgram = "rio"; 146 }; 147})