From 3f50cde0a664aac24f11b85c8498c703b68ebad4 Mon Sep 17 00:00:00 2001 From: Quinn Dougherty Date: Tue, 30 Aug 2022 13:45:12 +0800 Subject: [PATCH] refactored shells nix code --- .github/workflows/ci-cachix.yml | 9 ++++++-- flake.nix | 6 +++-- nix/shell.nix | 40 ++++++++++++++++++--------------- 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci-cachix.yml b/.github/workflows/ci-cachix.yml index 4d221991..f6da9c0d 100644 --- a/.github/workflows/ci-cachix.yml +++ b/.github/workflows/ci-cachix.yml @@ -14,6 +14,7 @@ on: jobs: flake-lints: + name: All lint runs-on: ubuntu-latest steps: - name: Checkout code @@ -38,6 +39,7 @@ jobs: run: nix build .#vscode-lint flake-packages: + name: Builds, tests, and bundles runs-on: ubuntu-latest needs: flake-lints steps: @@ -63,6 +65,7 @@ jobs: run: nix build .#components-bundle flake-devshells: + name: Development shell environment runs-on: ubuntu-latest steps: - name: Checkout code @@ -76,5 +79,7 @@ jobs: with: name: quantified-uncertainty authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Build devshell - run: nix develop -c echo "built devshell" + - name: Build js devshell + run: nix develop .#js -c echo "built js devshell" + - name: Build js & wasm devshell + run: nix develop -c echo "built js & wasm devshell" diff --git a/flake.nix b/flake.nix index 0c6724c3..4e02f68b 100644 --- a/flake.nix +++ b/flake.nix @@ -74,8 +74,10 @@ }; # developing - devShells = flake-utils.lib.flattenTree { - default = (import ./nix/shell.nix { inherit pkgs; }).shell; + devShells = let shellNix = import ./nix/shell.nix { inherit pkgs; }; + in flake-utils.lib.flattenTree { + default = shellNix.all; + js = shellNix.just-js; }; }; in flake-utils.lib.eachDefaultSystem (system: diff --git a/nix/shell.nix b/nix/shell.nix index 16c20eab..26f62625 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -1,21 +1,25 @@ { pkgs }: -with pkgs; { - shell = mkShell { - name = "SQUIGGLE_yarn-wasm-devshell"; - buildInputs = [ - wasm-pack - cargo - yarn - nodejs - nodePackages.ts-node - rustup - pkg-config - libressl - nixfmt - rustfmt - wasmtime - binaryen - wasm-bindgen-cli - ]; +with pkgs; +let + js = [ yarn nodejs nodePackages.ts-node ]; + rust = [ + wasm-pack + cargo + rustup + pkg-config + libressl + rustfmt + wasmtime + binaryen + wasm-bindgen-cli + ]; +in { + all = mkShell { + name = "squiggle_yarn-wasm-devshell"; + buildInputs = builtins.concatLists [ js rust [ nixfmt ] ]; + }; + just-js = mkShell { + name = "squiggle_yarn-devshell"; + buildInputs = js ++ [ nixfmt ]; }; }