-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpkgRio.nix
More file actions
131 lines (123 loc) · 3.29 KB
/
Copy pathpkgRio.nix
File metadata and controls
131 lines (123 loc) · 3.29 KB
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
{
# rust-overlay deps
rust-toolchain,
makeRustPlatform,
# Normal deps
lib,
stdenv,
darwin,
autoPatchelfHook,
cmake,
ncurses,
pkg-config,
gcc-unwrapped,
fontconfig,
libGL,
vulkan-loader,
libxkbcommon,
withX11 ? !stdenv.isDarwin,
libX11,
libXcursor,
libXi,
libXrandr,
libxcb,
withWayland ? !stdenv.isDarwin,
wayland,
shaderc,
...
}: let
readTOML = f: builtins.fromTOML (builtins.readFile f);
cargoToml = readTOML ./Cargo.toml;
rioToml = readTOML ./frontends/rioterm/Cargo.toml;
rustPlatform = makeRustPlatform {
cargo = rust-toolchain;
rustc = rust-toolchain;
};
rlinkLibs =
lib.optionals stdenv.isLinux [
(lib.getLib gcc-unwrapped)
fontconfig
libGL
libxkbcommon
vulkan-loader
]
++ lib.optionals withX11 [
libX11
libXcursor
libXi
libXrandr
libxcb
]
++ lib.optionals withWayland [
wayland
];
inherit (lib.fileset) unions toSource;
in
rustPlatform.buildRustPackage {
inherit (cargoToml.workspace.package) version;
name = "rio";
src = toSource {
root = ./.;
fileset = unions ([
./Cargo.lock
./Cargo.toml
./misc # Extra desktop/terminfo files
]
++ (map (x: ./. + "/${x}") cargoToml.workspace.members));
};
cargoLock = {
lockFile = ./Cargo.lock;
outputHashes = {
"yazelix_cursors-0.1.0" = "sha256-Ait54BZqYf+bg/fQSC9I0r2cypZtMKRWISN/yNr8eLs=";
};
};
cargoBuildFlags = "-p rioterm";
# Cargo CI owns the workspace test suite; this derivation owns the optimized package build.
doCheck = false;
buildInputs = rlinkLibs ++ (lib.optionals stdenv.isDarwin [darwin.libutil]);
runtimeDependencies = rlinkLibs;
nativeBuildInputs =
[
rustPlatform.bindgenHook
ncurses
shaderc
]
++ lib.optionals stdenv.isLinux [
cmake
pkg-config
autoPatchelfHook
];
outputs = [
"out"
"terminfo"
];
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 terminfo files
install -dm 755 "$terminfo/share/terminfo/r/"
tic -xe xterm-rio,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/
'';
buildNoDefaultFeatures = true;
buildFeatures = (lib.optionals withX11 ["x11"]) ++ (lib.optionals withWayland ["wayland"]);
meta = {
description = rioToml.package.description;
longDescription = rioToml.package.extended-description;
homepage = cargoToml.workspace.package.homepage;
license = lib.licenses.mit;
platforms = lib.platforms.unix;
changelog = "https://github.com/raphamorim/rio/blob/master/CHANGELOG.md";
mainProgram = "rio";
};
}