Single build output: Earth.db with cumulative CO2 emissions
This commit is contained in:
parent
05080e720a
commit
a8e558b3d5
2 changed files with 23 additions and 0 deletions
15
default.nix
Normal file
15
default.nix
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{ pkgs ? import <nixpkgs> {} }:
|
||||
let
|
||||
name = "earth";
|
||||
builder = ./importers/owid.sh;
|
||||
src = ./sources/cumulative_co2_emissions.csv;
|
||||
|
||||
csvsToSqlite = pkgs.csvs-to-sqlite;
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
name = "${name}.db";
|
||||
inherit src;
|
||||
inherit builder;
|
||||
|
||||
inherit csvsToSqlite;
|
||||
}
|
||||
8
importers/owid.sh
Normal file
8
importers/owid.sh
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
${csvsToSqlite}/bin/csvs-to-sqlite \
|
||||
--shape 'Entity:entity(text),Code:code(text),Year:year(integer),Cumulative CO2 emissions:cumulative_co2_emissions(real)' \
|
||||
--index entity \
|
||||
--index code \
|
||||
--index year \
|
||||
--replace-tables \
|
||||
$src $out
|
||||
Loading…
Add table
Add a link
Reference in a new issue