Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`k2nix` proposal

Abierto
#49 1 comentario 2 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
20/100
Tipo de issue
Nueva funcionalidad
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
cpp

Línea de trabajo

Start by reviewing issue #47 and the proposed kbuild design, including the .kbuild example and boilerplate Nix flake using dream2nix. Determine how kbuild should translate project and dependency declarations into a flake and how kbuild shell . should invoke the resulting development environment. Done means the design is specified well enough to implement and provides the listed K, plugin, solc, and secp256k1 dependencies.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Having investigated #47, it turns out that the nix provided clang/c++ binaries are specially wrapped to ignore system wide paths as suspected. This wiki gives a bit more detail https://nixos.wiki/wiki/C, see also https://nixos.wiki/wiki/FAQ/I_installed_a_library_but_my_compiler_is_not_finding_it._Why%3F. THe way nix does this is to wrap the binaries in a script which reads any additional includes from NIX_CFLAGS_COMPILE/NIX_LDFLAGS. When a nix derivation is added to the buildInputs, nix automagically adds the relevant includes/ from those derivation to these vars inside it's build environment. The same thing happens when we call nix develop inside the project (e.g. evm-semantics), i.e. nix provides a shell with the same set of evn vars set correctly for clang to find the necessary libraries.

Given that C/C++ has no package manager, I think this is a sensible decision, but it does pose a question of how to provide an environment for developing with K, which implicitly relies on clang for the llvm-backend. One option would be to just patch nix provided clang to either look at the system path or alternatively provide versions of clang with the relevant libraries included in its search path, as discussed previously. However, both approaches go somewhat counter to nix philosophy and more importantly, given the discussions around kbuild, I believe it would make more sense to instead design a kbuild YAML/TOML format which nix can consume to supply the extra dependencies various projects require. This way, users wouldn't have to drop into the full nix language for basic/pre-packaged scenarios. Using nix in conjunction with kbuild, we could leverage nix to not only build executables but also provide us with a deterministic developer shell, which is largely consistent across the various distros, thus not relying on any system wide tools.

Roughly speaking we could have a .kbuild file:

[project]
k = ">=5.3.0"
title = "evm-semantics"
version = "0.1.0"

[dependencies.k]
repo = "https://github.com/runtimeverification/k"
rev = "..."

[dependencies.blockchain-k-plugin]
repo = "https://github.com/runtimeverification/blockchain-k-plugin"
rev = "..."

[dependencies.secp256k1]
type = "nix"

[dependencies.runtime.solc]
type = "nix"

...

and a boilerplate nix flake

{
  inputs = {
    dream2nix.url = "github:nix-community/dream2nix";
  };

  outputs = {
    self,
    dream2nix,
  } @ inp:
    (dream2nix.lib.makeFlakeOutputs {
      systems = ["x86_64-linux"];
      config.projectRoot = ./.;
      source = ./.;
      projects = ./projects.toml;
    });
}

where the .kbuild file would actually get translated by dream2nix into a flake via makeFlakeOutputs.

Then, calling something like kbuild shell . would simply call nix develop ., providing us with a shell with k, blockchain plugin, solc, secp256k1, etc.

Lenguaje dominante
Python
Estrellas
10
Forks
2
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de runtimeverification/kup

Todos los issues de runtimeverification/kup

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.