Add sqlite for tracking build history.
This commit is contained in:
66
flake.nix
Normal file
66
flake.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
{
|
||||
description = "nix_builder development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
rust-overlay = {
|
||||
url = "github:oxalica/rust-overlay";
|
||||
inputs = {
|
||||
nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
rust-overlay,
|
||||
}:
|
||||
let
|
||||
forAllSystems =
|
||||
func:
|
||||
builtins.listToAttrs (
|
||||
map (system: {
|
||||
name = system;
|
||||
value = func system;
|
||||
}) nixpkgs.lib.systems.flakeExposed
|
||||
);
|
||||
|
||||
in
|
||||
{
|
||||
devShells = forAllSystems (
|
||||
system:
|
||||
let
|
||||
overlays = [ (import rust-overlay) ];
|
||||
pkgs = import nixpkgs {
|
||||
inherit system overlays;
|
||||
};
|
||||
rustToolchain = pkgs.pkgsBuildHost.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
nativeBuildInputs = [
|
||||
pkgs.pkg-config
|
||||
rustToolchain
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
sqlx-cli # For sqlx CLI to manage migrations
|
||||
sqlite # To access the database (sqlite is bundled into the nix_builder binary but this is for manually accessing the db).
|
||||
];
|
||||
shellHook = ''
|
||||
cat <<EOF
|
||||
nix_builder dev shell
|
||||
|
||||
Create new migrations with:
|
||||
sqlx migrate add -r <name>
|
||||
|
||||
Generate metadata for query!() macros:
|
||||
cargo sqlx prepare
|
||||
EOF
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user