Use manual build process in org-file for now for more flexibility

This commit is contained in:
heyarne 2021-06-11 16:59:19 +02:00
commit 743ab70eee
5 changed files with 45 additions and 51 deletions

1
.envrc Normal file
View file

@ -0,0 +1 @@
use flake

View file

@ -1,15 +0,0 @@
{ 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;
}

19
flake.lock generated
View file

@ -30,10 +30,27 @@
"type": "github"
}
},
"owid-co2-data": {
"flake": false,
"locked": {
"lastModified": 1612965128,
"narHash": "sha256-F9Qb+wGbJ8x/k1gT+C/GyXBHi1XxFnoqyHkuy6oslU0=",
"owner": "owid",
"repo": "co2-data",
"rev": "5ce76ff7269c024e12c6554bf041eca68babaf2c",
"type": "github"
},
"original": {
"owner": "owid",
"repo": "co2-data",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"owid-co2-data": "owid-co2-data"
}
}
},

View file

@ -4,22 +4,38 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
# data sources
owid-co2-data = {
# TODO Include these two files:
# - https://github.com/owid/co2-data/blob/master/owid-co2-data.csv
# - https://github.com/owid/co2-data/blob/master/owid-co2-codebook.csv
url = "github:owid/co2-data";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils }:
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let pkgs = nixpkgs.legacyPackages.${system}; in
{
devShell = import ./shell.nix { inherit pkgs; };
devShell =
let
lib = pkgs.lib;
in pkgs.mkShell rec {
name = "datasette";
buildInputs = with pkgs; [
sqlite
libspatialite
spatialite_tools
rlwrap
datasette
];
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
};
}
);
# outputs = { self, nixpkgs, flake-utils, ... }:
# flake-utils.lib.eachDefaultSystem
# (system:
# let pkgs.legacyPackages.${system}; in
# {
# devShell = import ./shell.nix { inherit pkgs; };
# }
# );
}

View file

@ -1,25 +0,0 @@
{ pkgs ? import <nixpkgs> { } }:
let
lib = pkgs.lib;
in pkgs.mkShell rec {
name = "datasette";
buildInputs = with pkgs; [
sqlite
libspatialite
spatialite_tools
rlwrap
datasette
];
LD_LIBRARY_PATH = "${lib.makeLibraryPath buildInputs}";
shellHook = ''
datasette \
--load-extension=mod_spatialite.so \
-m metadata.yml -h 0.0.0.0 --cors --setting default_cache_ttl 1800 \
--immutable dbs/*.db
datasette dbs/*
'';
}