From 2758f95228040cef6254ede212454193020c5f7c Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 14:07:13 -0700 Subject: [PATCH] migrate sqlite3 to nix --- packages/sqlite3/3.36.0/build.sh | 10 --------- packages/sqlite3/3.36.0/environment | 2 -- packages/sqlite3/3.36.0/metadata.json | 5 ----- packages/sqlite3/3.36.0/run | 3 --- packages/sqlite3/3.36.0/test.sql | 1 - runtimes/default.nix | 1 + runtimes/sqlite3.nix | 30 +++++++++++++++++++++++++++ 7 files changed, 31 insertions(+), 21 deletions(-) delete mode 100755 packages/sqlite3/3.36.0/build.sh delete mode 100644 packages/sqlite3/3.36.0/environment delete mode 100644 packages/sqlite3/3.36.0/metadata.json delete mode 100644 packages/sqlite3/3.36.0/run delete mode 100644 packages/sqlite3/3.36.0/test.sql create mode 100644 runtimes/sqlite3.nix diff --git a/packages/sqlite3/3.36.0/build.sh b/packages/sqlite3/3.36.0/build.sh deleted file mode 100755 index 18d5b8f..0000000 --- a/packages/sqlite3/3.36.0/build.sh +++ /dev/null @@ -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 diff --git a/packages/sqlite3/3.36.0/environment b/packages/sqlite3/3.36.0/environment deleted file mode 100644 index 50242cc..0000000 --- a/packages/sqlite3/3.36.0/environment +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -export PATH=$PWD:$PATH diff --git a/packages/sqlite3/3.36.0/metadata.json b/packages/sqlite3/3.36.0/metadata.json deleted file mode 100644 index d531aaf..0000000 --- a/packages/sqlite3/3.36.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "sqlite3", - "version": "3.36.0", - "aliases": ["sqlite", "sql"] -} diff --git a/packages/sqlite3/3.36.0/run b/packages/sqlite3/3.36.0/run deleted file mode 100644 index 8484f3d..0000000 --- a/packages/sqlite3/3.36.0/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -sqlite3 < "$1" diff --git a/packages/sqlite3/3.36.0/test.sql b/packages/sqlite3/3.36.0/test.sql deleted file mode 100644 index 3a3c57b..0000000 --- a/packages/sqlite3/3.36.0/test.sql +++ /dev/null @@ -1 +0,0 @@ -SELECT 'OK'; diff --git a/runtimes/default.nix b/runtimes/default.nix index 6aa3355..9e817a6 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -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; } diff --git a/runtimes/sqlite3.nix b/runtimes/sqlite3.nix new file mode 100644 index 0000000..5fc105a --- /dev/null +++ b/runtimes/sqlite3.nix @@ -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"; + }) + ]; +} \ No newline at end of file