diff --git a/flake.lock b/flake.lock index e9d7f24..28f0ecb 100644 --- a/flake.lock +++ b/flake.lock @@ -695,7 +695,7 @@ }, "nim2nix_3": { "inputs": { - "nixpkgs": "nixpkgs_5" + "nixpkgs": "nixpkgs_6" }, "locked": { "lastModified": 1725469705, @@ -894,6 +894,22 @@ } }, "nixpkgs_5": { + "locked": { + "lastModified": 1735554305, + "narHash": "sha256-zExSA1i/b+1NMRhGGLtNfFGXgLtgo+dcuzHzaWA6w3Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "0e82ab234249d8eee3e8c91437802b32c74bb3fd", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { "locked": { "lastModified": 1724479785, "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", @@ -971,6 +987,7 @@ "pixi": "pixi", "sops-nix": "sops-nix", "stable": "stable", + "treefmt-nix": "treefmt-nix_2", "tsm": "tsm", "utils": "utils" } @@ -1129,6 +1146,24 @@ "type": "github" } }, + "treefmt-nix_2": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1736154270, + "narHash": "sha256-p2r8xhQZ3TYIEKBoiEhllKWQqWNJNoT9v64Vmg4q8Zw=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "13c913f5deb3a5c08bb810efd89dc8cb24dd968b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "tsm": { "inputs": { "nim2nix": "nim2nix_3", diff --git a/flake.nix b/flake.nix index baee549..55fd898 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,7 @@ nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; stable.url = "github:nixos/nixpkgs/nixos-24.05"; my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable"; + treefmt-nix.url = "github:numtide/treefmt-nix"; nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; nixos-wsl.url = "github:nix-community/NixOS-WSL"; diff --git a/lib/default.nix b/lib/default.nix index 37b6a77..63c27d9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -1,4 +1,9 @@ -inputs@{ nixpkgs, self, ... }: +inputs@{ + nixpkgs, + treefmt-nix, + self, + ... +}: let lib = nixpkgs.lib.extend (import ./extended.nix inputs); @@ -7,6 +12,9 @@ let genAttrs pkgFromSystem loadOverlays + enabled + listify + enableAttrs ; inherit (import ./find-modules.nix { inherit lib; }) findModulesList; @@ -51,7 +59,7 @@ let default = oizys; oizys = pkgs.callPackage ../pkgs/oizys { }; iso = mkIso.config.system.build.isoImage; - lix = pkgs.lix; + lix = pkgFromSystem pkgs.system "lix-module"; } // (inheritFlakePkgs pkgs [ "pixi" @@ -77,7 +85,24 @@ let system = pkgs.system; } ); - formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); + # formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style); + formatter = forAllSystems ( + pkgs: + (treefmt-nix.lib.evalModule pkgs ( + { ... }: + { + projectRootFile = "flake.nix"; + # don't warn me about missing formatters + settings.excludes = [ + # likely to be nnl lockfiles + "pkgs/**/lock.json" + "hosts/**/secrets.yaml" + ]; + settings.on-unmatched = "debug"; + programs = "prettier|nixfmt" |> listify |> enableAttrs; + } + )).config.build.wrapper + ); }; in {