jtojnar/nixpkgs-hammering
关于
把 Nix 包表达式整理得井井有条
其他项目实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文nixpkgs-hammering
There are many idioms in nixpkgs which beginner packagers might not be aware of. This is a set of nit-picky rules that aim to point out and explain common mistakes in nixpkgs package pull requests.
This repository contains a bunch of overlays that add extra checks to stdenv.mkDerivation and other similar nixpkgs tools. The nixpkgs-hammer command will try to evaluate the specified attributes with the overlays, making sure the warnings only touch the attributes you care about, not their dependencies.
Note that while these rules almost always apply, there are some exceptions. Please read the explanations before taking an action.
How do I use this?
Run the following command in your nixpkgs directory when you use classic Nix:
nix-shell https://github.com/jtojnar/nixpkgs-hammering/archive/main.tar.gz -A nixpkgs-hammering --run 'nixpkgs-hammer <attr-path>...'
or with Flakes-enabled Nix:
nix run github:jtojnar/nixpkgs-hammering <attr-path>...
or when you use unstable Nix but do not have Flakes enabled:
nix shell -f https://github.com/jtojnar/nixpkgs-hammering/archive/main.tar.gz -c nixpkgs-hammer <attr-path>...
How does this work?
There are two kinds of checks.
The first kind can be expressed directly in Nix and they are implemented as Nixpkgs overlays that replace stdenv.mkDerivation and other similar functions and attach an attribute containing a report to the resulting derivation’s attribute set. The tool then evaluates the attribute.
The second are more involved and the tool will execute them individually, passing each of them the attribute paths to check, the corresponding file paths, and (if available) build logs. They are implemented in Rust so they can perform arbitrary validation tasks – for example, parse the code into AST, read build logs, inspect the build output or even access network.
How do I develop this?
Run tests:
cargo test
Note The overlays of new checks must be added to the Git index in order for nixpkgs-hammering to discover them.
License
The code is licensed under MIT, the explanations are licensed under CC BY 4.0.
探索相关项目
加载中…