| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2024-05-19 23:38:11 -04:00
										 |  |  |   inputs, | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |   forEachSystem, | 
					
						
							|  |  |  |   checks, | 
					
						
							|  |  |  |   ... | 
					
						
							|  |  |  | }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | forEachSystem ( | 
					
						
							|  |  |  |   system: | 
					
						
							|  |  |  |   let | 
					
						
							| 
									
										
										
										
											2024-05-19 23:38:11 -04:00
										 |  |  |     inherit (inputs) nixpkgs sops-nix; | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |     pkgs = nixpkgs.legacyPackages.${system}; | 
					
						
							| 
									
										
										
										
											2024-05-20 01:22:45 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # construct the shell provided by pre-commit for running hooks | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |     pre-commit = pkgs.mkShell { | 
					
						
							| 
									
										
										
										
											2024-07-28 01:13:04 -04:00
										 |  |  |       shellHook = ''
 | 
					
						
							|  |  |  |         if [ -f ./.noprecommit ]; then | 
					
						
							|  |  |  |           echo ".noprecommit found! Delete this file to re-install pre-commit hooks" | 
					
						
							|  |  |  |           if [ -f ./.pre-commit-config.yaml ]; then | 
					
						
							|  |  |  |             echo "uninstalling pre-commit hooks" | 
					
						
							|  |  |  |             pre-commit uninstall | 
					
						
							|  |  |  |             rm .pre-commit-config.yaml | 
					
						
							|  |  |  |           fi | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           ${checks.${system}.pre-commit-check.shellHook} | 
					
						
							|  |  |  |         fi | 
					
						
							|  |  |  |       '';
 | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |       buildInputs = checks.${system}.pre-commit-check.enabledPackages; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2024-05-20 01:22:45 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # construct a shell for importing sops keys (also provides the sops binary) | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |     sops = pkgs.mkShell { | 
					
						
							|  |  |  |       sopsPGPKeyDirs = [ "./keys" ]; | 
					
						
							|  |  |  |       packages = [ | 
					
						
							|  |  |  |         pkgs.sops | 
					
						
							|  |  |  |         sops-nix.packages.${system}.sops-import-keys-hook | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |     }; | 
					
						
							| 
									
										
										
										
											2024-05-20 01:22:45 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |     # constructs a custom shell with commonly used utilities | 
					
						
							| 
									
										
										
										
											2025-04-01 13:59:09 -04:00
										 |  |  |     adev = pkgs.mkShell { | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |       packages = with pkgs; [ | 
					
						
							|  |  |  |         deadnix | 
					
						
							|  |  |  |         pre-commit | 
					
						
							| 
									
										
										
										
											2024-05-19 23:47:48 -04:00
										 |  |  |         treefmt | 
					
						
							|  |  |  |         statix | 
					
						
							|  |  |  |         nixfmt-rfc-style | 
					
						
							| 
									
										
										
										
											2025-03-13 17:43:41 -04:00
										 |  |  |         jsonfmt | 
					
						
							|  |  |  |         mdformat | 
					
						
							|  |  |  |         shfmt | 
					
						
							|  |  |  |         yamlfmt | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |       ]; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   in | 
					
						
							|  |  |  |   { | 
					
						
							|  |  |  |     default = pkgs.mkShell { | 
					
						
							|  |  |  |       inputsFrom = [ | 
					
						
							|  |  |  |         pre-commit | 
					
						
							| 
									
										
										
										
											2025-04-01 13:59:09 -04:00
										 |  |  |         adev | 
					
						
							| 
									
										
										
										
											2024-05-19 23:32:52 -04:00
										 |  |  |         sops | 
					
						
							|  |  |  |       ]; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | ) |