Nixpkgs: Status of Zen-kernel

Created on 2 Dec 2019  Â·  14Comments  Â·  Source: NixOS/nixpkgs

Issue description

In this reddit topic came the question up, why the Zen-kernel was removed from NixOS.

It was added in 2009 by @7c6f434c, but now it's not there anymore. I don't see when it was removed in the history.

https://github.com/NixOS/nixpkgs/commit/491255bbb35e8a80f09c291a4fd90464ac062efd
https://github.com/NixOS/nixpkgs/commit/03a91371146c7c1b1c684bf7b574cbfdd1b41928

The project is actively developed (latest commit 3 days ago) and having a kernel optimised for desktop use seems a nice idea.

https://github.com/zen-kernel/zen-kernel

Project desription is currently found here: https://liquorix.net/

a distro kernel replacement built using the best configuration and kernel sources for desktop, multimedia, and gaming workloads.

Since packaging an additional kernel is actually quiet easy in NixOS, i might try it, but i will not be able to update it frequently. So an additional maintainer would be good.

question kernel

Most helpful comment

At the very least, it carries the futex-wait-multiple patchset which is not found in any pre-built NixOS kernel to my knowledge.

I went ahead and packaged it for Nixpkgs in https://github.com/NixOS/nixpkgs/pull/94027, feel free to test.

All 14 comments

It updates out of sync with the main kernel, and I guess 2012 could be when I either stopped needing TuxOnIce because in-kernel suspend-to-disk became good enough, or started using BtrFS and wanting to have the latest release as soon as it appears, or both.

Someone needs to update the version and prune the old ones, and noone cared at the time.

Oh, it’s my Reddit post. I would be happy to help update the kernel @davidak.

@Fuzen-py great. sadly i will not find time soon to look into it.

I have packaged a kernel that provides a new filesystem (bcachefs):

https://github.com/NixOS/nixpkgs/blob/5a1232908ce4bfa916a8c96ad31b56d1560af2c0/pkgs/os-specific/linux/kernel/linux-testing-bcachefs.nix

I would take that as an example and change what's needed.

I would hope that for packaging a new kernel, the main effort is building/testing, indeed — the bcachefs example confirms this (it just passes another source, additional config and some meta like resetting maintainers)

@Fuzen-py If you get around to try doing this, feel free to ping me for Nix-level review/merge once you have test the kernel and find it working fine.

I was running the zen kernel patches as my system for a while; I have moved away from nix due to compatibility issues and difficulty patching some applications such as cryptomator, Zotero and some proprietary software. That being said any testing, I would now be superficial. I am still open to helping and testing, but as this is no longer my primary distro, I don’t believe I can test this enough for initial support at this time.

Now I wonder where we should have the description for the FHS env escape-hatch functionality so that people like you (before giving up) can find it easily… (NixOS Wiki FAQ describes it in the «I've downloaded a binary» question).

I asked around for it, cryptomator is shipped as an appimage and because it needed fuse, it wasn't playing nicely. My next attempt was to build it from source, which proved to be a nightmare attempting to declare all of the maven sources. Anyways, a discussion for another issue, I did attempt patchelf though

I was running the zen kernel patches as my system for a while

@Fuzen-py what was your experience with it? did you get a significant performance improvement, for example in games? is it worth the effort?

I was running the zen kernel patches as my system for a while ...

@davidak I do notice some gains while playing games, ~10fps on some and on others nothing. I’m unsure if this is from fsync or fsync and the other patches though.

I've noticed a significant improvement in responsiveness overall. That's hard to see on a performance test, but Linux always felt laggy to me in a way that Windows doesn't... I was able to do a blind test to confirm that the Zen kernel at least improves on that, IMO significantly.

(It's not double blind when the other party is a computer, right?)

For the time being, I'm using this to run it:

  boot.kernelPackages = let
    linux_zen_pkg = { fetchurl, buildLinux, ... } @ args:
    buildLinux (args // rec {
        version = "5.7.8-zen2";
        modDirVersion = version;

        src = builtins.fetchGit {
          url = https://github.com/zen-kernel/zen-kernel.git;
          ref = "refs/tags/v${version}";
        };

        kernelPatches = [];

        extraMeta.branch = "5.7";
      } // (args.argsOverride or {}));
    linux_zen = pkgs.callPackage linux_zen_pkg {};
  in 
    pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor linux_zen);

@Baughn blind means you implemented booting a random configuration?

If you keep track of their latest releases anyway, maybe add a hash and list it in the NUR?

@7c6f434c Yes. Nix is supposed to be purely functional, but there's nothing stopping me from doing builtins.readFile /dev/random. (Except I'm not sure if that function is lazy. In actual fact I wrote a small script to select one at random before calling nixos-rebuild.)

Are strings lazy?

Anyway... there's no doubt in my mind that zen-kernel has a better default configuration. I'm not so sure that it's not just better defaults, though. I want to look at that before uploading anything; if we're lucky, I might be able to get the same effect by tweaking vanilla kernel parameters instead.

It'll take at least a week to get enough samples to be sure of that, more likely multiple, so don't hold your breath. Meanwhile, well, there is the above, and I'll update this thread with vanilla configuration(s) once I find a decent one.

@7c6f434c Yes. Nix is supposed to be purely functional, but there's nothing stopping me from doing builtins.readFile /dev/random. (Except I'm not sure if that function is lazy. In actual fact I wrote a small script to select one at random before calling nixos-rebuild.)

Hm, I expected building both then swtitch-to-configuration boot

Anyway... there's no doubt in my mind that zen-kernel has a better default configuration. I'm not so sure that it's not just better defaults, though. I want to look at that before uploading anything; if we're lucky, I might be able to get the same effect by tweaking vanilla kernel parameters instead.

But they still seem to carry BFS/MuQSS, for example. I don't think this is something you can just enable inthe mainline.

At the very least, it carries the futex-wait-multiple patchset which is not found in any pre-built NixOS kernel to my knowledge.

I went ahead and packaged it for Nixpkgs in https://github.com/NixOS/nixpkgs/pull/94027, feel free to test.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

globin picture globin  Â·  65Comments

nico202 picture nico202  Â·  70Comments

grahamc picture grahamc  Â·  88Comments

worldofpeace picture worldofpeace  Â·  103Comments

danykey picture danykey  Â·  64Comments