Added Python language support
This commit is contained in:
		
							parent
							
								
									34bba528b3
								
							
						
					
					
						commit
						3374b35053
					
				
							
								
								
									
										56
									
								
								modules/users/modules/language/python.nix
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								modules/users/modules/language/python.nix
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | ||||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: | ||||
| 
 | ||||
| with lib; | ||||
| let | ||||
|   cfg = config.modules.python; | ||||
|   package = pkgs.python3.withPackages cfg.extraPythonPackages; | ||||
| in | ||||
| { | ||||
|   options.modules.python = { | ||||
|     enable = mkEnableOption "python"; | ||||
|     extraPythonPackages = mkOption { | ||||
|       type = types.functionTo (types.listOf types.package) // { | ||||
|         merge = | ||||
|           loc: defs: p: | ||||
|           lib.concatMap (def: (def.value p)) defs; | ||||
|       }; | ||||
|       default = p: [ ]; | ||||
|       description = "Extra Python packages to install"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     # Development packages | ||||
|     home.packages = [ | ||||
|       package | ||||
|     ]; | ||||
| 
 | ||||
|     # Allow unfree | ||||
|     modules.unfree.allowedPackages = [ | ||||
|       "vscode-extension-MS-python-vscode-pylance" | ||||
|     ]; | ||||
| 
 | ||||
|     # VSCode configuration | ||||
|     programs.vscode = { | ||||
|       extensions = with pkgs.vscode-extensions; [ | ||||
|         ms-python.python | ||||
|         ms-python.debugpy | ||||
|         ms-python.vscode-pylance | ||||
|       ]; | ||||
| 
 | ||||
|       userSettings = { | ||||
|         "[python]" = { | ||||
|           "editor.defaultFormatter" = "ms-python.vscode-pylance"; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|     # Neovim configuration | ||||
|     programs.nixvim = { }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jan-Bulthuis
						Jan-Bulthuis