Set up nix develop to work with nix flakes

This commit is contained in:
heyarne 2021-06-03 11:57:14 +02:00
commit 05080e720a
3 changed files with 92 additions and 0 deletions

42
flake.lock generated Normal file
View file

@ -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
}

25
flake.nix Normal file
View file

@ -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; };
# }
# );
}

25
shell.nix Normal file
View file

@ -0,0 +1,25 @@
{ 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/*
'';
}