rio: fix build on darwin

This commit is contained in:
Mario Rodas 2023-11-17 04:20:00 +00:00 committed by Jörg Thalheim
parent f81ef747b1
commit 87c6a971de

View file

@ -1,4 +1,6 @@
{ lib { lib
, stdenv
, darwin
, fetchFromGitHub , fetchFromGitHub
, rustPlatform , rustPlatform
, nixosTests , nixosTests
@ -14,18 +16,21 @@
, vulkan-loader , vulkan-loader
, libxkbcommon , libxkbcommon
, withX11 ? true , withX11 ? !stdenv.isDarwin
, libX11 , libX11
, libXcursor , libXcursor
, libXi , libXi
, libXrandr , libXrandr
, libxcb , libxcb
, withWayland ? true , withWayland ? !stdenv.isDarwin
, wayland , wayland
}: }:
let let
rlinkLibs = [ rlinkLibs = if stdenv.isDarwin then [
darwin.libobjc
darwin.apple_sdk.frameworks.AppKit
] else [
(lib.getLib gcc-unwrapped) (lib.getLib gcc-unwrapped)
fontconfig fontconfig
libGL libGL
@ -55,9 +60,10 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-XD+/DaaJEJ9jHZITTUma/wfsbduPUTc/SralPOx46Yo="; cargoHash = "sha256-XD+/DaaJEJ9jHZITTUma/wfsbduPUTc/SralPOx46Yo=";
nativeBuildInputs = [ nativeBuildInputs = [
autoPatchelfHook
ncurses ncurses
] ++ lib.optionals stdenv.isLinux [
pkg-config pkg-config
autoPatchelfHook
]; ];
runtimeDependencies = rlinkLibs; runtimeDependencies = rlinkLibs;
@ -67,10 +73,9 @@ rustPlatform.buildRustPackage rec {
outputs = [ "out" "terminfo" ]; outputs = [ "out" "terminfo" ];
buildNoDefaultFeatures = true; buildNoDefaultFeatures = true;
buildFeatures = [ buildFeatures = [ ]
(lib.optionalString withX11 "x11") ++ lib.optional withX11 "x11"
(lib.optionalString withWayland "wayland") ++ lib.optional withWayland "wayland";
];
checkFlags = [ checkFlags = [
# Fail to run in sandbox environment. # Fail to run in sandbox environment.
@ -86,6 +91,11 @@ rustPlatform.buildRustPackage rec {
tic -xe rio,rio-direct -o "$terminfo/share/terminfo" misc/rio.terminfo tic -xe rio,rio-direct -o "$terminfo/share/terminfo" misc/rio.terminfo
mkdir -p $out/nix-support mkdir -p $out/nix-support
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
'' + lib.optionalString stdenv.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 = { passthru = {