nite/flake.nix
2024-05-15 15:22:28 +03:00

76 lines
2.2 KiB
Nix

{
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
# 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
];
env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
scripts = {
fmt.exec = "${config.treefmt.build.wrapper}/bin/treefmt .";
nite.exec = "RUST_LOG=info,nite=trace,ming=trace cargo run -- $@";
};
};
};
};
}