25 Sep 2024 on chupson's Blog
Sourcehut, or sourcehut, or sr.ht1 is a collection of different services allowing for collaborative (as well as solo) software development, including repository hosting (both Git and Mercurial), CI, mailing lists, ticket tracker, and more. While it could be described as a GitHub replacement, I don’t think that name accurately describes what sourcehut is. Yes, it has replaced GitHub for many developers, and has been doing the same for me, but when I hear the term “GitHub replacement” what comes to mind is Gitlab, Gitea, and other similar services people have called “GitHub clones” before. But sourcehut is quite decidedly not that. It might serve some of the same purposes, but it’s not just GitHub with a different UI - it takes an entirely different approach to solving a subset of the problems the aforementioned services try to solve. And I think I love it.
Firstly, let me address one of the first things I noticed coming in: sr.ht, the hosted version of the open-source project sourcehut, is not free to use2. Why should you pay for a software forge when GitHub is free? Well, while GitHub is free, they’re not running a charity. And since they’re not getting your money, they’re probably getting your data. Additionally, their primary focus will not be serving the needs of users, it will be serving the needs of Microsoft and its stakeholders. Sourcehut doesn’t come with the same burdens. You are free to choose from three different subscription plans which differ only in price, that way you can give exactly as much as you are able to, while still getting all of the benefits. And the cheapest tier, at $2 a month, is really not that much. Where I live that’s about the price of a big donut. And I don’t know about you, but I’d much rather get a month’s worth of an amazing service and support an open-source project than eat a donut.
Now that we got that out of the way, let’s talk about how sourcehut makes me feel. Yes, I know, feelings are not something that’s usually talked about when discussing software projects, but I think how you feel while using a piece of software is not unimportant. And sourcehut makes me feel great. All around it feels like it’s been made for you. Not for some corporation, not for advertising, not for flashy animations, but for supercharging your workflow. It’s a similar feeling I get from Neovim or other projects from the category I like to call minimalist software. On top of that, I feel like I can really trust sourcehut. The people running it are very transparent with their plans and everything they’re doing, posting frequent updates to sourcehut’s blog and a designated mailing list. Also, sourcehut’s founder, Drew DeVault, seems like a great person. He has a fantastic blog which I’ve really enjoyed reading, and he seems very passionate about what he does, including sourcehut and some other cool projects of his, like the Hare programming language.
There are also, of course, some more tangible reasons for why this project is so great. For one thing, I really enjoy the design. It features muted colors (which also match your system color scheme, so both light and dark mode are there), clean text buttons for every action, and the whole thing works without JavaScript. Yes, you read that right. All features work without JavaScript. With the current state of the web, websites constantly assaulting you with pop-ups, consent forms, ads, trackers and other junk, making load times long and browsing with no ad-blocker a pain, this design is very refreshing and just feels right. They say on the sourcehut website that it’s the fastest and lightest forge, but to really understand what that means you have to experience it. I could tell you how blazing fast using sr.ht feels, but you really have to try it to get just what that means. It really does make a difference.
Sourcehut is based on email, with most interactions being either possible through email or specifically designed for it. Instead of the pull request system GitHub and its clones use, you can submit patches using email. And while this change of workflow does come with a learning curve if you’re coming from a pull request based system sourcehut, provides you with fantastic learning resources to help you get up to speed. They also have amazing integrations which make using email-based development easier, including a patch review UI on the website, as well as an option for creating patchsets right from the repository page, for those who might not want to get into the full git send-mail workflow right away. I can’t speak on the efficiency of said workflow, as I have not tried it yet, but it is the way Git was designed to work, and some of the most popular open-source projects like the Linux kernel or Git itself do use an email-based workflow. Also, Drew certainly makes it look like a dream.
builds.sr.ht is sourcehut’s approach to CI. Coincidentally, it’s also the best approach
to CI I’ve had a chance to try. At the heart of every build lives the build manifest, a YAML file which
describes the details of your build, including the platform it should be run from, packages it should install
secrets it should import, build steps it should run, and more. To start a build, you have to submit one of those
build manifests to builds.sr.ht, and wait a little bit. And by a little bit, I do mean a
very little bit. In my experience, sourcehut builds started noticeably faster than ones I used to run through
GitHub actions. Once a build has been submitted, there are several very useful things you can still do with it.
You can resubmit a build, either with or without modifying its manifest. You can also SSH into a build for 10 minutes
after it has finished, and if you do it will stay alive for much longer. I think this is an incredible feature3,
and something I’m surprised I haven’t encountered before. Many a time have I wished I could go into one of my builds
and investigate, and now I finally can. One thing that has to be noted is that builds exist independently of any source
code repositories. It is of course possible to automatically submit builds on pushes to a repository and/or patch
submissions to a mailing list, but it is jut that. Automatic build submitting. You have to manually state in the
build manifest that you’d like a repository to be cloned, and an automatically submitted build will behave in
the same way as if you were to submit that same manifest manually (as far as I can tell). It’s also possible
to filter submitted builds based on what repository they were auto-submitted from, and builds.sr.ht does
provide badges that inform of the latest build’s status. Because of this repo-independent approach, pulling
private repositories into builds requires a bit of a workaround, but I think that’s a very minor inconvenience, especially
considering the added flexibility the site gives you. You could, for example, have a build manifest
which automatically runs when you push to repository foo
and which tests foo
’s integration with your
other repository, bar
. You’d do this by simply including both those repositories in your manifest’s list
of sources. You could then put the same manifest in both foo
and bar
to have those projects automatically
test if they work with each other. I found that while this way of doing things took a little bit of
getting used to, once I finally got it, I really got it, and now it feels very intuitive to me.
Something that I have not yet seen elsewhere is sourcehut’s Mercurial support. I have very rarely seen Mercurial used or even mentioned, so sourcehut’s support for Mercurial repositories has definitely brought my attention to it. Nothing more to say about this, just thought it was interesting.
On top of everything I have mentioned above, in my short time of using sourcehut I have came across many small, but very nice things, which bring the whole amazing experience together. Noticing those little niceties always feels fantastic and has me thinking “Yes! Of course! This is great!”.
In conclusion, sourcehut is a really nice and interesting service which I’m very happy I found and I look forward to learning about it and using it more. You should try it!
I’ve been told the grammar police doesn’t care. ↩︎
Well, to be completely pedantic, at the time of writing this post sr.ht is in alpha, so most of its services actually are free for the time being. If you want to find out the details see this page ↩︎
When automating deployment for this very site, I came across lots of little errors and mistakes that I had made in both the build manifest and my server configuration. The ability to quickly and easily resubmit builds, as well as SSH into build environments was a huge help. ↩︎