((nil
  . ((eval
      . (defun dots/install-to-vm (clean-first?)
          (interactive "P")
          (let ((dest-directory "/ssh:root@192.168.122.116:/nixos")
                (root (project-root (project-current)))
                (ignored-paths '(".jj" ".git" ".gitignore" ".dir-locals.el")))
            (progn
              ;; (message "Tangling...")
              ;; (org-babel-tangle-file (file-name-concat root "README.org"))
              (when clean-first?
                (delete-directory dest t))
              (make-directory dest-directory t)
              (let ((files-to-install
                     (--> (directory-files root)
                          (-filter (lambda (x) (not (memq x ignored-paths))) it))))
                (dolist (file-src files-to-install)
                  (let ((file-dest-directory
                         (file-name-concat dest-directory
                                           (file-name-directory file-src))))
                    (make-directory file-dest-directory t)
                    (copy-file file file-dest-directory))))
              (message "Finished installing to VM!"))))))))
