limine
limine copied to clipboard
Onboard to nixpkgs
Hi, cool project! It would be awesome to upstream this to nixpkgs! My company and I do a lot of low-level OS-related kernel development with the help of Nix. Having everything packaged in Nix enables us to create reproducible and productive development environments.
As this is my last day of work before my long vacation starts, I don't want to upstream this to nixpkgs today. I'm happy to work towards that goal when I'm back in March!
For now, I'd like to share my progress so that anyone else can continue working on this - if interested. Currently, I package it in Nix like that, but without the cross-compilation for riscv64 and aarch64:
# Builds limine with all available features.
{ gcc, gnumake, mtools, nasm, stdenv }:
let
# It is recommended by limine to use the release tarballs instead the git repo.
limineUrl = "https://github.com/limine-bootloader/limine/releases/download/v7.0.2/limine-7.0.2.tar.gz";
limineSrc = builtins.fetchTarball {
url = limineUrl;
sha256 = "sha256:0h70hkzyxpavsa896mj8pqc4gr6hj0bb2d76prp0rsgy1syyy9kc";
};
in
stdenv.mkDerivation {
# TODO license meta data
pname = "limine";
version = "7.0.2";
src = limineSrc;
nativeBuildInputs = [ mtools gnumake gcc nasm ];
doCheck = false;
# TODO missing --enable-uefi-{aarch64,riscv64} cross compilation so far
configurePhase = ''
./configure \
--enable-bios-cd \
--enable-bios-pc \
--enable-bios-pxe \
--enable-uefi-ia32 \
--enable-uefi-x86-64 \
--enable-uefi-cd
'';
buildPhase = ''
make -j $(nproc)
'';
installPhase = ''
mkdir -p $out/bin
cp -R bin/. $out
ln -s $out/limine $out/bin/limine
'';
}
ping @blitz
This was already tried at NixOS/nixpkgs#194841, but it was never reviewed by the relevant maintainers
Oh, good to know! Yeah, the throughput in nixpkgs on GitHub is incredible and maintainers are all overwhelmed.
My colleques and I know a few maintainers personally. I'm confident that we can do something about that issue.
That would be cool, I would love to see Limine in Nixpkgs!
From what I've seen in https://github.com/NixOS/nixpkgs/pull/194841:
Maybe it would be good so split that up into two MRs:
- just init the bootloader so that people can use the build artifacts (
${pkgs.limine}/limine-bios-cd.binetc) - make the bootloader usable by NixOS
Yes, splitting it into smaller individually useful PRs will make it easier to get it into nixpkgs. Adding it as a bootloader option and getting everything right is a lot of (review) work. For that it would be interesting to get at least a few people together that would maintain it. That being said, we can probably help direct some attention to those PRs.
Hi, I'm back from vacation and ready to work on that issue now! @TobiasSN
Can you please provide some instructions for cross compilation? For example, if I'm on x86-64-linux and want to run
./configure \
--enable-bios-cd \
--enable-bios-pxe \
--enable-bios \
--enable-uefi-ia32 \
--enable-uefi-x86-64 \
--enable-uefi-aarch64 \
--enable-uefi-cd \
--enable-uefi-riscv64
I'm interested in the build environment for cross compilation for both, gcc and clang. I don't quite understand what's the idea here because it finds a lot of things..?
Background: I want (because I think it is the right thing to do) to let the limine derivation always build everything. Otherwise, this would limit other cross-compilation toolchains that want to build a bootable image for another platform using pkgs.limine.
ping @TobiasSN
Hi,
If you have an LLVM/Clang toolchain installed, with targets enabled for all supported Limine ports, Limine will build all of its ports accordingly (can also use --enable-all).
If you want to use GCC, then you'll have to provide 3 or 4 different GCC/binutils toolchains for x86-64/i686, aarch64, and riscv64. This may involve configuring multiple times to specify toolchain components manually with the *_FOR_TARGET configure variables as described in ./configure --help.
I created a draft MR in nixpkgs. The only blocking thing right now is that:
- one of you has to tell me whether the provided meta information are fine (license)
- you have to tell me whom I should add as maintainer (next to me)
- if you have any other general concerns or so
https://github.com/NixOS/nixpkgs/pull/298048
Once we're all set, me colleques and I know people who we can ping to get it merged :)
one of you has to tell me whether the provided meta information are fine (license)
I would say it's fine, though keep in mind that several submodules used by Limine use different licenses (all more or less BSD-2-Clause compatible), namely (in SPDX identifier form):
- 0BSD (used by:
freestanding-toolchain,freestanding-headers) - Apache-2.0-with-LLVM-exceptions (used by
cc-runtime) - BSD-3-Clause (used in part by
limine-efi, alongside BSD-2-Clause) - Zlib (used by
tinf) - Unlicense or MIT (used by
stb)
you have to tell me whom I should add as maintainer (next to me)
If that is necessary I'd propose @48cf or alternatively myself as possible candidates.
if you have any other general concerns or so
I wouldn't say so, beyond what was already raised in #340
I added @48cf in a dedicated commit, see https://github.com/NixOS/nixpkgs/pull/298048
I added @48cf in a dedicated commit, see NixOS/nixpkgs#298048
Could you please update my information in the maintainer-list.nix file? My github username is now, well, @48cf and for the email I'd rather use [email protected]
I just copied the information from https://github.com/NixOS/nixpkgs/pull/194841/commits/b2c893d76838be094612a8710dc4ed1692bd9b6c - sorry!
whoops, apparently these @users.noreply.github.com email are not usable... can leave that as is then - i hope it's not too much trouble! (just decided to test that and it turns out it is in fact noreply 😅)
Got it. Please check the latest version?
yeah that looks alright, thanks!
Closed. Everything done!
General remark. I think, some upstream bots should automatically update Limine in nixpkgs, once a new Github release is created in this repo. We can keep an eye on it.
nice work guys, so what is the next move to add limine to nixpkgs as an option?
side note phip1611 you are man of culture for being persistent and patient
nice work guys, so what is the next move to add limine to nixpkgs as an option?
Thanks! I guess you refer to using Limine as optional bootloader for NixOS.
So, at my company, generally speaking we have interest in Limine. That's why we worked on upstreaming it in our work time at the first place. However, at the moment, we can't justify spending many hours on it with little company benefit. At least I am unsure what the required effort for this is. @astro might have better insights.
I do not have the capacity to work on this in my free time in the next months, unfortunately.