diff --git a/flake.nix b/flake.nix index 0ee4b41b..bd8896df 100644 --- a/flake.nix +++ b/flake.nix @@ -5,12 +5,9 @@ }; outputs = { self, nixpkgs, flake-utils, ... }: - flake-utils.lib.eachDefaultSystem ( - system: - let - pkgs = import nixpkgs { inherit system; }; - in - { + flake-utils.lib.eachDefaultSystem (system: + let pkgs = import nixpkgs { inherit system; }; + in { devShells.default = pkgs.mkShell { buildInputs = [ pkgs.yarn @@ -23,35 +20,33 @@ pkgs.coursier ] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ pkgs.xvfb-run ]; }; - packages.tree-sitter-smithyql = - pkgs.stdenv.mkDerivation { - name = "tree-sitter-smithyql"; - src = ./tree-sitter-smithyql; - buildInputs = [pkgs.tree-sitter pkgs.nodejs]; - buildPhase = '' - tree-sitter generate - make - ''; - installPhase = if system == "x86_64-darwin" || system == "aarch64-darwin" then '' + packages.tree-sitter-smithyql = pkgs.stdenv.mkDerivation { + name = "tree-sitter-smithyql"; + src = ./tree-sitter-smithyql; + buildInputs = [ pkgs.tree-sitter pkgs.nodejs ]; + buildPhase = '' + tree-sitter generate + make + ''; + installPhase = + if system == "x86_64-darwin" || system == "aarch64-darwin" then '' cp libtree-sitter-smithyql.dylib $out '' else '' cp libtree-sitter-smithyql.so $out ''; - }; - packages.tree-sitter-smithyql-all = - pkgs.stdenv.mkDerivation { - name = "tree-sitter-smithyql-all"; - src = ./tree-sitter-smithyql; - dontBuild=true; - installPhase = '' - mkdir $out - cd $out - mkdir darwin-aarch64 && cp ${self.packages.aarch64-darwin.tree-sitter-smithyql} darwin-aarch64/libtree-sitter-smithyql.dylib - mkdir darwin-x86-64 && cp ${self.packages.x86_64-darwin.tree-sitter-smithyql} darwin-x86-64/libtree-sitter-smithyql.dylib - mkdir linux-aarch64 && cp ${self.packages.aarch64-linux.tree-sitter-smithyql} linux-aarch64/libtree-sitter-smithyql.so - mkdir linux-x86-64 && cp ${self.packages.x86_64-linux.tree-sitter-smithyql} linux-x86-64/libtree-sitter-smithyql.so - ''; - }; - } - ); + }; + packages.tree-sitter-smithyql-all = pkgs.stdenv.mkDerivation { + name = "tree-sitter-smithyql-all"; + src = ./tree-sitter-smithyql; + dontBuild = true; + installPhase = '' + mkdir $out + cd $out + mkdir darwin-aarch64 && cp ${self.packages.aarch64-darwin.tree-sitter-smithyql} darwin-aarch64/libtree-sitter-smithyql.dylib + mkdir darwin-x86-64 && cp ${self.packages.x86_64-darwin.tree-sitter-smithyql} darwin-x86-64/libtree-sitter-smithyql.dylib + mkdir linux-aarch64 && cp ${self.packages.aarch64-linux.tree-sitter-smithyql} linux-aarch64/libtree-sitter-smithyql.so + mkdir linux-x86-64 && cp ${self.packages.x86_64-linux.tree-sitter-smithyql} linux-x86-64/libtree-sitter-smithyql.so + ''; + }; + }); }