sanetrade/flake.nix

80 lines
2.3 KiB
Nix
Raw Permalink Normal View History

2024-06-07 14:47:02 +00:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
devenv.url = "github:cachix/devenv";
rust-overlay.url = "github:oxalica/rust-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
};
nixConfig = {
extra-trusted-public-keys = [
"devenv.cachix.org-1:w1cLUi8dv3hnoSPGAuibQv+f9TZLr6cv/Hm9XgU50cw="
"surrealdb.cachix.org-1:rbm7Qs+s36pxbfk9jhIa5HRld6gZ63koZz1h/9sSxaA="
];
extra-substituters =
[ "https://devenv.cachix.org" "https://surrealdb.cachix.org" ];
};
outputs = { flake-parts, ... }@inputs:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ inputs.devenv.flakeModule inputs.treefmt-nix.flakeModule ];
systems = inputs.nixpkgs.lib.systems.flakeExposed;
perSystem = { config, pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ inputs.rust-overlay.overlays.default ];
};
treefmt = {
package = pkgs.treefmt;
programs = {
leptosfmt.enable = true;
prettier.enable = true;
nixfmt-rfc-style.enable = true;
rustfmt.enable = true;
};
projectRootFile = ./flake.nix;
};
devenv.shells.default = rec {
packages = with pkgs; [
pkg-config
fontconfig.dev
freetype.dev
openssl
protobuf
# If on x11
xorg.libX11
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
# If on wayland
libxkbcommon
wayland
vulkan-tools
vulkan-headers
vulkan-validation-layers
vulkan-loader
udev
openapi-generator-cli
];
env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
scripts = {
fmt.exec = "${config.treefmt.build.wrapper}/bin/treefmt .";
sanetrade.exec = "RUST_LOG=error,sanetrade=trace,ming=trace cargo run -p sanetrade_app -- $@";
};
};
};
};
}