2024-03-18 22:46:41 -05:00
|
|
|
{
|
|
|
|
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
|
|
|
|
|
|
inputs.pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
|
|
|
inputs.pre-commit-hooks.inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
|
|
|
|
outputs = {
|
|
|
|
self,
|
|
|
|
pre-commit-hooks,
|
|
|
|
nixpkgs,
|
|
|
|
}: let
|
|
|
|
inherit (self) outputs;
|
|
|
|
supportedSystems = ["x86_64-linux" "aarch64-darwin"];
|
|
|
|
forEachSupportedSystem = nixpkgs.lib.genAttrs supportedSystems;
|
|
|
|
in {
|
|
|
|
formatter = forEachSupportedSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
|
|
|
|
|
|
|
|
checks = forEachSupportedSystem (system: {
|
|
|
|
pre-commit-check = pre-commit-hooks.lib.${system}.run {
|
|
|
|
src = ./.;
|
|
|
|
hooks = {
|
|
|
|
alejandra.enable = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
devShells = forEachSupportedSystem (system: let
|
|
|
|
pkgs = import nixpkgs {inherit system;};
|
|
|
|
in {
|
|
|
|
rust-dev = pkgs.mkShell {
|
|
|
|
inherit (outputs.checks.${system}.pre-commit-check) shellHook;
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
# nix tools
|
|
|
|
nil
|
|
|
|
alejandra
|
|
|
|
|
|
|
|
# rust tools
|
|
|
|
cargo
|
|
|
|
rustc
|
|
|
|
rustfmt
|
|
|
|
rustPackages.clippy
|
|
|
|
rust-analyzer
|
|
|
|
|
2024-03-19 12:07:37 -05:00
|
|
|
# linker
|
|
|
|
clang
|
|
|
|
mold
|
|
|
|
|
|
|
|
# debugger
|
|
|
|
lldb
|
2024-04-19 15:27:16 -05:00
|
|
|
gdbgui
|
2024-03-19 12:07:37 -05:00
|
|
|
|
|
|
|
# libs
|
2024-04-16 15:15:40 -05:00
|
|
|
libopus
|
2024-03-18 22:46:41 -05:00
|
|
|
openssl
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
default = outputs.devShells.${system}.rust-dev;
|
|
|
|
});
|
|
|
|
};
|
|
|
|
}
|