MS Windows as a Clojure dev environment?


#1

Hi! I’m up for a new work laptop, and not being impressed by Apple’s most recent hardware I am considering making the switch from OSX to Windows (I have my eye on a Surface Book 2).

I haven’t used Windows for development in a while, and I thought I’d find out if other Clojurists have opinions about it first.

For the most part my workflow involves JVM Clojure, usually from inside IntelliJ, but I also occasionally need to use shadow-cljs and other cljs stuff, and we’re experimenting with tools.deps. Beyond that a lot of my work involves docker containers.

Anyways, I’d love to hear from people who have made the same switch (or otherwise have general impressions of Windows-based Clojure development). Thanks!

[EDIT: I’m particularly interested in how useful the new Linux Subsystem stuff works in Windows, especially if I have JVM processes that needs to talk to stuff running in docker images, like my datomic transactor. From reading online, I get the impression that it’s a little painful interoperating with non-subsystem stuff.]


#2

I have been developing clojure on Windows for 3 or 4 years now.
Almost everything works and problems I have found only in these fields so far:

  • boot (did not work on W7, never tried it with W10)
  • the new cli tool is not available for Windows
  • pedestal (in 2015) did not work on W7, never tried it again

That said I would expect them both to work in the WSL. Pinging @seancorfield, as far as I can remember he uses it with boot and cli.


#3

I have been developing clojure on Windows for 8 years now.
The entire development environment on the U disk:
jdk
lein (clojure, clojurescript, luminus webapp)
clojureclr (Nuget, .net winform app)
postgresql
R
notepad++
conemu (or cmder)


#4

If you’re on the latest Windows 10 update, WSL is really solid. I run Leiningen, Boot, and the new clj stuff in WSL with no problems. My experiences so far with host interop have been very smooth: Microsoft’s approach to WSL means that both Windows and WSL see the same set of services, networks, disks, etc. I’ve had no problems with Clojure code on WSL accessing MySQL running natively on Windows, for example.

A good friend of mine has blogged about all aspects of his switch back to development on Windows: https://marcesher.com/


#5

I’m the author of shadow-cljs and I migrated to Windows in January myself for the same reason. I can report that shadow-cljs works fine. Cursive/IntelliJ works flawlessly and way better than on my MacBook which frequently tried to lift off with fans at max. I’m on a really beefy machine now though, so not sure how a Surface Book performs.

At first I tried running all dev stuff via WSL which works ok but the filesystem performance is pretty bad still and is quite noticeable in many areas, e.g. running yarn add package can take 60sec+ whereas running it directly from a windows cmd prompt in the same directory takes about 15sec.

WSL otherwise works fine and didn’t have any compatibility problems so far. Networking works fine and I had no issues accessing VirtualBox machines.

I made desktop shortcuts to start lein repl for my Clojure projects so I don’t have to use cmd.exe to get it running, which is actually way more convenient than opening a terminal, changing to the directory and typing lein repl every time. Never dug into PowerShell yet, cmd.exe is only slighty usable with clink otherwise unusable.

tools.deps support for Windows is still missing but works fine in WSL.

I made the mistake of buying Windows 10 Home and can’t run Docker since thats needs the Pro variant. Didn’t feel like upgrading yet.


#6

I’m only a Clojure hobbyist at this point, but I use Windows (10) as well. I do like having WSL, but I’m a huge fan of PowerShell (to the point of setting it as my login shell on my CentOS box).

As for Clojure development, literally the only issue I have is not being able to use “clj” from PowerShell. It works fine from WSL, but I look forward to getting the native Windows support.

As for Docker, just make sure you get Windows 10 Pro, so you can turn on Hyper-V.


#7

What about flashing a usb with your favorite GNU/Linux flavor? Just saying…

:wink:


#8

About half our team at work is on Windows and it’s mostly fine using Clojure tooling. The biggest problem I’ve run into are differences with docker.

Originally we had dockerized all of our packages, but running shadow-cljs inside of a docker container was a huge source of pain. We wanted hot reloading to work, which meant finicking with drive sharing & firewall rules on our corporate laptops. Also, file system events did not propagate into the container, which meant that I had to ask @thheller to add a polling option (which he so kindly did!).

Overall it was a huge pain in the ass, so I currently suggest that devs run shadow-cljs outside of the container and only build once you want to make sure it will run in the prod environment.


#9

Thanks for the replies everyone. Based on the above I ordered a Windows laptop, and now it’s all your fault!

So far things are going… ok. The WSL stuff is a lot more of a work in progress than I expected it to be, but it seems promising. Once I can figure out how to share my git authentication credentials between WSL bash, IntelliJ, and whatever “git for windows bash” is, I’ll be off and running.


#10

Portable lein.bat
https://github.com/linpengcheng/ClojurePortable/blob/master/lein/lein.bat


#11

WSL is pretty good and thanks for the blog, really helpful as using docker for windows and k8s can avoid the pitfall of IO perf problem of WSL:
https://www.phoronix.com/scan.php?page=article&item=wsl-february-2018&num=2

Rather pathetic …


#12

Do you guys know when will Clojure CLI be available on Windows? (@alexmiller maybe?)


#13

There is a Powershell implementation in progress. You can see it in the repo (last time I checked, anyway) but I don’t know what bugs/blockers there are in it.


#14

Are you referring to this repo? Where exactly one can see the Poweshell implementation in progress?


#15

https://dev.clojure.org/jira/browse/TDEPS-67


#16

Thanks @thheller. I have asked there about the ETA. I hope that it will be available soon.


#17

I believe this is the current status of the PowerShell port: https://github.com/clojure/brew-install/tree/windows-port/src/main/resources