mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-12 08:43:06 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
136 lines
3.3 KiB
Nix
136 lines
3.3 KiB
Nix
{ 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 = if stdenv.hostPlatform.isDarwin then [
|
|
darwin.libobjc
|
|
darwin.apple_sdk_11_0.frameworks.AppKit
|
|
darwin.apple_sdk_11_0.frameworks.AVFoundation
|
|
darwin.apple_sdk_11_0.frameworks.MetalKit
|
|
darwin.apple_sdk_11_0.frameworks.Vision
|
|
] else [
|
|
(lib.getLib gcc-unwrapped)
|
|
fontconfig
|
|
libGL
|
|
libxkbcommon
|
|
vulkan-loader
|
|
] ++ lib.optionals withX11 [
|
|
libX11
|
|
libXcursor
|
|
libXi
|
|
libXrandr
|
|
libxcb
|
|
] ++ lib.optionals withWayland [
|
|
wayland
|
|
];
|
|
in
|
|
rustPlatform.buildRustPackage rec {
|
|
pname = "rio";
|
|
version = "0.1.15";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "raphamorim";
|
|
repo = "rio";
|
|
rev = "v${version}";
|
|
hash = "sha256-aLqWhRaNqi7gMDxBITLU/Tj//h7RURycLSZXOOq83As=";
|
|
};
|
|
|
|
cargoHash = "sha256-4nqJbz2vauO4jRuUSDjBV1pVrAJMhIP4+eUwS1+GecU=";
|
|
|
|
nativeBuildInputs = [
|
|
ncurses
|
|
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
|
cmake
|
|
pkg-config
|
|
autoPatchelfHook
|
|
];
|
|
|
|
runtimeDependencies = rlinkLibs;
|
|
|
|
buildInputs = rlinkLibs;
|
|
|
|
outputs = [ "out" "terminfo" ];
|
|
|
|
buildNoDefaultFeatures = true;
|
|
buildFeatures = [ ]
|
|
++ lib.optional withX11 "x11"
|
|
++ lib.optional withWayland "wayland";
|
|
|
|
checkFlags = [
|
|
# Fail to run in sandbox environment.
|
|
"--skip=screen::context::test"
|
|
];
|
|
|
|
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
|
|
|
|
install -dm 755 "$terminfo/share/terminfo/r/"
|
|
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 ''
|
|
mkdir $out/Applications/
|
|
mv misc/osx/Rio.app/ $out/Applications/
|
|
mkdir $out/Applications/Rio.app/Contents/MacOS/
|
|
ln -s $out/bin/rio $out/Applications/Rio.app/Contents/MacOS/
|
|
'';
|
|
|
|
passthru = {
|
|
updateScript = nix-update-script {
|
|
extraArgs = [ "--version-regex" "v([0-9.]+)" ];
|
|
};
|
|
|
|
tests = {
|
|
test = nixosTests.terminal-emulators.rio;
|
|
version = testers.testVersion { package = rio; };
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
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 ];
|
|
platforms = lib.platforms.unix;
|
|
changelog = "https://github.com/raphamorim/rio/blob/v${version}/docs/docs/releases.md";
|
|
mainProgram = "rio";
|
|
# ---- corcovado/src/sys/unix/eventedfd.rs - sys::unix::eventedfd::EventedFd (line 31) stdout ----
|
|
# Test executable failed (exit status: 101).
|
|
# stderr:
|
|
# thread 'main' panicked at corcovado/src/sys/unix/eventedfd.rs:24:16:
|
|
# called `Result::unwrap()` on an `Err` value: Os { code: 1, kind: PermissionDenied, message: "Operation not permitted" }
|
|
broken = stdenv.hostPlatform.isDarwin;
|
|
};
|
|
}
|