fixed
diff --git a/flake.nix b/flake.nix
index 8c57619..33d0698 100644
--- a/flake.nix
+++ b/flake.nix
@@ -8,64 +8,120 @@
   inputs.pnpm2nix.inputs.nixpkgs.follows = "nixpkgs";
 
   outputs = { self, nixpkgs, flake-utils, clicks-server, pnpm2nix }:
-    flake-utils.lib.eachDefaultSystem (system: let
-      pkgs = nixpkgs.legacyPackages.${system};
-      nodejs = pkgs.nodejs_20;
-      nodePackages = pkgs.nodePackages_latest;
-      lib = pkgs.lib;
-    in rec {
-      devShells.default = pkgs.mkShell {
-        packages = [ nodejs nodePackages.pnpm pkgs.pkg-config pkgs.fontconfig.dev ];
-        shellHook = ''
-          unset name
-          export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${lib.makeSearchPath "/lib/pkgconfig" [
-            pkgs.pixman
-            pkgs.cairo.dev
-            pkgs.libpng.dev
-            pkgs.gnome2.pango.dev
-            pkgs.glib.dev
-            pkgs.harfbuzz.dev
-            pkgs.freetype.dev
-          ]}
-        '';
-      };
+    flake-utils.lib.eachDefaultSystem
+      (system:
+        let
+          pkgs = nixpkgs.legacyPackages.${system};
+          nodejs = pkgs.nodejs_20;
+          nodePackages = pkgs.nodePackages_latest;
+          lib = pkgs.lib;
+        in
+        rec {
+          devShells.default = pkgs.mkShell {
+            packages = [ nodejs nodePackages.pnpm pkgs.pkg-config pkgs.fontconfig.dev ];
+            shellHook = ''
+              unset name
+              export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:${lib.makeSearchPath "/lib/pkgconfig" [
+                pkgs.pixman
+                pkgs.cairo.dev
+                pkgs.libpng.dev
+                pkgs.gnome2.pango.dev
+                pkgs.glib.dev
+                pkgs.harfbuzz.dev
+                pkgs.freetype.dev
+              ]}
+            '';
+          };
+        }) // {
+      packages.x86_64-linux =
+        let
+          pkgs = nixpkgs.legacyPackages.x86_64-linux;
+          nodejs = pkgs.nodejs_20;
+          nodePackages = pkgs.nodePackages_latest;
+          lib = pkgs.lib;
+        in
+        rec {
+          node_modules = lib.pipe
+            {
+              src = ./.;
+              linkDevDependencies = true;
+              overrides = pnpm2nix.defaultPnpmOverrides.x86_64-linux // {
+                canvas = (drv: drv.overrideAttrs (oldAttrs: {
+                  nativeBuildInputs = oldAttrs.nativeBuildInputs ++ [ pkgs.pkg-config ];
+                  buildInputs = oldAttrs.buildInputs ++ [
+                    pkgs.pixman
+                    pkgs.cairo.dev
+                    pkgs.libpng.dev
+                    pkgs.gnome2.pango.dev
+                    pkgs.glib.dev
+                    pkgs.harfbuzz.dev
+                    pkgs.freetype.dev
+                  ];
+                }));
 
-      packages.env = lib.pipe {
-        src = ./.;
-      } [
-        (pnpm2nix.mkPnpmPackage.${system})
-        (pnpm2nix.mkPnpmEnv.${system})
-      ];
+                "@tensorflow/tfjs-node" = (drv: drv.overrideAttrs (oldAttrs: {
+                  buildInputs = oldAttrs.buildInputs ++ [
+                    pkgs.libtensorflow
+                  ];
 
-      packages.default = let
-        packageJSON = (builtins.fromJSON (builtins.readFile ./package.json));
-      in pkgs.stdenv.mkDerivation {
-        pname = "nucleus";
-        version = packageJSON.version;
+                  preBuild = ''
+                    mkdir -p node_modules/@tensorflow/tfjs-node/deps/lib
+                    ln -s ${pkgs.libtensorflow}/lib/libtensorflow.so.2 node_modules/@tensorflow/tfjs-node/deps/lib/libtensorflow.so.2.9.1
+                  '';
+                }));
+              };
+            } [
+            (pnpm2nix.mkPnpmPackage.x86_64-linux)
+            (drv: builtins.readFile "${drv}/nix-support/propagated-build-inputs")
+            (path: "${path}/node_modules")
+          ];
 
-        src = ./.;
+          nucleus =
+            let
+              packageJSON = (builtins.fromJSON (builtins.readFile ./package.json));
+            in
+            pkgs.stdenv.mkDerivation {
+              pname = "nucleus";
+              version = packageJSON.version;
 
-        buildInputs = [ packages.env nodejs nodePackages.pnpm ];
-        nativeBuildInputs = [ packages.env nodePackages.pnpm ];
+              src = ./.;
 
-        buildPhase = ''
-          pnpm run build
-        '';
+              buildInputs = [ nodejs nodePackages.pnpm ];
+              nativeBuildInputs = [ nodePackages.pnpm nodePackages.typescript pkgs.python3 ];
 
-        installPhase = ''
-          cp dist $out
-          mkdir -p $out/bin
-          echo "#!/usr/bin/env bash\ncd $out\n${packageJSON.scripts.start}" > $out/bin/nucleus
-        '';
-      };
+              buildPhase = ''
+                ${pkgs.python3}/bin/python3 ${./scripts/fix-pnpm-bin.py} ${node_modules} ./bin
+                export PATH=$PATH:./bin
+                ln -s ${node_modules} node_modules
+                pnpm run build
+              '';
 
-      dockerImage = let
-        nucleus = packages.default;
-      in pkgs.dockerTools.streamLayeredImage {
-        name = "nucleus";
-        tag = "latest";
-        contents = [ nucleus ];
-        config.Cmd = [ "${nucleus}/bin/nucleus" ];
-      };
-    });
+              installPhase = ''
+                mkdir -p $out
+
+                cp dist $out -r
+                cp node_modules $out -r
+                cp bin $out/.bin -r
+                cp package.json $out
+                cp LICENSE $out
+
+                mkdir -p $out/bin
+                echo "#!/usr/bin/env bash" > $out/bin/nucleus
+                echo "cd $out" >> $out/bin/nucleus
+                echo "export PATH=$PATH:$out/node_modules/.bin" >> $out/bin/nucleus
+                echo "${packageJSON.scripts.start}" >> $out/bin/nucleus
+                chmod +x $out/bin/nucleus
+              '';
+            };
+
+          dockerImage = pkgs.dockerTools.streamLayeredImage {
+            name = "nucleus";
+            tag = "latest";
+            contents = [ nucleus ];
+            config.Cmd = [ "${nucleus}/bin/nucleus" ];
+          };
+
+          default = nucleus;
+        };
+    };
 }