diff --git a/tasks.py b/tasks.py
index 4e7ade6..be4269a 100644
--- a/tasks.py
+++ b/tasks.py
@@ -30,13 +30,17 @@ def deploy(c: Any, hosts: str) -> None:
             command = "sudo nixos-rebuild"
             target = f"{h.host}"
 
-        res = h.run_local(
-            ["nix", "flake", "archive", "--to", f"ssh://{target}", "--json"],
+        res = subprocess.run(
+            ["nix", "flake", "metadata", "--json"],
+            text=True,
+            check=True,
             stdout=subprocess.PIPE,
         )
         data = json.loads(res.stdout)
         path = data["path"]
 
+        h.run_local(f"nix copy --to ssh://{target} {path}")
+
         hostname = h.host.replace(".nix-community.org", "")
         h.run(
             f"{command} switch --option accept-flake-config true --flake {path}#{hostname}"