tiny-raytracer/flake.nix
Christoph Heiss 5c264ae62d
All checks were successful
flake / build (push) Successful in 3m27s
nightly build / build (push) Successful in 3m35s
flake: enable clang-format formatter
Signed-off-by: Christoph Heiss <christoph@c8h4.io>
2024-10-26 21:24:30 +02:00

87 lines
1.9 KiB
Nix

{
description = "tiny-raytracer";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
flake-utils,
treefmt-nix,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { inherit system; };
inherit (flake-utils.lib) mkApp;
treefmt = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
clang-format.enable = true;
deadnix.enable = true;
nixfmt.enable = true;
prettier.enable = true;
statix.enable = true;
};
};
tiny-raytracer = pkgs.stdenv.mkDerivation {
pname = "tiny-raytracer";
version = "0.1.0";
src = ./.;
buildInputs = with pkgs; [
glm
pngpp
];
nativeBuildInputs = with pkgs; [
meson
ninja
pkg-config
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp -v ./tiny-raytracer $out/bin/
runHook postInstall
'';
};
in
{
apps.tiny-raytracer = mkApp { drv = tiny-raytracer; };
checks.formatting = treefmt.config.build.check self;
formatter = treefmt.config.build.wrapper;
packages = {
inherit tiny-raytracer;
};
devShells.default = pkgs.mkShell {
inputsFrom = [ treefmt.config.build.devShell ];
nativeBuildInputs = with pkgs; [
clang
gdb
glm
meson
ninja
pkg-config
pngpp
];
};
}
);
}