Files
nix_builder/flake.nix

67 lines
1.6 KiB
Nix
Raw Normal View History

2026-02-14 22:15:09 -05:00
{
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
'';
};
}
);
};
}