17 lines
555 B
Markdown
17 lines
555 B
Markdown
|
# nix-csv
|
||
|
|
||
|
Load a csv and use it in your nix as an attribute.
|
||
|
|
||
|
The challenge here is, that you could -in theory- parse files in nix directly, but nix is really bad at this.
|
||
|
What we do here, is using [builtins.fromJSON](https://nixos.org/manual/nix/unstable/language/builtins#builtins-fromJSON) by just converting the csv file to a json file first.
|
||
|
|
||
|
Quick summary of the pipeline:
|
||
|
|
||
|
```
|
||
|
test.csv -> csv-to-json -> test.json -> readFile -> fromJSON
|
||
|
```
|
||
|
|
||
|
See comments in `flake.nix` for how it works.
|
||
|
|
||
|
Technically this can adapted to any type of data source.
|