forked from gpui-ce/gpui-ce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
121 lines (105 loc) · 2.85 KB
/
flake.nix
File metadata and controls
121 lines (105 loc) · 2.85 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
{
description = "Standalone GPUI build";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
fenix,
crane,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (pkgs) lib;
toolchain = fenix.packages.${system}.latest.withComponents [
"cargo"
"rustc"
"rust-src"
"rustfmt"
"clippy"
];
craneLib = (crane.mkLib pkgs).overrideToolchain toolchain;
src = lib.cleanSourceWith {
src = craneLib.path ./.;
filter =
path: type:
(craneLib.filterCargoSources path type)
|| (lib.hasSuffix ".metal" path)
|| (lib.hasSuffix ".wgsl" path)
|| (lib.hasSuffix ".hlsl" path)
|| (lib.hasSuffix ".glsl" path);
};
linuxLibs = with pkgs; [
alsa-lib
libdrm
mesa # provides libgbm
libxkbcommon
libva
vulkan-loader
wayland
xorg.libX11
xorg.libxcb
];
commonArgs = {
pname = "gpui-ce";
version = "0.3.3";
inherit src;
strictDeps = true;
nativeBuildInputs = with pkgs; [
cmake
pkg-config
rustPlatform.bindgenHook
];
buildInputs =
with pkgs;
[
fontconfig
freetype
openssl
zlib
]
++ lib.optionals stdenv.isLinux linuxLibs
++ lib.optionals stdenv.isDarwin [
apple-sdk_15
(darwinMinVersionHook "11.0")
];
env = lib.optionalAttrs pkgs.stdenv.isLinux {
LD_LIBRARY_PATH = lib.makeLibraryPath linuxLibs;
};
cargoExtraArgs = "--features runtime_shaders";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
gpui = craneLib.buildPackage (
commonArgs
// {
inherit cargoArtifacts;
}
);
in
{
packages.default = gpui;
devShells.default = pkgs.mkShell {
inputsFrom = [ gpui ];
packages = [ toolchain ];
shellHook = ''
export RUST_BACKTRACE=1
export RUST_SRC_PATH="${toolchain}/lib/rustlib/src/rust/library"
${lib.optionalString pkgs.stdenv.isLinux ''
export LD_LIBRARY_PATH="${lib.makeLibraryPath linuxLibs}:$LD_LIBRARY_PATH"
''}
'';
};
}
);
}