diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..85302d9 --- /dev/null +++ b/flake.lock @@ -0,0 +1,42 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1622445595, + "narHash": "sha256-m+JRe6Wc5OZ/mKw2bB3+Tl0ZbtyxxxfnAWln8Q5qs+Y=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "7d706970d94bc5559077eb1a6600afddcd25a7c8", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1622702532, + "narHash": "sha256-XAIvN+XyobDs8PmpwAO3Bto2zJBFAdTCNsjh6bBpH9g=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b42f9c725475e85d014dede34eaa7aaf1483b223", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..f4e5d61 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "Automated deployment of my datasette instance."; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem + (system: + let pkgs = nixpkgs.legacyPackages.${system}; in + { + devShell = import ./shell.nix { inherit pkgs; }; + } + ); + # outputs = { self, nixpkgs, flake-utils, ... }: + # flake-utils.lib.eachDefaultSystem + # (system: + # let pkgs.legacyPackages.${system}; in + # { + # devShell = import ./shell.nix { inherit pkgs; }; + # } + # ); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..a4dd6f3 --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +{ pkgs ? import { } }: + +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/* + ''; +}