forked from SlimeVR/SlimeVR-Server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
152 lines (139 loc) · 4.58 KB
/
flake.nix
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
152
{
description = "Affordable full-body tracking for VR!";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
devenv.url = "github:cachix/devenv";
nix2container = {
url = "github:nlewo/nix2container";
inputs.nixpkgs.follows = "nixpkgs";
};
mk-shell-bin.url = "github:rrbutani/nix-mk-shell-bin";
nixgl = {
url = "github:guibou/nixGL";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
nixConfig = {
extra-trusted-public-keys = "devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw=";
extra-substituters = "https://devenv.cachix.org";
};
outputs = inputs @ {
self,
flake-parts,
nixgl,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
imports = [
inputs.devenv.flakeModule
];
systems = ["x86_64-linux" "i686-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin"];
perSystem = {
config,
self',
inputs',
pkgs,
system,
lib,
...
}: {
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
# Equivalent to inputs'.nixpkgs.legacyPackages.hello;
# packages.default = pkgs.hello;
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [nixgl.overlay];
};
devenv.shells.default = let
fenixpkgs = inputs'.fenix.packages;
rust_toolchain = lib.importTOML ./rust-toolchain.toml;
in {
name = "slimevr";
imports = [
# This is just like the imports in devenv.nix.
# See https://devenv.sh/guides/using-with-flake-parts/#import-a-devenv-module
# ./devenv-foo.nix
];
# https://devenv.sh/reference/options/
packages =
(with pkgs; [
pkgs.nixgl.nixGLIntel
cacert
])
++ lib.optionals pkgs.stdenv.isLinux (with pkgs; [
appimagekit
atk
cairo
dbus
dbus.lib
dprint
gdk-pixbuf
glib.out
glib-networking
gobject-introspection
gtk3
harfbuzz
libffi
libsoup_3
openssl
pango
pkg-config
treefmt
webkitgtk_4_1
zlib
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
gst_all_1.gst-plugins-good
gst_all_1.gst-plugins-bad
librsvg
freetype
expat
libayatana-appindicator
libusb1
])
++ lib.optionals pkgs.stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
];
languages.java = {
enable = true;
gradle.enable = true;
jdk.package = pkgs.jdk17;
};
languages.kotlin.enable = true;
languages.javascript = {
enable = true;
corepack.enable = true;
};
languages.rust = {
enable = true;
toolchain = fenixpkgs.fromToolchainName {
name = rust_toolchain.toolchain.channel;
sha256 = "sha256-VZZnlyP69+Y3crrLHQyJirqlHrTtGTsyiSnZB8jEvVo=";
};
components = rust_toolchain.toolchain.components;
};
env = {
GIO_EXTRA_MODULES = "${pkgs.glib-networking}/lib/gio/modules:${pkgs.dconf.lib}/lib/gio/modules";
};
enterShell = with pkgs; ''
# Export a LD_LIBRARY_PATH without libudev-zero as libgudev not likey
export SLIMEVR_RUST_LD_LIBRARY_PATH="$LD_LIBRARY_PATH"
export LD_LIBRARY_PATH="${libudev-zero}/lib:$LD_LIBRARY_PATH"
# GStreamer plugins won't be found without this
export GST_PLUGIN_SYSTEM_PATH_1_0="${pkgs.gst_all_1.gstreamer.out}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-base}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-good}/lib/gstreamer-1.0:${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0"
'';
};
};
flake = {
# The usual flake attributes can be defined here, including system-
# agnostic ones like nixosModule and system-enumerating ones, although
# those are more easily expressed in perSystem.
};
};
}