diff --git a/.github/workflows/NixFlakeCheck.yml b/.github/workflows/NixFlakeCheck.yml new file mode 100644 index 0000000000..72fcd4a87e --- /dev/null +++ b/.github/workflows/NixFlakeCheck.yml @@ -0,0 +1,28 @@ +--- +name: Nix Flake - Check + +on: + workflow_dispatch: {} + push: + branches: [ prod, dev ] + pull_request: + branches: [ prod, dev ] + +jobs: + flake-check: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + + - uses: cachix/install-nix-action@v31 + + - run: nix flake check + + formatting-check: + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v6 + + - uses: cachix/install-nix-action@v31 + + - run: nix fmt -- --ci diff --git a/.gitignore b/.gitignore index bdcb57b628..903449744b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,5 @@ renderer/ .DS_Store *.pkg *.exe -.idea \ No newline at end of file +.idea +**/.direnv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 849ff17e3f..c6409fd311 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,6 +23,14 @@ Be sure to fill out the pull request template accordingly to make reviewing your # How to Contribute +### Development with Nix + +It's entirely possible to contribute to Synthesis without using Nix, but some may +prefer to use it. In order to use Nix with synthesis, you must first [install nix](https://nixos.org/download/), +[enable flakes](https://wiki.nixos.org/wiki/Flakes#Setup), then you can enter +one of shells with `nix develop` (e.g. `nix develop .#syntehsis`). You can also +use [direnv](https://direnv.net/) to automatically enter into the relevant dev-shell. + ### Found a bug? Have an idea for a feature? Please [contact us](#Contact-Us) to let us know about the issue or feature! diff --git a/exporter/.envrc b/exporter/.envrc new file mode 100644 index 0000000000..6ea2921ca0 --- /dev/null +++ b/exporter/.envrc @@ -0,0 +1,3 @@ +if command -v nix &>/dev/null; then + use flake .#exporter +fi diff --git a/fission/.envrc b/fission/.envrc new file mode 100644 index 0000000000..71aeecdbba --- /dev/null +++ b/fission/.envrc @@ -0,0 +1,3 @@ +if command -v nix &>/dev/null; then + use flake .#fission +fi diff --git a/fission/flake.lock b/flake.lock similarity index 70% rename from fission/flake.lock rename to flake.lock index ab5f11367e..bbfee60198 100644 --- a/fission/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1755186698, - "narHash": "sha256-wNO3+Ks2jZJ4nTHMuks+cxAiVBGNuEBXsT29Bz6HASo=", + "lastModified": 1777268161, + "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fbcf476f790d8a217c3eab4e12033dc4a0f6d23c", + "rev": "1c3fe55ad329cbcb28471bb30f05c9827f724c76", "type": "github" }, "original": { diff --git a/fission/flake.nix b/flake.nix similarity index 54% rename from fission/flake.nix rename to flake.nix index 71d3f45ab4..5515ea04ca 100644 --- a/fission/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; outputs = - inputs: + { self, nixpkgs }: let supportedSystems = [ "x86_64-linux" @@ -13,12 +13,16 @@ "aarch64-darwin" ]; forEachSupportedSystem = - f: inputs.nixpkgs.lib.genAttrs supportedSystems (system: f inputs.nixpkgs.legacyPackages.${system}); + f: nixpkgs.lib.genAttrs supportedSystems (system: f nixpkgs.legacyPackages.${system}); in { devShells = forEachSupportedSystem (pkgs: { - default = pkgs.mkShell { + default = self.devShells.${pkgs.stdenv.hostPlatform.system}.fission; + fission = pkgs.mkShell { nativeBuildInputs = with pkgs; [ + nodejs + bun + git-lfs playwright-driver.browsers ]; @@ -27,8 +31,19 @@ PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = true; }; }; + exporter = pkgs.mkShell { + packages = with pkgs; [ + python3 + black + isort + bun + ]; + }; }); formatter = forEachSupportedSystem (pkgs: pkgs.nixfmt-tree); + + # Build all devShells, instead of just verifying they are deviations + checks = forEachSupportedSystem (pkgs: self.devShells.${pkgs.stdenv.hostPlatform.system}); }; } diff --git a/installer/exporter/OSX/Scripts/preinstall b/installer/exporter/OSX/Scripts/preinstall index 014f372637..e6a2456c21 100755 --- a/installer/exporter/OSX/Scripts/preinstall +++ b/installer/exporter/OSX/Scripts/preinstall @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash FUSION_ADDIN_LOCATION=~/Library/Application\ Support/Autodesk/ApplicationPlugins/ diff --git a/installer/exporter/OSX/build.sh b/installer/exporter/OSX/build.sh index 9b13e2d29a..93896d514b 100755 --- a/installer/exporter/OSX/build.sh +++ b/installer/exporter/OSX/build.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash FUSION_ADDIN_LOCATION=~/Library/Application\ Support/Autodesk/ApplicationPlugins/ EXPORTER_SOURCE_DIR=../../../exporter/SynthesisFusionAddin/ diff --git a/multiplayer/.envrc b/multiplayer/.envrc new file mode 100644 index 0000000000..71aeecdbba --- /dev/null +++ b/multiplayer/.envrc @@ -0,0 +1,3 @@ +if command -v nix &>/dev/null; then + use flake .#fission +fi diff --git a/protocols/proto_compile.sh b/protocols/proto_compile.sh index 589880d7f4..2c319d5796 100755 --- a/protocols/proto_compile.sh +++ b/protocols/proto_compile.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if ! [ -d ../api/Api/Gen/ ] then mkdir ../api/Api/Gen/