migrate sqlite3 to nix

This commit is contained in:
Dan Vargas 2022-02-06 14:07:13 -07:00
parent f113b0c00a
commit 2758f95228
7 changed files with 31 additions and 21 deletions

View File

@ -1,10 +0,0 @@
#!/bin/bash
PREFIX=$(realpath $(dirname $0))
curl https://www.sqlite.org/2021/sqlite-amalgamation-3360000.zip -o sqlite.zip
unzip -q sqlite.zip
rm -rf sqlite.zip
gcc -DSQLITE_THREADSAFE=0 -DSQLITE_OMIT_LOAD_EXTENSION sqlite-amalgamation-3360000/shell.c sqlite-amalgamation-3360000/sqlite3.c -o sqlite3
rm -rf sqlite-amalgamation-3360000

View File

@ -1,2 +0,0 @@
#!/bin/bash
export PATH=$PWD:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "sqlite3",
"version": "3.36.0",
"aliases": ["sqlite", "sql"]
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
sqlite3 < "$1"

View File

@ -1 +0,0 @@
SELECT 'OK';

View File

@ -19,4 +19,5 @@ args: {
"vlang" = import ./vlang.nix args;
"swift" = import ./swift.nix args;
"node-typescript" = import ./node-typescript.nix args;
"sqlite3" = import ./sqlite3.nix args;
}

30
runtimes/sqlite3.nix Normal file
View File

@ -0,0 +1,30 @@
{pkgs, piston, ...}:
let
pkg = pkgs.sqlite;
in piston.mkRuntime {
language = "sqlite3";
version = pkg.version;
aliases = [
"sqlite"
"sql"
];
run = ''
${pkg}/bin/sqlite3 < "$1"
'';
tests = [
(piston.mkTest {
files = {
"test.sql" = ''
SELECT 'OK';
'';
};
args = [];
stdin = "";
packages = [];
main = "test.sql";
})
];
}