Packaging Liberated Systemd With Nix

By abmurrow , 26 March 2026

In a recent blog post, I wrote about how I was looking outside of systemd for new alternatives to the ubiquitous init system, and I think I've landed on something that will work for me in the sort term and still allow me to use nix and NixOS.

Here is a simple snippet implementing systemd via the Liberated Systemd Project created by Jeffery Sardina in response to the latest changes in Systemd. This fork undoes the birthDate commit and appears to have an early plan for tracking updates from the systemd project on a weekly basis. It's a good short-term fix while I figure out a better solution.

This can be implemented as a new nix file and imported into your configuration using the imports = [] attribute. It will override the current systemd package for your system with one from the Liberated Systemd Project. Mind, you will have to build it from source.

If you want hashing integrity, check out the GitHub mirror and use the fetchFromGitHub fetcher instead of this one. The systemd implementation source code on nixpkgs can be a good template to follow for this type of build. Thankfully, Jeffery packaged this repo on a few different git mirrors, so you have your pick of choices for where to get the source code.

Note that, as of last check, there are no versioning tools in this repo, so you will need to look up what version of systemd your system is using, and then look at the change history for the meson.version file (found in the root directory of the source code) to figure out which commit to target. The nixpkgs search tool is extremely useful for figuring out what version your channel is using. I actually had to downgrade by three minor versions, but I think the end result is OK. Once nixpkgs unstable upgrades to the next major version, I can just update my config.

This code snippet is intended for use with the current version of nixos-unstable (as of March 26, 2026). Update as needed!

{ pkgs, ... }:
let
  liberatedSystemd = pkgs.systemd.overrideAttrs (old: {
      version = "259"; # Update to the target version listed in meson.version
      src = builtins.fetchGit {
        url = "https://codeberg.org/Jeffrey-Sardina/systemd";
        name = "systemd";
        rev = "9ca433482f2281d71718718705ca8cd3bf562ad6"; # Update to the target hash you want.
      };
  });
in
{
  systemd.package = liberatedSystemd;
}

Fun fact, you can also use this pattern to override some attributes of the systemd installation. For instance, the nixos build for systemd includes some flags you can toggle on for Selinux and Gnutils, if you want to try those features out.

Comments

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
CAPTCHA
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.