Skip to content

Commit 323e48f

Browse files
authored
neovide: fix build on linux (#356292)
2 parents e018d49 + a9bd18d commit 323e48f

File tree

1 file changed

+71
-58
lines changed

1 file changed

+71
-58
lines changed

pkgs/by-name/ne/neovide/package.nix

Lines changed: 71 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1-
{ lib
2-
, rustPlatform
3-
, clangStdenv
4-
, fetchFromGitHub
5-
, linkFarm
6-
, fetchgit
7-
, runCommand
8-
, gn
9-
, neovim
10-
, ninja
11-
, makeWrapper
12-
, pkg-config
13-
, python3
14-
, removeReferencesTo
15-
, apple-sdk_11
16-
, cctools
17-
, SDL2
18-
, fontconfig
19-
, xorg
20-
, stdenv
21-
, libglvnd
22-
, libxkbcommon
23-
, enableWayland ? stdenv.hostPlatform.isLinux
24-
, wayland
1+
{
2+
lib,
3+
rustPlatform,
4+
clangStdenv,
5+
fetchFromGitHub,
6+
linkFarm,
7+
fetchgit,
8+
runCommand,
9+
gn,
10+
neovim,
11+
ninja,
12+
makeWrapper,
13+
pkg-config,
14+
python3,
15+
removeReferencesTo,
16+
apple-sdk_11,
17+
cctools,
18+
SDL2,
19+
fontconfig,
20+
xorg,
21+
stdenv,
22+
libglvnd,
23+
libxkbcommon,
24+
enableWayland ? stdenv.hostPlatform.isLinux,
25+
wayland,
2526
}:
2627

2728
rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
@@ -47,27 +48,32 @@ rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
4748
hash = "sha256-4l6ekAJy+pG27hBGT6A6LLRwbsyKinJf6PP6mMHwaAs=";
4849
};
4950
# The externals for skia are taken from skia/DEPS
50-
externals = linkFarm "skia-externals" (lib.mapAttrsToList
51-
(name: value: { inherit name; path = fetchgit value; })
52-
(lib.importJSON ./skia-externals.json));
51+
externals = linkFarm "skia-externals" (
52+
lib.mapAttrsToList (name: value: {
53+
inherit name;
54+
path = fetchgit value;
55+
}) (lib.importJSON ./skia-externals.json)
56+
);
5357
in
5458
runCommand "source" { } ''
5559
cp -R ${repo} $out
5660
chmod -R +w $out
5761
ln -s ${externals} $out/third_party/externals
58-
''
59-
;
62+
'';
6063

6164
SKIA_GN_COMMAND = "${gn}/bin/gn";
6265
SKIA_NINJA_COMMAND = "${ninja}/bin/ninja";
6366

64-
nativeBuildInputs = [
65-
cctools.libtool
66-
makeWrapper
67-
pkg-config
68-
python3 # skia
69-
removeReferencesTo
70-
];
67+
nativeBuildInputs =
68+
[
69+
makeWrapper
70+
pkg-config
71+
python3 # skia
72+
removeReferencesTo
73+
]
74+
++ lib.optionals stdenv.hostPlatform.isDarwin [
75+
cctools.libtool
76+
];
7177

7278
nativeCheckInputs = [ neovim ];
7379

@@ -77,16 +83,21 @@ rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
7783
rustPlatform.bindgenHook
7884
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 ];
7985

80-
postFixup = let
81-
libPath = lib.makeLibraryPath ([
82-
libglvnd
83-
libxkbcommon
84-
xorg.libXcursor
85-
xorg.libXext
86-
xorg.libXrandr
87-
xorg.libXi
88-
] ++ lib.optionals enableWayland [ wayland ]);
89-
in ''
86+
postFixup =
87+
let
88+
libPath = lib.makeLibraryPath (
89+
[
90+
libglvnd
91+
libxkbcommon
92+
xorg.libXcursor
93+
xorg.libXext
94+
xorg.libXrandr
95+
xorg.libXi
96+
]
97+
++ lib.optionals enableWayland [ wayland ]
98+
);
99+
in
100+
''
90101
# library skia embeds the path to its sources
91102
remove-references-to -t "$SKIA_SOURCE_DIR" \
92103
$out/bin/neovide
@@ -95,18 +106,20 @@ rustPlatform.buildRustPackage.override { stdenv = clangStdenv; } rec {
95106
--prefix LD_LIBRARY_PATH : ${libPath}
96107
'';
97108

98-
postInstall = lib.optionalString stdenv.hostPlatform.isDarwin ''
99-
mkdir -p $out/Applications
100-
cp -r extra/osx/Neovide.app $out/Applications
101-
ln -s $out/bin $out/Applications/Neovide.app/Contents/MacOS
102-
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
103-
for n in 16x16 32x32 48x48 256x256; do
104-
install -m444 -D "assets/neovide-$n.png" \
105-
"$out/share/icons/hicolor/$n/apps/neovide.png"
106-
done
107-
install -m444 -Dt $out/share/icons/hicolor/scalable/apps assets/neovide.svg
108-
install -m444 -Dt $out/share/applications assets/neovide.desktop
109-
'';
109+
postInstall =
110+
lib.optionalString stdenv.hostPlatform.isDarwin ''
111+
mkdir -p $out/Applications
112+
cp -r extra/osx/Neovide.app $out/Applications
113+
ln -s $out/bin $out/Applications/Neovide.app/Contents/MacOS
114+
''
115+
+ lib.optionalString stdenv.hostPlatform.isLinux ''
116+
for n in 16x16 32x32 48x48 256x256; do
117+
install -m444 -D "assets/neovide-$n.png" \
118+
"$out/share/icons/hicolor/$n/apps/neovide.png"
119+
done
120+
install -m444 -Dt $out/share/icons/hicolor/scalable/apps assets/neovide.svg
121+
install -m444 -Dt $out/share/applications assets/neovide.desktop
122+
'';
110123

111124
disallowedReferences = [ SKIA_SOURCE_DIR ];
112125

0 commit comments

Comments
 (0)