From 61997911557fa8da66598ec54f5f280e1be1dd5d Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Wed, 21 Aug 2024 12:47:29 +0200 Subject: build(flake): Setup up checks (formatter and derivation) --- flake.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 5413444..2c79390 100644 --- a/flake.nix +++ b/flake.nix @@ -14,12 +14,19 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-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 = nixpkgs.legacyPackages."${system}"; @@ -35,7 +42,18 @@ nativeBuildInputs = with pkgs; [ llvmPackages_latest.clang-unwrapped.lib ]; + + yt = pkgs.callPackage ./package.nix {}; + + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; in { + checks = { + inherit yt; + formatting = treefmtEval.config.build.check self; + }; + + formatter = treefmtEval.config.build.wrapper; + devShells.default = pkgs.mkShell { env = let clang_version = -- cgit 1.4.1