forked from jan-leila/nix-config
		
	added ollama configs
This commit is contained in:
		
							parent
							
								
									f623a33863
								
							
						
					
					
						commit
						aaaf751435
					
				
					 3 changed files with 43 additions and 0 deletions
				
			
		|  | @ -11,6 +11,7 @@ | ||||||
|     ./sync.nix |     ./sync.nix | ||||||
|     ./impermanence.nix |     ./impermanence.nix | ||||||
|     ./disko.nix |     ./disko.nix | ||||||
|  |     ./ollama.nix | ||||||
|     ./server |     ./server | ||||||
|   ]; |   ]; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										27
									
								
								modules/nixos-modules/ollama.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								modules/nixos-modules/ollama.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,27 @@ | ||||||
|  | { | ||||||
|  |   config, | ||||||
|  |   lib, | ||||||
|  |   ... | ||||||
|  | }: { | ||||||
|  |   config = lib.mkMerge [ | ||||||
|  |     { | ||||||
|  |       services.ollama = { | ||||||
|  |         group = "ollama"; | ||||||
|  |         user = "ollama"; | ||||||
|  |       }; | ||||||
|  |     } | ||||||
|  |     (lib.mkIf config.host.impermanence.enable (lib.mkIf config.services.ollama.enable { | ||||||
|  |       environment.persistence."/persist/system/root" = { | ||||||
|  |         enable = true; | ||||||
|  |         hideMounts = true; | ||||||
|  |         directories = [ | ||||||
|  |           { | ||||||
|  |             directory = config.services.ollama.models; | ||||||
|  |             user = config.services.ollama.user; | ||||||
|  |             group = config.services.ollama.group; | ||||||
|  |           } | ||||||
|  |         ]; | ||||||
|  |       }; | ||||||
|  |     })) | ||||||
|  |   ]; | ||||||
|  | } | ||||||
|  | @ -22,6 +22,7 @@ | ||||||
|     headscale = 2005; |     headscale = 2005; | ||||||
|     nextcloud = 2006; |     nextcloud = 2006; | ||||||
|     syncthing = 2007; |     syncthing = 2007; | ||||||
|  |     ollama = 2008; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   gids = { |   gids = { | ||||||
|  | @ -36,6 +37,7 @@ | ||||||
|     headscale = 2005; |     headscale = 2005; | ||||||
|     nextcloud = 2006; |     nextcloud = 2006; | ||||||
|     syncthing = 2007; |     syncthing = 2007; | ||||||
|  |     ollama = 2008; | ||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   users = config.users.users; |   users = config.users.users; | ||||||
|  | @ -150,6 +152,12 @@ in { | ||||||
|             isSystemUser = true; |             isSystemUser = true; | ||||||
|             group = config.users.users.syncthing.name; |             group = config.users.users.syncthing.name; | ||||||
|           }; |           }; | ||||||
|  | 
 | ||||||
|  |           ollama = { | ||||||
|  |             uid = lib.mkForce uids.ollama; | ||||||
|  |             isSystemUser = true; | ||||||
|  |             group = config.users.users.ollama.name; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
| 
 | 
 | ||||||
|         groups = { |         groups = { | ||||||
|  | @ -240,6 +248,13 @@ in { | ||||||
|               eve |               eve | ||||||
|             ]; |             ]; | ||||||
|           }; |           }; | ||||||
|  | 
 | ||||||
|  |           ollama = { | ||||||
|  |             gid = lib.mkForce gids.ollama; | ||||||
|  |             members = [ | ||||||
|  |               users.ollama.name | ||||||
|  |             ]; | ||||||
|  |           }; | ||||||
|         }; |         }; | ||||||
|       }; |       }; | ||||||
|     } |     } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue