diff --git a/.envrc b/.envrc new file mode 100644 index 000000000..3550a30f2 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index af5f3d3a8..af0ee1ba1 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ build/ # Rust build artifacts /target + +# direnv has been claimed for Nix usage +.direnv/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e3f58fce8..055bb14e0 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -9,7 +9,8 @@ "esbenp.prettier-vscode", "rust-lang.rust-analyzer", "bradlc.vscode-tailwindcss", - "EditorConfig.EditorConfig" + "EditorConfig.EditorConfig", + "macabeus.vscode-fluent", ], // List of extensions recommended by VS Code that should not be recommended for users of this workspace. "unwantedRecommendations": [] diff --git a/flake.lock b/flake.lock new file mode 100644 index 000000000..9a147acc6 --- /dev/null +++ b/flake.lock @@ -0,0 +1,93 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1675410244, + "narHash": "sha256-ODj6egMoH/HgAF/0wIy0EfRBeUx5FMuLl6uAdUW3kCI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "f7543a7539a007e9562e4d8d24e17a4bcf369b68", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "ref": "nixos-22.11", + "type": "indirect" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1665296151, + "narHash": "sha256-uOB0oxqxN9K7XGF1hcnY+PQnlQJ+3bP2vCn/+Ru/bbc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "14ccaaedd95a488dd7ae142757884d8e125b3363", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1675391458, + "narHash": "sha256-ukDKZw922BnK5ohL9LhwtaDAdCsJL7L6ScNEyF1lO9w=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "383a4acfd11d778d5c2efcf28376cbd845eeaedf", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 000000000..0d448cd0e --- /dev/null +++ b/flake.nix @@ -0,0 +1,83 @@ +{ + description = "Server app for SlimeVR ecosystem"; + + inputs.nixpkgs.url = "nixpkgs/nixos-22.11"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + inputs.rust-overlay.url = "github:oxalica/rust-overlay"; + + outputs = { + self, + nixpkgs, + flake-utils, + rust-overlay, + }: + flake-utils.lib.eachDefaultSystem + ( + system: let + overlays = [(import rust-overlay)]; + pkgs = import nixpkgs { + inherit system overlays; + }; + rustTarget = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml; + nativeBuildInputs = with pkgs; [ + curl + gcc + openssl + pkgconfig + which + zlib + + freetype + expat + ]; + buildInputs = with pkgs; [ + appimagekit + atk + cairo + dbus + dbus.lib + dprint + gdk-pixbuf + glib.out + gobject-introspection + gtk3 + harfbuzz + libayatana-appindicator-gtk3 + libffi + libsoup + openssl.out + pango + pkg-config + treefmt + webkitgtk + zlib + + # Some nice things to have + exa + fd + + jdk # JDK17 + nodejs + gradle + ]; + in { + devShells.default = pkgs.mkShell { + nativeBuildInputs = + nativeBuildInputs + ++ [ + ]; + buildInputs = + buildInputs + ++ [ + rustTarget + ]; + + shellHook = '' + alias ls=exa + alias find=fd + ''; + }; + } + ); +} diff --git a/gui/scripts/check-missing.js b/gui/scripts/check-missing.js index 79772b3f4..84bbc46a0 100755 --- a/gui/scripts/check-missing.js +++ b/gui/scripts/check-missing.js @@ -1,4 +1,4 @@ -#!/bin/node +#!/usr/bin/env node /* Process exit codes: First bit: Fluent syntax error in english file diff --git a/gui/scripts/convert-fluent.js b/gui/scripts/convert-fluent.js index c2013f46e..055b8d1e5 100755 --- a/gui/scripts/convert-fluent.js +++ b/gui/scripts/convert-fluent.js @@ -1,4 +1,4 @@ -#!/bin/node +#!/usr/bin/env node // eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require('fs'); // eslint-disable-next-line @typescript-eslint/no-var-requires diff --git a/shell.nix b/shell.nix new file mode 100644 index 000000000..6d642dc59 --- /dev/null +++ b/shell.nix @@ -0,0 +1,2 @@ +# Just uses the flake. For the nix-env addon (which is kind of dead) users, I use the direnv addon. +(builtins.getFlake ("git+file://" + toString ./.)).devShells.${builtins.currentSystem}.default diff --git a/solarxr-protocol b/solarxr-protocol index ecf32d93d..e1e01c933 160000 --- a/solarxr-protocol +++ b/solarxr-protocol @@ -1 +1 @@ -Subproject commit ecf32d93dad49a3b03d944c48cd1233f2d632cf6 +Subproject commit e1e01c933e32136f019fc5c07c65a2527b1cb23c