diff --git a/flake.lock b/flake.lock index 3e4fb03..f26f655 100644 --- a/flake.lock +++ b/flake.lock @@ -18,6 +18,21 @@ "type": "github" } }, + "flake-root": { + "locked": { + "lastModified": 1713493429, + "narHash": "sha256-ztz8JQkI08tjKnsTpfLqzWoKFQF4JGu2LRz8bkdnYUk=", + "owner": "srid", + "repo": "flake-root", + "rev": "bc748b93b86ee76e2032eecda33440ceb2532fcd", + "type": "github" + }, + "original": { + "owner": "srid", + "repo": "flake-root", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1682960002, @@ -52,10 +67,46 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1708475490, + "narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e74ca98a74bc7270d28838369593635a5db3260", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "flake-root": "flake-root", + "nixpkgs": "nixpkgs", + "treefmt-nix": "treefmt-nix" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1711963903, + "narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 9f38b46..a256107 100644 --- a/flake.nix +++ b/flake.nix @@ -3,10 +3,16 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; flake-parts.url = "github:hercules-ci/flake-parts"; + flake-root.url = "github:srid/flake-root"; + treefmt-nix.url = "github:numtide/treefmt-nix"; }; - outputs = { self, nixpkgs, flake-parts }@inputs: + outputs = { flake-parts, flake-root, treefmt-nix, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + inputs.flake-root.flakeModule + inputs.treefmt-nix.flakeModule + ]; flake = { # Universal things }; @@ -22,6 +28,26 @@ ]; buildInputs = [ ]; }; + + treefmt.config = { + inherit (config.flake-root) projectRootFile; + package = pkgs.treefmt; + + programs = { + deadnix.enable = true; + #mdformat.enable = false; + }; + + settings.formatter = { + #mdformat = { + # includes = pkgs.lib.mkForce [ + # "archtypes/*.md" + # "content/*.md" + # "public/*.md" + # ]; + #}; + }; + }; }; }; }