forked from jan-leila/nix-config
		
	created nextcloud service
This commit is contained in:
		
							parent
							
								
									12e1f8067b
								
							
						
					
					
						commit
						7dfb67f1f4
					
				
					 3 changed files with 56 additions and 30 deletions
				
			
		|  | @ -1,8 +1,6 @@ | |||
| { | ||||
|   lib, | ||||
|   config, | ||||
|   pkgs, | ||||
|   inputs, | ||||
|   ... | ||||
| }: { | ||||
|   imports = []; | ||||
|  | @ -40,31 +38,13 @@ | |||
|   }; | ||||
| 
 | ||||
|   config = { | ||||
|     sops.secrets = { | ||||
|       "services/nextcloud_adminpass" = { | ||||
|         sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||
|         owner = config.users.users.nextcloud.name; | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|     systemd = { | ||||
|       services = { | ||||
|         # nextcloud-setup = { | ||||
|         #   after = ["network.target"]; | ||||
|         # }; | ||||
|         headscale = { | ||||
|           after = ["postgresql.service"]; | ||||
|           requires = ["postgresql.service"]; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       # disable computer sleeping | ||||
|       targets = { | ||||
|         sleep.enable = false; | ||||
|         suspend.enable = false; | ||||
|         hibernate.enable = false; | ||||
|         hybrid-sleep.enable = false; | ||||
|       }; | ||||
|     }; | ||||
| 
 | ||||
|     services = { | ||||
|  | @ -92,16 +72,6 @@ | |||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       # nextcloud here is built using its auto setup mysql db because it was not playing nice with postgres | ||||
|       nextcloud = { | ||||
|         enable = true; | ||||
|         package = pkgs.nextcloud30; | ||||
|         hostName = config.apps.nextcloud.hostname; | ||||
|         config = { | ||||
|           adminpassFile = config.sops.secrets."services/nextcloud_adminpass".path; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       nginx = { | ||||
|         enable = true; | ||||
|         virtualHosts = { | ||||
|  |  | |||
|  | @ -9,5 +9,6 @@ | |||
|     ./searx.nix | ||||
|     ./home-assistant.nix | ||||
|     ./pihole.nix | ||||
|     ./nextcloud.nix | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										55
									
								
								modules/nixos-modules/server/nextcloud.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								modules/nixos-modules/server/nextcloud.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,55 @@ | |||
| { | ||||
|   lib, | ||||
|   pkgs, | ||||
|   config, | ||||
|   inputs, | ||||
|   ... | ||||
| }: let | ||||
|   dataDir = "/var/lib/nextcloud"; | ||||
| in { | ||||
|   options.host.nextcloud = { | ||||
|     enable = lib.mkEnableOption "should nextcloud be enabled on this computer"; | ||||
|     subdomain = lib.mkOption { | ||||
|       type = lib.types.str; | ||||
|       description = "subdomain of base domain that nextcloud will be hosted at"; | ||||
|       default = "nextcloud"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = lib.mkIf config.host.nextcloud.enable (lib.mkMerge [ | ||||
|     { | ||||
|       sops.secrets = { | ||||
|         "services/nextcloud_adminpass" = { | ||||
|           sopsFile = "${inputs.secrets}/defiant-services.yaml"; | ||||
|           owner = config.users.users.nextcloud.name; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       host.reverse_proxy.subdomains.${config.host.jellyfin.subdomain} = {}; | ||||
| 
 | ||||
|       services = { | ||||
|         nextcloud = { | ||||
|           enable = true; | ||||
|           package = pkgs.nextcloud30; | ||||
|           hostName = "${config.host.nextcloud.subdomain}.${config.host.reverse_proxy.hostname}"; | ||||
|           config = { | ||||
|             adminpassFile = config.sops.secrets."services/nextcloud_adminpass".path; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     } | ||||
|     (lib.mkIf config.host.impermanence.enable { | ||||
|       environment.persistence."/persist/system/root" = { | ||||
|         enable = true; | ||||
|         hideMounts = true; | ||||
|         directories = [ | ||||
|           { | ||||
|             directory = dataDir; | ||||
|             user = "nextcloud"; | ||||
|             group = "nextcloud"; | ||||
|           } | ||||
|         ]; | ||||
|       }; | ||||
|     }) | ||||
|   ]); | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue