add treefmt-nix

This commit is contained in:
Daylin Morgan 2025-01-13 13:09:01 -06:00
parent cdfdeb1f78
commit a4cb7872ba
Signed by: daylin
GPG key ID: 950D13E9719334AD
3 changed files with 65 additions and 4 deletions

View file

@ -695,7 +695,7 @@
}, },
"nim2nix_3": { "nim2nix_3": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_5" "nixpkgs": "nixpkgs_6"
}, },
"locked": { "locked": {
"lastModified": 1725469705, "lastModified": 1725469705,
@ -894,6 +894,22 @@
} }
}, },
"nixpkgs_5": { "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": { "locked": {
"lastModified": 1724479785, "lastModified": 1724479785,
"narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=", "narHash": "sha256-pP3Azj5d6M5nmG68Fu4JqZmdGt4S4vqI5f8te+E/FTw=",
@ -971,6 +987,7 @@
"pixi": "pixi", "pixi": "pixi",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"stable": "stable", "stable": "stable",
"treefmt-nix": "treefmt-nix_2",
"tsm": "tsm", "tsm": "tsm",
"utils": "utils" "utils": "utils"
} }
@ -1129,6 +1146,24 @@
"type": "github" "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": { "tsm": {
"inputs": { "inputs": {
"nim2nix": "nim2nix_3", "nim2nix": "nim2nix_3",

View file

@ -7,6 +7,7 @@
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
stable.url = "github:nixos/nixpkgs/nixos-24.05"; stable.url = "github:nixos/nixpkgs/nixos-24.05";
my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable"; my-nixpkgs.url = "github:daylinmorgan/nixpkgs/nixos-unstable";
treefmt-nix.url = "github:numtide/treefmt-nix";
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland"; nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
nixos-wsl.url = "github:nix-community/NixOS-WSL"; nixos-wsl.url = "github:nix-community/NixOS-WSL";

View file

@ -1,4 +1,9 @@
inputs@{ nixpkgs, self, ... }: inputs@{
nixpkgs,
treefmt-nix,
self,
...
}:
let let
lib = nixpkgs.lib.extend (import ./extended.nix inputs); lib = nixpkgs.lib.extend (import ./extended.nix inputs);
@ -7,6 +12,9 @@ let
genAttrs genAttrs
pkgFromSystem pkgFromSystem
loadOverlays loadOverlays
enabled
listify
enableAttrs
; ;
inherit (import ./find-modules.nix { inherit lib; }) findModulesList; inherit (import ./find-modules.nix { inherit lib; }) findModulesList;
@ -51,7 +59,7 @@ let
default = oizys; default = oizys;
oizys = pkgs.callPackage ../pkgs/oizys { }; oizys = pkgs.callPackage ../pkgs/oizys { };
iso = mkIso.config.system.build.isoImage; iso = mkIso.config.system.build.isoImage;
lix = pkgs.lix; lix = pkgFromSystem pkgs.system "lix-module";
} }
// (inheritFlakePkgs pkgs [ // (inheritFlakePkgs pkgs [
"pixi" "pixi"
@ -77,7 +85,24 @@ let
system = pkgs.system; 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 in
{ {