From 12461750823f62ac78bde369351dc9d32881de53 Mon Sep 17 00:00:00 2001 From: technofab Date: Thu, 28 Aug 2025 09:06:24 +0200 Subject: [PATCH] chore: add treefmt --- README.md | 4 ++-- nix/repo/devShells.nix | 14 ++++++++++++-- nix/repo/flake.lock | 23 ++++++++++++++++++++--- nix/repo/flake.nix | 9 +++++++-- 4 files changed, 41 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index bc1aec9..d46cb7c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Soonix -Soonix helps you declaratively manage configuration files, build scripts, etc. using the Nix module system. +Soonix helps you declaratively manage configuration files, build scripts, etc. using the Nix module system. It minimizes configuration clutter and provides shell hooks for automatic file management. -Heavily based on and inspired by [Nixago](https://github.com/nix-community/nixago), thus the name (ago <-> soon, if that wasn't obvious). +Heavily based on and inspired by [Nixago](https://github.com/nix-community/nixago), thus the name (ago \<-> soon, if that wasn't obvious). ## Features diff --git a/nix/repo/devShells.nix b/nix/repo/devShells.nix index eb29994..8e5c5a8 100644 --- a/nix/repo/devShells.nix +++ b/nix/repo/devShells.nix @@ -1,11 +1,21 @@ -{inputs, ...}: let - inherit (inputs) pkgs devshell soonix; +{ + cell, + inputs, + ... +}: let + inherit (inputs) pkgs devshell soonix treefmt; in { default = devshell.mkShell { imports = [soonix.devshellModule]; packages = [ pkgs.alejandra pkgs.nil + (treefmt.mkWrapper pkgs { + programs = { + alejandra.enable = true; + mdformat.enable = true; + }; + }) ]; soonix.hooks.test = { diff --git a/nix/repo/flake.lock b/nix/repo/flake.lock index f19d0df..b9bf386 100644 --- a/nix/repo/flake.lock +++ b/nix/repo/flake.lock @@ -17,7 +17,7 @@ "type": "gitlab" } }, - "nixmkdocs": { + "nixmkdocs-lib": { "locked": { "dir": "lib", "lastModified": 1755785622, @@ -54,8 +54,25 @@ "root": { "inputs": { "devshell-lib": "devshell-lib", - "nixmkdocs": "nixmkdocs", - "nixtest-lib": "nixtest-lib" + "nixmkdocs-lib": "nixmkdocs-lib", + "nixtest-lib": "nixtest-lib", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "flake": false, + "locked": { + "lastModified": 1755934250, + "narHash": "sha256-CsDojnMgYsfshQw3t4zjRUkmMmUdZGthl16bXVWgRYU=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "74e1a52d5bd9430312f8d1b8b0354c92c17453e5", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/nix/repo/flake.nix b/nix/repo/flake.nix index 69c4f22..f4f837c 100644 --- a/nix/repo/flake.nix +++ b/nix/repo/flake.nix @@ -2,14 +2,19 @@ inputs = { devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib"; nixtest-lib.url = "gitlab:TECHNOFAB/nixtest?dir=lib"; - nixmkdocs.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib"; + nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; + flake = false; + }; }; outputs = i: i // { ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;}; devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;}; - doclib = i.nixmkdocs.lib {inherit (i.parent) pkgs;}; + doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;}; soonix = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;}; + treefmt = import i.treefmt-nix; }; }