|
5 | 5 | { |
6 | 6 | self, |
7 | 7 | nixpkgs, |
| 8 | + treefmt-nix, |
8 | 9 | # nixpkgs-stable, |
9 | 10 | # disko, |
10 | | - home-manager, |
11 | 11 | # systems, |
12 | 12 | # kmonad, |
13 | 13 | # lanzaboote, |
|
28 | 28 | # ========== Extend lib with lib.custom ========== |
29 | 29 | # NOTE: This approach allows lib.custom to propagate into hm |
30 | 30 | # see: https://github.com/nix-community/home-manager/pull/3454 |
31 | | - lib = nixpkgs.lib.extend (self: super: { custom = import ./lib { inherit (nixpkgs) lib; }; }); |
| 31 | + lib = nixpkgs.lib.extend (_self: _super: { custom = import ./lib { inherit (nixpkgs) lib; }; }); |
| 32 | + forEachSystem = f: forAllSystems (system: f nixpkgs.legacyPackages.${system}); |
32 | 33 |
|
33 | | - # lib = nixpkgs.lib // home-manager.lib; |
34 | | - # forEachSystem = f: lib.genAttrs (import systems) (system: f pkgsFor.${system}); |
| 34 | + treefmtEval = forEachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix); |
35 | 35 | # pkgsFor = lib.genAttrs (import systems) ( |
36 | 36 | # system: |
37 | 37 | # import nixpkgs { |
38 | 38 | # inherit system; |
39 | 39 | # config.allowUnfree = true; |
40 | 40 | # } |
41 | 41 | # ); |
42 | | - # configVars = import ./vars { inherit inputs lib; }; |
43 | | - # configLib = import ./lib { inherit lib; }; |
44 | 42 |
|
45 | | - # TODO: make it so that ags will be in pkgs |
46 | | - # ags = pkgsFor.x86_64-linux.callPackage ./home/denrei/common/optional/ags { inherit inputs; }; |
47 | | - # specialArgs = { |
48 | | - # inherit |
49 | | - # # ags |
50 | | - # inputs |
51 | | - # outputs |
52 | | - # configVars |
53 | | - # configLib |
54 | | - # ; |
55 | | - # }; |
56 | 43 | in |
57 | 44 | { |
58 | | - # inherit (nixpkgs) lib; |
59 | 45 |
|
60 | 46 | # ========= Overlays ========= |
61 | 47 | # |
|
110 | 96 | # ========= Formatting ========= |
111 | 97 | # |
112 | 98 | # Nix formatter available through 'nix fmt' https://github.com/NixOS/nixfmt |
113 | | - formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); |
114 | | - checks = forAllSystems ( |
115 | | - system: |
116 | | - let |
117 | | - pkgs = nixpkgs.legacyPackages.${system}; |
118 | | - in |
119 | | - import ./checks.nix { inherit inputs system pkgs; } |
120 | | - ); |
| 99 | + # formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); |
| 100 | + formatter = forEachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper); |
| 101 | + checks = forEachSystem (pkgs: { |
| 102 | + formatting = treefmtEval.${pkgs.system}.config.build.check self; |
| 103 | + }); |
| 104 | + # checks = forAllSystems ( |
| 105 | + # system: |
| 106 | + # let |
| 107 | + # pkgs = nixpkgs.legacyPackages.${system}; |
| 108 | + # in |
| 109 | + # # import ./checks.nix { inherit inputs system pkgs; } |
| 110 | + # { |
| 111 | + # formatting = treefmtEval.${pkgs.system}.config.build.check self; |
| 112 | + # } |
| 113 | + # ); |
121 | 114 |
|
122 | 115 | devShells = forAllSystems ( |
123 | 116 | system: |
|
126 | 119 | checks = self.checks.${system}; |
127 | 120 | } |
128 | 121 | ); |
129 | | - |
130 | | - # Custom modules to enable special functionality for nixos or home-manager oriented configs. |
131 | | - # nixosModules = import ./modules/nixos; |
132 | | - # homeManagerModules = import ./modules/home-manager; |
133 | | - |
134 | | - # overlays = import ./overlays { inherit inputs outputs; }; |
135 | | - # Custom modifications/overrides to upstream packages. |
136 | | - # packages = forEachSystem (pkgs: import ./pkgs { inherit pkgs; }); |
137 | | - # devShells = forEachSystem (pkgs: import ./shell.nix { inherit pkgs; }); |
138 | | - # formatter = forEachSystem (pkgs: pkgs.alejandra); |
139 | | - |
140 | | - #################### NixOS Configurations #################### |
141 | | - # |
142 | | - # Building configurations available through `just rebuild` or `nixos-rebuild --flake .#hostname` |
143 | | - |
144 | | - # nixosConfigurations = { |
145 | | - # # Desktop PC |
146 | | - # altair = lib.nixosSystem { |
147 | | - # specialArgs = specialArgs; |
148 | | - # modules = [ |
149 | | - # # nixos-cosmic.nixosModules.default |
150 | | - # lanzaboote.nixosModules.lanzaboote |
151 | | - # home-manager.nixosModules.home-manager |
152 | | - # { home-manager.extraSpecialArgs = specialArgs; } |
153 | | - # # { nixpkgs.overlays = [ inputs.hyprpanel.overlay ]; } |
154 | | - # ./hosts/altair |
155 | | - # ]; |
156 | | - # }; |
157 | | - # # HP Laptop |
158 | | - # canopus = lib.nixosSystem { |
159 | | - # specialArgs = specialArgs; |
160 | | - # modules = [ |
161 | | - # kmonad.nixosModules.default |
162 | | - # home-manager.nixosModules.home-manager |
163 | | - # # { |
164 | | - # # environment.systemPackages = [ |
165 | | - # # ghostty.packages.x86_64-linux.default |
166 | | - # # ]; |
167 | | - # # } |
168 | | - # { home-manager.extraSpecialArgs = specialArgs; } |
169 | | - # ./hosts/canopus |
170 | | - # ]; |
171 | | - # }; |
172 | | - # # QEMU VM |
173 | | - # polaris = lib.nixosSystem { |
174 | | - # specialArgs = specialArgs; |
175 | | - # modules = [ |
176 | | - # inputs.disko.nixosModules.disko |
177 | | - # home-manager.nixosModules.home-manager |
178 | | - # { home-manager.extraSpecialArgs = specialArgs; } |
179 | | - # ./hosts/polaris |
180 | | - # ]; |
181 | | - # }; |
182 | | - # }; |
183 | | - #################### Home Manager Configurations #################### |
184 | | - # homeConfigurations = { |
185 | | - # # Desktop home |
186 | | - # "denrei@altair" = lib.homeManagerConfiguration { |
187 | | - # pkgs = import nixpkgs { |
188 | | - # system = "x86_64-linux"; |
189 | | - # overlays = [ |
190 | | - # inputs.hyprpanel.overlay |
191 | | - # ]; |
192 | | - # config.allowUnfree = true; |
193 | | - # }; |
194 | | - # extraSpecialArgs = specialArgs; |
195 | | - # modules = [ |
196 | | - # ./home/denrei/altair.nix |
197 | | - # ./home/denrei/nixpkgs.nix |
198 | | - # ]; |
199 | | - # }; |
200 | | - # # HP Laptop home |
201 | | - # "denrei@canopus" = lib.homeManagerConfiguration { |
202 | | - # pkgs = import nixpkgs { |
203 | | - # system = "x86_64-linux"; |
204 | | - # overlays = [ |
205 | | - # inputs.hyprpanel.overlay |
206 | | - # ]; |
207 | | - # config.allowUnfree = true; |
208 | | - # }; |
209 | | - # extraSpecialArgs = specialArgs; |
210 | | - # modules = [ |
211 | | - # ./home/denrei/canopus.nix |
212 | | - # ./home/denrei/nixpkgs.nix |
213 | | - # ]; |
214 | | - # }; |
215 | | - # # QEMU VM Home |
216 | | - # "denrei@polaris" = lib.homeManagerConfiguration { |
217 | | - # pkgs = pkgsFor.x86_64-linux; |
218 | | - # extraSpecialArgs = specialArgs; |
219 | | - # modules = [ |
220 | | - # ./home/denrei/polaris.nix |
221 | | - # ./home/denrei/nixpkgs.nix |
222 | | - # ]; |
223 | | - # }; |
224 | | - # }; |
225 | 122 | }; |
226 | 123 |
|
227 | 124 | inputs = { |
|
319 | 216 | # url = "github:lilyinstarlight/nixos-cosmic"; |
320 | 217 | # inputs.nixpkgs.follows = "nixpkgs"; |
321 | 218 | # }; |
| 219 | + treefmt-nix = { |
| 220 | + url = "github:numtide/treefmt-nix"; |
| 221 | + inputs.nixpkgs.follows = "nixpkgs"; |
| 222 | + }; |
322 | 223 |
|
323 | 224 | zen-browser.url = "github:0xc000022070/zen-browser-flake"; |
324 | 225 |
|
|
0 commit comments