forked from jan-leila/nix-config
		
	started to move extensions into configurable options
This commit is contained in:
		
							parent
							
								
									dfcd16fdd2
								
							
						
					
					
						commit
						99fb7b8a62
					
				
					 6 changed files with 106 additions and 16 deletions
				
			
		|  | @ -29,7 +29,6 @@ in { | ||||||
| 
 | 
 | ||||||
|           userSettings = lib.mkMerge [ |           userSettings = lib.mkMerge [ | ||||||
|             { |             { | ||||||
|               "workbench.colorTheme" = "Atom One Dark"; |  | ||||||
|               "javascript.updateImportsOnFileMove.enabled" = "always"; |               "javascript.updateImportsOnFileMove.enabled" = "always"; | ||||||
|               "editor.tabSize" = 2; |               "editor.tabSize" = 2; | ||||||
|               "editor.insertSpaces" = false; |               "editor.insertSpaces" = false; | ||||||
|  | @ -45,11 +44,18 @@ in { | ||||||
|               }; |               }; | ||||||
|               "alejandra.program" = "alejandra"; |               "alejandra.program" = "alejandra"; | ||||||
|             }) |             }) | ||||||
|             (lib.mkIf ai-tooling-enabled { |  | ||||||
|               "aiCode.ollamaHost" = "http://defiant:11434"; |  | ||||||
|             }) |  | ||||||
|           ]; |           ]; | ||||||
| 
 | 
 | ||||||
|  |           # TODO: move the rest of the extensions into enable options like this | ||||||
|  |           extraExtensions = { | ||||||
|  |             oneDark.enable = true; | ||||||
|  |             atomKeybindings.enable = true; | ||||||
|  |             aiCode = { | ||||||
|  |               enable = ai-tooling-enabled; | ||||||
|  |               ollamaHost = "http://defiant:11434"; | ||||||
|  |             }; | ||||||
|  |           }; | ||||||
|  | 
 | ||||||
|           extensions = let |           extensions = let | ||||||
|             extension-pkgs = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version; |             extension-pkgs = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version; | ||||||
|           in ( |           in ( | ||||||
|  | @ -57,8 +63,6 @@ in { | ||||||
|               with extension-pkgs.open-vsx; ( |               with extension-pkgs.open-vsx; ( | ||||||
|                 [ |                 [ | ||||||
|                   # vs code feel extensions |                   # vs code feel extensions | ||||||
|                   ms-vscode.atom-keybindings |  | ||||||
|                   akamud.vscode-theme-onedark |  | ||||||
|                   streetsidesoftware.code-spell-checker |                   streetsidesoftware.code-spell-checker | ||||||
|                   streetsidesoftware.code-spell-checker-german |                   streetsidesoftware.code-spell-checker-german | ||||||
|                   streetsidesoftware.code-spell-checker-italian |                   streetsidesoftware.code-spell-checker-italian | ||||||
|  | @ -104,16 +108,6 @@ in { | ||||||
|                   ]) |                   ]) | ||||||
|               ) |               ) | ||||||
|             ) |             ) | ||||||
|             ++ ( |  | ||||||
|               with pkgs.codium-extensions; ( |  | ||||||
|                 [] |  | ||||||
|                 ++ ( |  | ||||||
|                   lib.lists.optionals ai-tooling-enabled [ |  | ||||||
|                     ai-code |  | ||||||
|                   ] |  | ||||||
|                 ) |  | ||||||
|               ) |  | ||||||
|             ) |  | ||||||
|           ); |           ); | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|  |  | ||||||
|  | @ -16,5 +16,6 @@ | ||||||
|     ./bruno.nix |     ./bruno.nix | ||||||
|     ./dbeaver.nix |     ./dbeaver.nix | ||||||
|     ./steam.nix |     ./steam.nix | ||||||
|  |     ./vscode | ||||||
|   ]; |   ]; | ||||||
| } | } | ||||||
|  |  | ||||||
							
								
								
									
										31
									
								
								modules/home-manager-modules/programs/vscode/aiCode.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								modules/home-manager-modules/programs/vscode/aiCode.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,31 @@ | ||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   pkgsRepository = pkgs.codium-extensions; | ||||||
