| Crates.io | kconfq |
| lib.rs | kconfq |
| version | 1.0.0 |
| created_at | 2026-01-09 12:46:13.690939+00 |
| updated_at | 2026-01-17 10:45:33.910239+00 |
| description | A portable way to query kernel configuration on a live system |
| homepage | |
| repository | https://github.com/synalice/kconfq |
| max_upload_size | |
| id | 2032013 |
| size | 70,344 |
A portable way to query kernel configuration on a live system (/boot/config-*
or /proc/config.gz).
It provides:
kconfq)libkconfq.so, kconfq.h, kconfq.pc)Instaling via cargo:
cargo install kconfq
Instaling via Nix:
nix profile install github:synalice/kconfq
Running without installation:
nix run github:synalice/kconfq
Even though the core of the library is written in Rust, it can be compiled as a
cdynlib with C ABI.
The project will generate:
libkconfq.sokconfq.hkconfq.pcAll of this makes it possible to use library as any normal C dependency. Here is an example of how this would look like in Meson
kconfq = dependency('kconfq')
You can see the example of how to use the C-API in the examples/libkconfq/ directory.
To build and run the example, run the following commands:
cd examples/libkconfq/
nix develop
meson setup builddir/
meson compile -C builddir/
./builddir/example
To build and install library from source you have to use cargo-c.
cargo cbuild --release --destdir=${D} --prefix=/usr --libdir=/usr/lib64
cargo ctest
cargo cinstall --release --destdir=${D} --prefix=/usr --libdir=/usr/lib64
flake.nixThis is how you would add this library to your flake.nix and then reference it
inside your derivation's buildInputs
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
flake-utils.url = "github:numtide/flake-utils";
kconfq = {
url = "github:synalice/kconfq";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, kconfq }:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages.default = pkgs.clangStdenv.mkDerivation {
pname = "example";
version = "0.1.0";
src = ./.;
buildInputs = [ kconfq.packages.${system}.libkconfq ];
};
}
);
}
The project was created with easy cross-compilation in mind.
Here is how you can cross-compile libkconfq for aarch64-unknown-linux-gnu
using Nix
./scripts/cross-compile.sh aarch64-multiplatform ./nix/libkconfq.nix out
[!TIP] To cross-compile for different host architectures, replace
aarch64-multiplatformwithriscv64or something else. Read more here.
This project is under the MIT license.