From 54c04d379643e92dadeccda6f2423937d5e2b1ee Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Mon, 23 Dec 2024 18:39:15 +0100 Subject: build(flake): Use treefmt as nix formatter This allows us to also keep markdown and other documents, that aren't nix, formatted. --- flake.nix | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index dc63ea9..c7af7b4 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,13 @@ library.url = "git+https://git.vhack.eu/vhack.eu/nix-library?ref=prime"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + # inputs for following systems = { url = "github:nix-systems/x86_64-linux"; # only evaluate for this system @@ -76,6 +83,7 @@ nixpkgs, nixpkgs-unstable, library, + treefmt-nix, # modules simple-nixos-mailserver, impermanence, @@ -107,6 +115,7 @@ vhackPackages = import ./pkgs {inherit pkgs nixLib;}; inherit (library) nixLib; + treefmtEval = import ./treefmt.nix {inherit treefmt-nix pkgs;}; in { nixosConfigurations."server1" = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; @@ -119,15 +128,17 @@ ]; }; - checks."${system}" = tests; + checks."${system}" = nixLib.warnMerge tests { + formatting = + treefmtEval.config.build.check self; + } "the flake checks"; packages."${system}" = vhackPackages; + formatter."${system}" = treefmtEval.config.build.wrapper; devShells."${system}" = { default = pkgs.mkShell { packages = with pkgs; [ - alejandra - # used for certificate generation in the taskserver setup gnutls @@ -138,6 +149,5 @@ ]; }; }; - formatter."${system}" = pkgs.alejandra; }; } -- cgit 1.4.1