1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
{
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 [
(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.2.12";
src = fetchFromGitHub {
owner = "raphamorim";
repo = "rio";
rev = "v${version}";
hash = "sha256-NAg8Hm90CxRt3rthFas8IyAjc1oj/PSRjjG/5R68CD8=";
};
useFetchCargoVendor = true;
cargoHash = "sha256-myOZNiLdc9430jn5bSKtGmW4dY4yo7wt2Mf3dEQZaSs=";
nativeBuildInputs =
[
ncurses
]
++ lib.optionals stdenv.hostPlatform.isLinux [
cmake
pkg-config
autoPatchelfHook
];
runtimeDependencies = rlinkLibs;
buildInputs =
rlinkLibs
++ lib.optionals stdenv.hostPlatform.isDarwin [
darwin.libutil
];
outputs = [
"out"
"terminfo"
];
buildNoDefaultFeatures = true;
buildFeatures = [ ] ++ lib.optional withX11 "x11" ++ lib.optional withWayland "wayland";
checkFlags = [
# Fail to run in sandbox environment.
"--skip=sys::unix::eventedfd::EventedFd"
];
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 =
{
version = testers.testVersion { package = rio; };
}
// lib.optionalAttrs stdenv.buildPlatform.isLinux {
# FIXME: Restrict test execution inside nixosTests for Linux devices as ofborg
# 'passthru.tests' nixosTests are failing on Darwin architectures.
#
# Ref: https://github.com/NixOS/nixpkgs/issues/345825
test = nixosTests.terminal-emulators.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";
};
}
|