lyrs/flake.nix

73 lines
1.9 KiB
Nix
Raw Normal View History

2023-11-10 20:06:30 -06:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk/master";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {self, ...}:
inputs.utils.lib.eachDefaultSystem (system: let
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
(import inputs.rust-overlay)
];
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
naersk = pkgs.callPackage inputs.naersk {
cargo = toolchain;
rustc = toolchain;
};
in {
packages.default = naersk.buildPackage {
src = ./.;
2023-11-12 09:56:23 -06:00
buildInputs = with pkgs; [sqlite];
2023-11-10 20:06:30 -06:00
};
formatter = pkgs.alejandra;
checks = {
inherit (self.packages.${system}) default;
# TODO: clippy and other checks?
};
devShell = with pkgs;
mkShell {
buildInputs = [
2023-11-12 11:15:14 -06:00
# dedupe from package inputs?
sqlite
2023-11-10 20:06:30 -06:00
toolchain
2023-11-12 09:56:23 -06:00
2023-11-10 20:06:30 -06:00
rustfmt
rustPackages.clippy
rust-analyzer
2023-11-10 23:30:58 -06:00
nodePackages_latest.vscode-langservers-extracted
2023-11-12 09:56:23 -06:00
# to install sea-orm-cli
pkg-config
openssl
2023-11-12 09:56:23 -06:00
hurl
2023-11-10 20:06:30 -06:00
];
RUST_SRC_PATH = rustPlatform.rustLibSrc;
2023-11-12 09:56:23 -06:00
shellHook = ''
export MIGRATION_DIR="src/migrator"
export DATABASE_URL="sqlite://./data/lyrs.sqlitedb?mode=rwc";
2023-11-13 16:16:17 -06:00
export COOKIE_KEY="2z49_8yfKUkoTOo0cjzzjwufCfhKvfOIc1CGleuTXC5zRqY4U0Xhkd34ipREQN5iHRH62tt5O7y6U5mmFBH3MA"
export RUST_BACKTRACE="1"
export RUSTFLAGS="--cfg uuid_unstable"
2023-11-12 09:56:23 -06:00
'';
2023-11-10 20:06:30 -06:00
};
});
}