Unverified Commit 224709bb authored by Olivér Falvai's avatar Olivér Falvai
Browse files

rio: format with nixfmt-rfc-style

parent 254bf2a3
Loading
Loading
Loading
Loading
+106 −86
Original line number Diff line number Diff line
{ lib
, stdenv
, darwin
, fetchFromGitHub
, rustPlatform
, nixosTests
, nix-update-script

, autoPatchelfHook
, cmake
, ncurses
, pkg-config

, gcc-unwrapped
, fontconfig
, libGL
, vulkan-loader
, libxkbcommon

, withX11 ? !stdenv.hostPlatform.isDarwin
, libX11
, libXcursor
, libXi
, libXrandr
, libxcb

, withWayland ? !stdenv.hostPlatform.isDarwin
, wayland

, testers
, rio
{
  lib,
  stdenv,
  darwin,
  fetchFromGitHub,
  rustPlatform,
  nixosTests,
  nix-update-script,

  autoPatchelfHook,
  cmake,
  ncurses,
  pkg-config,

  gcc-unwrapped,
  fontconfig,
  libGL,
  vulkan-loader,
  libxkbcommon,

  withX11 ? !stdenv.hostPlatform.isDarwin,
  libX11,
  libXcursor,
  libXi,
  libXrandr,
  libxcb,

  withWayland ? !stdenv.hostPlatform.isDarwin,
  wayland,

  testers,
  rio,
}:
let
  rlinkLibs = lib.optionals stdenv.hostPlatform.isLinux [
  rlinkLibs =
    lib.optionals stdenv.hostPlatform.isLinux [
      (lib.getLib gcc-unwrapped)
      fontconfig
      libGL
      libxkbcommon
      vulkan-loader
  ] ++ lib.optionals withX11 [
    ]
    ++ lib.optionals withX11 [
      libX11
      libXcursor
      libXi
      libXrandr
      libxcb
  ] ++ lib.optionals withWayland [
    ]
    ++ lib.optionals withWayland [
      wayland
    ];
in
@@ -60,9 +64,11 @@ rustPlatform.buildRustPackage rec {

  cargoHash = "sha256-yGOvY5+ThSey/k8ilTTC0CzaOIJtc4hDYmdrHJC3HyE=";

  nativeBuildInputs = [
  nativeBuildInputs =
    [
      ncurses
  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
    ]
    ++ lib.optionals stdenv.hostPlatform.isLinux [
      cmake
      pkg-config
      autoPatchelfHook
@@ -70,23 +76,27 @@ rustPlatform.buildRustPackage rec {

  runtimeDependencies = rlinkLibs;

  buildInputs = rlinkLibs ++ lib.optionals stdenv.hostPlatform.isDarwin [
  buildInputs =
    rlinkLibs
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      darwin.libutil
    ];

  outputs = [ "out" "terminfo" ];
  outputs = [
    "out"
    "terminfo"
  ];

  buildNoDefaultFeatures = true;
  buildFeatures = [ ]
    ++ lib.optional withX11 "x11"
    ++ lib.optional withWayland "wayland";
  buildFeatures = [ ] ++ lib.optional withX11 "x11" ++ lib.optional withWayland "wayland";

  checkFlags = [
    # Fail to run in sandbox environment.
    "--skip=sys::unix::eventedfd::EventedFd"
  ];

  postInstall = ''
  postInstall =
    ''
      install -D -m 644 misc/rio.desktop -t $out/share/applications
      install -D -m 644 misc/logo.svg \
                        $out/share/icons/hicolor/scalable/apps/rio.svg
@@ -95,7 +105,8 @@ rustPlatform.buildRustPackage rec {
      tic -xe rio,rio-direct -o "$terminfo/share/terminfo" misc/rio.terminfo
      mkdir -p $out/nix-support
      echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
  '' + lib.optionalString stdenv.hostPlatform.isDarwin ''
    ''
    + lib.optionalString stdenv.hostPlatform.isDarwin ''
      mkdir $out/Applications/
      mv misc/osx/Rio.app/ $out/Applications/
      mkdir $out/Applications/Rio.app/Contents/MacOS/
@@ -104,12 +115,17 @@ rustPlatform.buildRustPackage rec {

  passthru = {
    updateScript = nix-update-script {
      extraArgs = [ "--version-regex" "v([0-9.]+)" ];
      extraArgs = [
        "--version-regex"
        "v([0-9.]+)"
      ];
    };

    tests = {
    tests =
      {
        version = testers.testVersion { package = rio; };
    } // lib.optionalAttrs stdenv.buildPlatform.isLinux {
      }
      // lib.optionalAttrs stdenv.buildPlatform.isLinux {
        # FIXME: Restrict test execution inside nixosTests for Linux devices as ofborg
        # 'passthru.tests' nixosTests are failing on Darwin architectures.
        #
@@ -122,7 +138,11 @@ rustPlatform.buildRustPackage rec {
    description = "Hardware-accelerated GPU terminal emulator powered by WebGPU";
    homepage = "https://raphamorim.io/rio";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ tornax otavio oluceps ];
    maintainers = with lib.maintainers; [
      tornax
      otavio
      oluceps
    ];
    platforms = lib.platforms.unix;
    changelog = "https://github.com/raphamorim/rio/blob/v${version}/docs/docs/releases.md";
    mainProgram = "rio";