mirror of
				https://github.com/NotAShelf/air-quality-monitor.git
				synced 2025-10-31 11:12:38 +00:00 
			
		
		
		
	flake: init
This commit is contained in:
		
					parent
					
						
							
								0683ce7b58
							
						
					
				
			
			
				commit
				
					
						eb828c2f17
					
				
			
		
					 5 changed files with 125 additions and 0 deletions
				
			
		
							
								
								
									
										62
									
								
								nix/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								nix/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,62 @@ | |||
| { | ||||
|   lib, | ||||
|   python3Packages, | ||||
|   makeWrapper, | ||||
|   python3, | ||||
|   ... | ||||
| }: let | ||||
|   pname = "pi_air_quality_monitor"; | ||||
|   version = "0.0.1"; | ||||
| in | ||||
|   python3Packages.buildPythonApplication { | ||||
|     inherit pname version; | ||||
|     format = "other"; | ||||
| 
 | ||||
|     src = ../src; | ||||
| 
 | ||||
|     pythonPath = with python3Packages; [ | ||||
|       pyserial | ||||
|       flask | ||||
|       redis | ||||
|       ipython | ||||
|       apscheduler | ||||
|       flask-cors | ||||
|       ( | ||||
|         buildPythonPackage rec { | ||||
|           pname = "python-aqi"; | ||||
|           version = "0.6.1"; | ||||
|           src = fetchPypi { | ||||
|             inherit pname version; | ||||
|             hash = "sha256-FBoDoP7UiIDchwbKV7A/MPqRq2DpMwR0v5yaj7m5YCA="; | ||||
|           }; | ||||
|         } | ||||
|       ) | ||||
|     ]; | ||||
| 
 | ||||
|     nativeBuildInputs = [makeWrapper]; | ||||
|     installFlags = ["prefix=$(out/bin)"]; | ||||
| 
 | ||||
|     postUnpack = '' | ||||
|       mkdir -p $out/bin | ||||
|       cp -rvf $src/* $out | ||||
|     ''; | ||||
| 
 | ||||
|     preFixup = '' | ||||
|       buildPythonPath "$pythonPath" | ||||
|       gappsWrapperArgs+=( | ||||
|         --prefix PYTHONPATH : "$program_PYTHONPATH" | ||||
|       ) | ||||
|       makeWrapper ${lib.getExe python3} $out/bin/${pname} \ | ||||
|           --add-flags $out/app.py \ | ||||
|           --prefix PYTHONPATH : "$program_PYTHONPATH" \ | ||||
|           --chdir $out/bin | ||||
|     ''; | ||||
| 
 | ||||
|     meta = { | ||||
|       description = "An air quality monitoring service with a Raspberry Pi and a SDS011 sensor. "; | ||||
|       homepage = "https://github.com/rydercalmdown/pi_air_quality_monitor"; | ||||
|       mainProgram = pname; | ||||
|       platforms = with lib.platforms; ["aarch64-linux"]; | ||||
|       maintainers = with lib.maintainers; [NotAShelf]; | ||||
|     }; | ||||
|   } | ||||
							
								
								
									
										13
									
								
								nix/shell.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										13
									
								
								nix/shell.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,13 @@ | |||
| { | ||||
|   callPackage, | ||||
|   mkShellNoCC, | ||||
|   python3, | ||||
|   ... | ||||
| }: let | ||||
|   defaultPackage = callPackage ./default.nix; | ||||
| in | ||||
|   mkShellNoCC { | ||||
|     packages = [ | ||||
|       (python3.withPackages defaultPackage.propagatedBuildInputs) | ||||
|     ]; | ||||
|   } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue