87 lines
1.9 KiB
Nix
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
|
|
];
|
|
};
|
|
}
|
|
);
|
|
}
|