Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tristancacqueray/nix-diff-bill-of-materials

Compare the sources of two nix installables
https://github.com/tristancacqueray/nix-diff-bill-of-materials

nix

Last synced: 4 days ago
JSON representation

Compare the sources of two nix installables

Awesome Lists containing this project

README

        

# ndbom: nix diff bill of materials

ndbom collects the sources of a given installable to compute
the source diff between two versions.

The goal is to show the list of every LOC added after running
`nix flake update`.

## Usage

Here are a few demos:

- Compare two versions:

```ShellSession
$ nix flake update
$ ndbom diff github:TristanCacqueray/nix-diff-bill-of-materials#devShell.x86_64-linux .#devShell.x86_64-linux
[+] Modified ansi-terminal: 0.11.5 -> 1.0.2
diff -rup ansi-terminal-0.11.5/CHANGELOG.md ansi-terminal-1.0.2/CHANGELOG.md
--- ansi-terminal-0.11.5/CHANGELOG.md 2023-03-20 16:27:58.000000000 -0400
+++ ansi-terminal-1.0.2/CHANGELOG.md 2024-01-13 12:23:51.000000000 -0500
@@ -1,6 +1,41 @@
Changes
=======

+Version 1.0.2
+-------------
+
+* On Windows, fix linker error about a duplicate symbol `castUINTPtrToPtr`.
+
```

- List a nixpkgs package sources:

```ShellSession
$ ndbom list nixpkgs/nixos-23.11#mold
mold 2.3.3
tbb 2021.8.0
mimalloc 2.1.2
```

- List a rust application sources built with crane:

```ShellSession
$ ndbom list github:logjuicer/logjuicer
logjuicer-cli 0.9.6
logjuicer-cli-deps 0.9.6
sqlx-macros 0.7.2
sprs-0.11.1: /nix/store/cly8f0899l67k60wcv3ck8jvaww1r2b6-sprs-0.11.1
web-sys-0.3.64: /nix/store/fk4kp403rblhpxs4jbkjs6p8iaz8hnfw-web-sys-0.3.64
tokio-stream-0.1.14: /nix/store/sb8vdsbprwc4ssfgk4flhmwngnrlxndn-tokio-stream-0.1.14
```

> Note that some sources are unknown, that's because they are provided by the flake self.

- List a haskell application sources built with nixpkgs:

```ShellSession
$ ndbom list github:Gabriel439/nix-diff
nix-diff 1.0.19
nix-derivation 1.1.2
QuickCheck 2.14.2
splitmix 0.1.0.4
hscolour 1.24.4
random 1.2.1.1
attoparsec 0.14.4
```

- List an emacs with packages:

```ShellSession
$ ndbom list github:podenv/nano-agenda.nix
markdown-mode 20231028.853
org-ql 20231106.2230
s 20220902.1511
transient 20231112.923
compat 29.1.4.4
magit 20231112.914
magit-section 20231014.1405
```

- List a dev environment:

```ShellSession
$ ndbom list github:logjuicer/logjuicer#devShell.x86_64-linux
trunk 0.17.2
cargo-auditable 0.6.1
rust-analyzer 2023-10-02
capnproto 1.0.1
cargo-watch 8.4.1
wasm-pack 0.12.1
```

## Install

Install `ndbom` by running: `nix profile install github:TristanCacqueray/nix-diff-bill-of-materials`

## Roadmap

- [x] Show source diff.
- [ ] Filter the materials using custom exclude/include list, for example to focus on package registry like crates.io.
- [ ] Filter the diff, for example to highlight CHANGELOGs.
- [ ] Index the diff, for example in quickwit to show statistics like number of LOC added.

## Notes

Matching sources with their package name is surprisingly complicated, and this implementation may not work for every installables.
If you know a better way to do this, please let me know!