chatthing/flake.nix

86 lines
2 KiB
Nix
Raw Normal View History

2024-09-23 00:12:56 +00:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
devenv = {
url = "github:cachix/devenv/1e4701fb1f51f8e6fe3b0318fc2b80aed0761914";
};
};
outputs = {
self,
nixpkgs,
crane,
fenix,
flake-utils,
devenv,
...
} @ inputs:
flake-utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages.${system};
rs-toolchain = with fenix.packages.${system};
combine [
complete.toolchain
];
in {
# devShells.default = pkgs.mkShell rec {
# buildInputs = with pkgs; [
# ];
# LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath buildInputs;
# };
devShells.default = devenv.lib.mkShell {
inherit inputs pkgs;
modules = [
({pkgs, ...}: {
packages = with pkgs; [
rs-toolchain
sqlx-cli
libpqxx
cargo-watch
bacon
];
languages.rust.enable = true;
services.postgres = {
enable = true;
listen_addresses = "127.0.0.1";
};
env = {
DATABASE_URL = "postgres://localhost/chatdings";
};
})
];
};
2024-11-06 15:19:32 +00:00
packages.default = let
toolchain = inputs.fenix.packages.${system}.minimal.toolchain;
pkgs = nixpkgs.legacyPackages.${system};
in
(pkgs.makeRustPlatform {
cargo = toolchain;
rustc = toolchain;
})
.buildRustPackage {
pname = "chatthing";
version = "0.1.0";
src = ./.;
builtInputs = [pkgs.libpqxx pkgs.openssl];
nativeBuildInputs = [pkgs.pkg-config];
cargoLock.lockFile = ./Cargo.lock;
};
2024-09-23 00:12:56 +00:00
});
}