       fixture_to_tmp(package, path)
     end)
 
-    File.cwd!()
-    |> Path.join("mix.exs")
-    |> Code.require_file()
-
-    Nerves.Env.start()
+    _ = Code.require_file(Path.expand("mix.exs"))
+
+    {:ok, _} = Nerves.Env.start()
     Nerves.Env.packages()
   end
 

      File.cd!(dest, function)
      :timer.sleep(10)
    after
      :code.set_path(get_path)

      for {mod, file} <- :code.all_loaded() -- previous,
          file == [] or (is_list(file) and List.starts_with?(file, flag)) do

  def fixture_to_tmp(fixture, dest) do
    src = fixture_path(fixture)

    _ = File.rm_rf!(dest)
    File.mkdir_p!(dest)
    File.cp_r!(src, dest)
  end

  def load_env(packages \\ []) do
    {:ok, _} = Application.ensure_all_started(:nerves_bootstrap)

    packages =
      packages