|  | in { | ||||||
|  |   options.programs.vscode.profiles = lib.mkOption { | ||||||
|  |     type = lib.types.attrsOf (lib.types.submodule ({config, ...}: { | ||||||
|  |       options = { | ||||||
|  |         extraExtensions.aiCode = { | ||||||
|  |           enable = lib.mkEnableOption "should the ai code extension for vscode be enabled"; | ||||||
|  |           extension = lib.mkPackageOption pkgsRepository "ai-code" {}; | ||||||
|  |           ollamaHost = lib.mkOption { | ||||||
|  |             type = lib.types.nullOr lib.types.str; | ||||||
|  |             description = "what host should be used for ollama"; | ||||||
|  |             default = null; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       config = lib.mkIf config.extraExtensions.aiCode.enable { | ||||||
|  |         extensions = [ | ||||||
|  |           config.extraExtensions.aiCode.extension | ||||||
|  |         ]; | ||||||
|  |         userSettings = { | ||||||
|  |           "aiCode.ollamaHost" = lib.mkIf (config.extraExtensions.aiCode.ollamaHost != null) config.extraExtensions.aiCode.ollamaHost; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     })); | ||||||
|  |   }; | ||||||
|  | } | ||||||
|  | @ -0,0 +1,27 @@ | ||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   config, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   pkgsRepositories = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version; | ||||||
|  |   pkgsRepository = pkgsRepositories.open-vsx; | ||||||
|  | in { | ||||||
|  |   options.programs.vscode.profiles = lib.mkOption { | ||||||
|  |     type = lib.types.attrsOf (lib.types.submodule ({config, ...}: { | ||||||
|  |       options = { | ||||||
|  |         extraExtensions.atomKeybindings = { | ||||||
|  |           enable = lib.mkEnableOption "should the atom keybindings extension for vscode be enabled"; | ||||||
|  |           extension = lib.mkPackageOption pkgsRepository "atom-keybindings" { | ||||||
|  |             default = ["ms-vscode" "atom-keybindings"]; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       config = lib.mkIf config.extraExtensions.atomKeybindings.enable { | ||||||
|  |         extensions = [ | ||||||
|  |           config.extraExtensions.atomKeybindings.extension | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     })); | ||||||
|  |   }; | ||||||
|  | } | ||||||
							
								
								
									
										7
									
								
								modules/home-manager-modules/programs/vscode/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								modules/home-manager-modules/programs/vscode/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | ||||||
|  | {...}: { | ||||||
|  |   imports = [ | ||||||
|  |     ./oneDark.nix | ||||||
|  |     ./atomKeybindings.nix | ||||||
|  |     ./aiCode.nix | ||||||
|  |   ]; | ||||||
|  | } | ||||||
							
								
								
									
										30
									
								
								modules/home-manager-modules/programs/vscode/oneDark.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								modules/home-manager-modules/programs/vscode/oneDark.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,30 @@ | ||||||
|  | { | ||||||
|  |   lib, | ||||||
|  |   pkgs, | ||||||
|  |   config, | ||||||
|  |   ... | ||||||
|  | }: let | ||||||
|  |   pkgsRepositories = pkgs.nix-vscode-extensions.forVSCodeVersion config.programs.vscode.package.version; | ||||||
|  |   pkgsRepository = pkgsRepositories.open-vsx; | ||||||
|  | in { | ||||||
|  |   options.programs.vscode.profiles = lib.mkOption { | ||||||
|  |     type = lib.types.attrsOf (lib.types.submodule ({config, ...}: { | ||||||
|  |       options = { | ||||||
|  |         extraExtensions.oneDark = { | ||||||
|  |           enable = lib.mkEnableOption "should the one dark theme for vscode be enabled"; | ||||||
|  |           extension = lib.mkPackageOption pkgsRepository "onedark" { | ||||||
|  |             default = ["akamud" "vscode-theme-onedark"]; | ||||||
|  |           }; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |       config = lib.mkIf config.extraExtensions.oneDark.enable { | ||||||
|  |         extensions = [ | ||||||
|  |           config.extraExtensions.oneDark.extension | ||||||
|  |         ]; | ||||||
|  |         userSettings = { | ||||||
|  |           "workbench.colorTheme" = "Atom One Dark"; | ||||||
|  |         }; | ||||||
|  |       }; | ||||||
|  |     })); | ||||||
|  |   }; | ||||||
|  | } | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue