File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 7
7
{
8
8
options = {
9
9
services . home-assistant = {
10
+ configurePostgres = lib . mkOption {
11
+ type = lib . types . bool ;
12
+ default = false ;
13
+ example = true ;
14
+ description = "Whether to configure and create a local PostgreSQL database." ;
15
+ } ;
16
+
10
17
ldap = {
11
18
enable = lib . mkEnableOption ''login only via LDAP
12
19
137
144
meta = true ;
138
145
} ] ;
139
146
} )
147
+
148
+ ( lib . mkIf cfg . configurePostgres {
149
+ config . recorder . db_url = "postgresql://@/hass" ;
150
+ } )
140
151
] ;
141
152
142
153
config . services . portunus . seedSettings . groups = lib . optional ( cfg . ldap . userGroup != null ) {
149
160
permissions = { } ;
150
161
} ;
151
162
163
+ config . services . postgresql = lib . mkIf cfg . configurePostgres {
164
+ ensureDatabases = [ "hass" ] ;
165
+ ensureUsers = [ {
166
+ name = "hass" ;
167
+ ensureDBOwnership = true ;
168
+ } ] ;
169
+ } ;
170
+
152
171
config . systemd . tmpfiles . rules = lib . mkIf ( cfg . enable && cfg . recommendedDefaults ) [
153
172
"f ${ cfg . configDir } /automations.yaml 0444 hass hass"
154
173
"f ${ cfg . configDir } /scenes.yaml 0444 hass hass"
You can’t perform that action at this time.
0 commit comments