{"id":15007477,"url":"https://github.com/mcdostone/nom-kconfig","last_synced_at":"2026-04-11T13:14:40.564Z","repository":{"id":177869740,"uuid":"648822659","full_name":"Mcdostone/nom-kconfig","owner":"Mcdostone","description":"A Kconfig parser written in rust.","archived":false,"fork":false,"pushed_at":"2025-02-10T17:41:49.000Z","size":389,"stargazers_count":15,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T18:34:21.377Z","etag":null,"topics":["kconfig","kernel","linux","nom","parser","parsing"],"latest_commit_sha":null,"homepage":"https://crates.io/crates/nom-kconfig","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mcdostone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-02T22:58:13.000Z","updated_at":"2025-02-08T12:34:48.000Z","dependencies_parsed_at":"2024-08-15T10:47:29.693Z","dependency_job_id":"12e2d0c8-ead8-4c89-bd2e-cff4469f7542","html_url":"https://github.com/Mcdostone/nom-kconfig","commit_stats":{"total_commits":105,"total_committers":4,"mean_commits":26.25,"dds":0.2952380952380952,"last_synced_commit":"797510cea7c252dc56a4d2663b7fd5b6bcd6ac79"},"previous_names":["mcdostone/kconfig","mcdostone/nom-kconfig"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mcdostone%2Fnom-kconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mcdostone%2Fnom-kconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mcdostone%2Fnom-kconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mcdostone%2Fnom-kconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mcdostone","download_url":"https://codeload.github.com/Mcdostone/nom-kconfig/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238960508,"owners_count":19559281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kconfig","kernel","linux","nom","parser","parsing"],"created_at":"2024-09-24T19:10:15.124Z","updated_at":"2026-04-11T13:14:40.539Z","avatar_url":"https://github.com/Mcdostone.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003cbr\u003e\n  \u003cimg\n    alt=\"Tux, the pinguin\"\n    src=\"./doc/tux.svg\"\n    width=100px\n  /\u003e\n  \u003ch1\u003eA Kconfig parser written in rust.\u003c/h1\u003e\n\u003c/div\u003e\n\n[![codecov](https://codecov.io/gh/Mcdostone/nom-kconfig/branch/main/graph/badge.svg?token=QF0CRBCO2C)](https://codecov.io/gh/Mcdostone/nom-kconfig)\n[![Minimum supported rust version: 1.65.0 or plus](https://img.shields.io/badge/MSRV-1.65.0+-lightgray.svg?logo=rust)](https://github.com/rust-bakery/nom#rust-version-requirements-msrv)\n[![crates.io Version](https://img.shields.io/crates/v/nom-kconfig.svg?logo=crate)](https://crates.io/crates/nom-kconfig)\n\n\n\nKconfig is a language that describes configuration options for the Linux Kernel. The syntax looks like this:\n```bash\n# https://github.com/torvalds/linux/blob/master/arch/riscv/Kconfig#L771\nconfig EFI\n\tbool \"UEFI runtime support\"\n\tdepends on MMU\n\tdefault y\n\tselect EFI_STUB\n\thelp\n\t  This option provides support for runtime services provided\n\t  by UEFI firmware.\n```\n\n- The file starts with a `config` entry: We define a config named `EFI`. The next lines are the attributes of this entry.\n- `EFI` is a boolean config.\n- `EFI` [depends on](https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html#menu-attributes) the config `MMU`.\n- Its default value is `y`.\n- If `EFI` is equals to `true` then it enables `EFI_STUB`.\n- The `help` attribute defines a help text for the end user.\n\nThere are plenty of other keywords in the Kconfig language, check out [the official documentation](https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html) for more details.\n\n**Features**\n\n - This is a parser, there is no semantic analysis in this library.\n - This library only supports UTF-8 encoded files.\n - List of supported entries can be found [here](https://docs.rs/nom-kconfig/latest/nom_kconfig/entry/enum.Entry.html).\n - List of supported attributes can be found [here](https://docs.rs/nom-kconfig/latest/nom_kconfig/attribute/enum.Attribute.html).\n - When [`source`](https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html#menu-entries) is met, it reads and parses the specified configuration file.\n - This library uses `clone()` a lot. Do not expect amazing performances.\n - This parser has been tested on the Linux kernel repository from [2.6.11](https://cdn.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.tar.xz) to [6.4.9](https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.4.9.tar.xz) (3733 versions).\n - There is a cargo feature `coreboot` that adds support for some coreboot-specific syntax.\n \n\n## Getting started\n\n```bash\ncargo add nom-kconfig\n```\n\n```rust\nuse std::path::PathBuf;\nuse nom_kconfig::{parse_kconfig, KconfigInput, KconfigFile};\nuse std::collections::HashMap;\n\n// curl https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.4.9.tar.xz | tar -xJ -C /tmp/\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut variables = HashMap::new();\n    variables.insert(\"SRCARCH\", \"x86\");\n    let kconfig_file = KconfigFile::new_with_vars(\n        PathBuf::from(\"/tmp/linux-6.4.9\"), \n        PathBuf::from(\"/tmp/linux-6.4.9/Kconfig\"),\n        \u0026variables\n    );\n    let input = kconfig_file.read_to_string()?;\n    let kconfig = parse_kconfig(KconfigInput::new_extra(\u0026input, kconfig_file));\n    println!(\"{:?}\", kconfig);\n    Ok(())\n}\n```\n\n## Resources\n - https://www.kernel.org/doc/html/next/kbuild/kconfig-language.html\n - https://doc.coreboot.org/getting_started/kconfig.html\n - https://build2.org/libbuild2-kconfig/doc/build2-kconfig-manual.xhtml#lang","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcdostone%2Fnom-kconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcdostone%2Fnom-kconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcdostone%2Fnom-kconfig/lists"}