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