hyporo/flake.nix

82 lines
2.5 KiB
Nix
Raw Normal View History

2024-03-23 01:31:55 +05:00
{
description = "hpr";
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";
inputs.rust-analyzer-src.follows = "";
};
};
outputs = inputs @ { self, nixpkgs, crane, fenix, ... }:
let
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ];
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
in {
packages = forAllSystems (system: {
hpr = let
pkgs = nixpkgsFor.${system};
craneLib = crane.lib.${system};
in craneLib.buildPackage {
src = craneLib.cleanCargoSource (craneLib.path ./.);
strictDeps = true;
buildInputs = [];
};
default = self.packages.${system}.hpr;
});
checks = forAllSystems (system: {
inherit (self.packages.${system}.hpr);
hpr-fmt = let craneLib = crane.lib.${system}; in craneLib.cargoFmt {
src = craneLib.cleanCargoSource (craneLib.path ./.);
};
});
apps = forAllSystems (system: {
default = {
type = "app";
program = "${self.packages.${system}.hpr}/bin/hpr";
};
});
devShells = forAllSystems (system: {
default = let
pkgs = nixpkgsFor.${system};
2024-03-30 00:31:28 +05:00
2024-03-23 01:31:55 +05:00
in pkgs.mkShell {
2024-03-30 00:31:28 +05:00
buildInputs = with pkgs; [
2024-03-23 01:31:55 +05:00
fenix.packages.${system}.complete.toolchain
2024-03-30 00:31:28 +05:00
cargo-watch
mold-wrapped
cmake
xorg.libXi xorg.libX11 xorg.libXcursor
lld libxkbcommon pkg-config alsa-lib libudev-zero
libGL
vulkan-tools vulkan-headers vulkan-loader vulkan-validation-layers
2024-03-23 01:31:55 +05:00
];
2024-03-30 00:31:28 +05:00
shellHook = ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${
with pkgs; lib.makeLibraryPath [ libGL xorg.libX11 xorg.libXi xorg.libXcursor libxkbcommon vulkan-loader ]
}"
'';
2024-03-23 01:31:55 +05:00
};
hpr = crane.lib.${system}.devShell {
checks = self.checks.${system};
packages = [];
};
});
};
}