73 lines
1.9 KiB
Nix
73 lines
1.9 KiB
Nix
{
|
|
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 = ./.;
|
|
buildInputs = with pkgs; [sqlite];
|
|
};
|
|
formatter = pkgs.alejandra;
|
|
checks = {
|
|
inherit (self.packages.${system}) default;
|
|
# TODO: clippy and other checks?
|
|
};
|
|
devShell = with pkgs;
|
|
mkShell {
|
|
buildInputs = [
|
|
# dedupe from package inputs?
|
|
sqlite
|
|
|
|
toolchain
|
|
|
|
rustfmt
|
|
rustPackages.clippy
|
|
rust-analyzer
|
|
nodePackages_latest.vscode-langservers-extracted
|
|
|
|
# to install sea-orm-cli
|
|
pkg-config
|
|
openssl
|
|
|
|
hurl
|
|
];
|
|
RUST_SRC_PATH = rustPlatform.rustLibSrc;
|
|
shellHook = ''
|
|
export MIGRATION_DIR="src/migrator"
|
|
export DATABASE_URL="sqlite://./data/lyrs.sqlitedb?mode=rwc";
|
|
export COOKIE_KEY="2z49_8yfKUkoTOo0cjzzjwufCfhKvfOIc1CGleuTXC5zRqY4U0Xhkd34ipREQN5iHRH62tt5O7y6U5mmFBH3MA"
|
|
export RUST_BACKTRACE="1"
|
|
export RUSTFLAGS="--cfg uuid_unstable"
|
|
'';
|
|
};
|
|
});
|
|
}
|