@@ -26,55 +26,55 @@ Then, load this configuration in a flake (`flake.nix`):
2626
2727``` nix
2828{
29- description = "Example flake";
29+ description = "Example flake";
3030
31- inputs = {
32- # Reference in case we want to switch to unstable
33- nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
31+ inputs = {
32+ # Example: Pin to a specific release branch
33+ nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
3434
35- treefmt-nix.url = "github:numtide/treefmt-nix";
36- treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
37- };
35+ treefmt-nix.url = "github:numtide/treefmt-nix";
36+ treefmt-nix.inputs.nixpkgs.follows = "nixpkgs";
37+ };
3838
39- outputs =
40- {
41- self,
42- nixpkgs,
43- treefmt-nix,
44- ...
45- }:
46- let
47- supportedSystems = [
48- "x86_64-linux"
49- "aarch64-linux"
50- "x86_64-darwin"
51- "aarch64-darwin"
52- ];
53- eachSystem = nixpkgs.lib.genAttrs supportedSystems;
54- in
55- {
56- formatter = eachSystem (
57- system:
58- let
59- # Use legacyPackages instead of packages to avoid evaluating unneeded
60- # packages.
61- # Ref: https://github.com/NixOS/nixpkgs/blob/1073dad219cb244572b74da2b20c7fe39cb3fa9e/flake.nix#L206
62- pkgs = nixpkgs.legacyPackages.${system};
63- treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
64- in
65- treefmtEval.config.build.wrapper
66- );
39+ outputs =
40+ {
41+ self,
42+ nixpkgs,
43+ treefmt-nix,
44+ ...
45+ }:
46+ let
47+ supportedSystems = [
48+ "x86_64-linux"
49+ "aarch64-linux"
50+ "x86_64-darwin"
51+ "aarch64-darwin"
52+ ];
53+ eachSystem = nixpkgs.lib.genAttrs supportedSystems;
54+ in
55+ {
56+ formatter = eachSystem (
57+ system:
58+ let
59+ # Use legacyPackages instead of packages to avoid evaluating unneeded
60+ # packages.
61+ # Ref: https://github.com/NixOS/nixpkgs/blob/1073dad219cb244572b74da2b20c7fe39cb3fa9e/flake.nix#L206
62+ pkgs = nixpkgs.legacyPackages.${system};
63+ treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
64+ in
65+ treefmtEval.config.build.wrapper
66+ );
6767
68- checks = eachSystem (
69- system:
70- let
71- pkgs = nixpkgs.legacyPackages.${system};
72- treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
73- in
74- {
75- treefmt-nix = treefmtEval.config.build.check self;
76- }
77- );
78- };
68+ checks = eachSystem (
69+ system:
70+ let
71+ pkgs = nixpkgs.legacyPackages.${system};
72+ treefmtEval = treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
73+ in
74+ {
75+ treefmt-nix = treefmtEval.config.build.check self;
76+ }
77+ );
78+ };
7979}
8080```
0 commit comments