| 
									
										
										
										
											2025-08-05 15:41:31 +01:00
										 |  |  | { | 
					
						
							|  |  |  |   inputs = { | 
					
						
							|  |  |  |     devshell.inputs.nixpkgs.follows = "nixpkgs"; | 
					
						
							|  |  |  |     devshell.url = "github:numtide/devshell"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     flake-parts.url = "github:hercules-ci/flake-parts"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   outputs = | 
					
						
							|  |  |  |     inputs: | 
					
						
							|  |  |  |     inputs.flake-parts.lib.mkFlake { inherit inputs; } { | 
					
						
							|  |  |  |       systems = [ "x86_64-linux" ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       imports = [ inputs.devshell.flakeModule ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       perSystem = | 
					
						
							|  |  |  |         { pkgs, ... }: | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           devshells.default = { | 
					
						
							|  |  |  |             packages = [ | 
					
						
							|  |  |  |               (pkgs.writeShellApplication { | 
					
						
							|  |  |  |                 name = "serve"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 runtimeInputs = with pkgs; [ | 
					
						
							|  |  |  |                   simple-http-server | 
					
						
							|  |  |  |                   tailwindcss_4 | 
					
						
							|  |  |  |                   watchman | 
					
						
							|  |  |  |                 ]; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 text = ''
 | 
					
						
							| 
									
										
										
										
											2025-08-05 18:31:43 +01:00
										 |  |  |                   set -o monitor | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                   simple-http-server --index --nocache "$@" & | 
					
						
							|  |  |  |                   PID_SERVER=$! | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                   tailwindcss --output tailwind.css --watch & | 
					
						
							|  |  |  |                   PID_TAILWIND=$! | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                   cleanup() { | 
					
						
							|  |  |  |                     echo "Stopping processes..." | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     kill "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true | 
					
						
							|  |  |  |                     wait "$PID_SERVER" "$PID_TAILWIND" 2>/dev/null || true | 
					
						
							|  |  |  |                   } | 
					
						
							|  |  |  |                   trap cleanup EXIT | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-05 15:41:31 +01:00
										 |  |  |                   wait | 
					
						
							|  |  |  |                 '';
 | 
					
						
							|  |  |  |               }) | 
					
						
							|  |  |  |             ]; | 
					
						
							|  |  |  |           }; | 
					
						
							|  |  |  |         }; | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | } |