Skip to content

Commit e1e01c9

Browse files
authored
Nixify solarxr (#95)
* nixify solarxr * check for relative in bash script
1 parent 28a64d3 commit e1e01c9

File tree

6 files changed

+88
-10
lines changed

6 files changed

+88
-10
lines changed

.envrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ node_modules/
3232
# Flatc compiler symlink
3333
/flatc
3434
/flatc.exe
35+
36+
# direnv has been claimed for Nix usage
37+
.direnv/

flake.lock

+42
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
description = "A hardware-agnostic serialization protocol for full body tracking (FBT) in VR";
3+
4+
inputs.nixpkgs.url = "nixpkgs/nixos-22.11";
5+
inputs.flake-utils.url = "github:numtide/flake-utils";
6+
7+
outputs = {
8+
self,
9+
nixpkgs,
10+
flake-utils,
11+
}:
12+
flake-utils.lib.eachDefaultSystem
13+
(
14+
system: let
15+
pkgs = nixpkgs.legacyPackages.${system};
16+
in {
17+
devShells.default = import ./shell.nix {inherit pkgs;};
18+
}
19+
);
20+
}

generate-flatbuffer.sh

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22
set -e
33
VERSION="22.10.26"
44

5-
if [[ "$(./flatc --version)" != "flatc version $VERSION" ]]; then
5+
if [[ -f "./flatc" ]]; then
6+
PATH="./:$PATH"
7+
fi
8+
9+
if [[ "$(flatc --version)" != "flatc version $VERSION" ]]; then
610
echo "Flatc must be $VERSION"
711
exit 1
812
fi
913

10-
rm -rf protocol/java/src
11-
rm -rf protocol/cpp/include/solarxr_protocol/generated
12-
rm -rf protocol/typescript/src
14+
rm -rf protocol/java/src
15+
rm -rf protocol/cpp/include/solarxr_protocol/generated
16+
rm -rf protocol/typescript/src
1317
rm -rf protocol/rust/src/generated
1418
rm -rf protocol/kotlin/src
1519

16-
./flatc --java --gen-object-api --gen-all -o ./protocol/java/src -I ./schema/ ./schema/all.fbs && \
17-
./flatc --cpp --scoped-enums --gen-all -o ./protocol/cpp/include/solarxr_protocol/generated -I ./schema/ ./schema/all.fbs && \
18-
./flatc --ts --gen-object-api --gen-all -o ./protocol/typescript/src -I ./schema/ ./schema/all.fbs && \
19-
./flatc --rust --rust-module-root-file --gen-all -o ./protocol/rust/src/generated ./schema/all.fbs && \
20-
./flatc --kotlin --gen-jvmstatic --gen-all -o ./protocol/kotlin/src -I ./schema/ ./schema/all.fbs
20+
flatc --java --gen-object-api --gen-all -o ./protocol/java/src -I ./schema/ ./schema/all.fbs && \
21+
flatc --cpp --scoped-enums --gen-all -o ./protocol/cpp/include/solarxr_protocol/generated -I ./schema/ ./schema/all.fbs && \
22+
flatc --ts --gen-object-api --gen-all -o ./protocol/typescript/src -I ./schema/ ./schema/all.fbs && \
23+
flatc --rust --rust-module-root-file --gen-all -o ./protocol/rust/src/generated ./schema/all.fbs && \
24+
flatc --kotlin --gen-jvmstatic --gen-all -o ./protocol/kotlin/src -I ./schema/ ./schema/all.fbs

shell.nix

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{pkgs ? import <nixpkgs> {}}:
2+
with pkgs;
3+
mkShell {
4+
nativeBuildInputs = [
5+
flatbuffers
6+
direnv
7+
];
8+
}

0 commit comments

Comments
 (0)