nite/flake.nix

77 lines
2.2 KiB
Nix
Raw Normal View History

2024-05-13 19:41:30 +00:00
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
2024-05-14 12:34:05 +00:00
devenv.url = "github:cachix/devenv";
2024-05-13 19:41:30 +00:00
rust-overlay.url = "github:oxalica/rust-overlay";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix.url = "github:numtide/treefmt-nix";
2024-05-14 12:34:05 +00:00
crane.url = "github:ipetkov/crane";
crane.inputs.nixpkgs.follows = "nixpkgs";
2024-05-13 19:41:30 +00:00
};
nixConfig = {
2024-05-14 12:34:05 +00:00
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" ];
2024-05-13 19:41:30 +00:00
};
2024-05-14 12:34:05 +00:00
outputs = { flake-parts, ... }@inputs:
2024-05-13 19:41:30 +00:00
flake-parts.lib.mkFlake { inherit inputs; } {
2024-05-14 12:34:05 +00:00
imports = [ inputs.devenv.flakeModule inputs.treefmt-nix.flakeModule ];
2024-05-13 19:41:30 +00:00
systems = inputs.nixpkgs.lib.systems.flakeExposed;
2024-05-14 12:34:05 +00:00
perSystem = { config, pkgs, system, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
config.allowUnfree = true;
overlays = [ inputs.rust-overlay.overlays.default ];
};
2024-05-13 19:41:30 +00:00
treefmt = {
2024-05-14 12:34:05 +00:00
package = pkgs.treefmt;
2024-05-13 19:41:30 +00:00
programs = {
2024-05-14 12:34:05 +00:00
leptosfmt.enable = true;
prettier.enable = true;
2024-05-13 19:41:30 +00:00
nixfmt-rfc-style.enable = true;
rustfmt.enable = true;
};
projectRootFile = ./flake.nix;
};
2024-05-14 12:34:05 +00:00
devenv.shells.default = rec {
packages = with pkgs; [
pkg-config
fontconfig.dev
freetype.dev
openssl
2024-05-13 19:41:30 +00:00
2024-05-14 12:34:05 +00:00
# If on x11
xorg.libX11
xorg.libX11
xorg.libXcursor
xorg.libXi
xorg.libXrandr
# If on wayland
libxkbcommon
wayland
2024-05-13 19:41:30 +00:00
2024-05-14 12:34:05 +00:00
vulkan-tools
vulkan-headers
vulkan-validation-layers
vulkan-loader
udev
];
2024-05-13 19:41:30 +00:00
2024-05-14 12:34:05 +00:00
env.LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath packages;
2024-05-13 19:41:30 +00:00
2024-05-14 12:34:05 +00:00
scripts = {
fmt.exec = "${config.treefmt.build.wrapper}/bin/treefmt .";
nite.exec = "RUST_LOG=info,nite=trace,ming=trace cargo run";
};
2024-05-13 19:41:30 +00:00
};
};
};
}