|
103 | 103 | attribute set with this format: `{ _secret = "/path/to/secret"; }`. |
104 | 104 | See the example in `services.glance.settings.pages` at the weather widget |
105 | 105 | with a location secret to get a better picture of this. |
| 106 | +
|
| 107 | + Alternatively, you can use a single file with environment variables, |
| 108 | + see `services.glance.environmentFile`. |
106 | 109 | ''; |
107 | 110 | }; |
108 | 111 |
|
| 112 | + environmentFile = mkOption { |
| 113 | + type = types.nullOr types.path; |
| 114 | + description = |
| 115 | + let |
| 116 | + singleQuotes = "''"; |
| 117 | + in |
| 118 | + '' |
| 119 | + Path to an environment file as defined in {manpage}`systemd.exec(5)`. |
| 120 | +
|
| 121 | + See upstream documentation |
| 122 | + <https://github.com/glanceapp/glance/blob/main/docs/configuration.md#environment-variables>. |
| 123 | +
|
| 124 | + Example content of the file: |
| 125 | + ``` |
| 126 | + TIMEZONE=Europe/Paris |
| 127 | + ``` |
| 128 | +
|
| 129 | + Example `services.glance.settings.pages` configuration: |
| 130 | + ```nix |
| 131 | + [ |
| 132 | + { |
| 133 | + name = "Home"; |
| 134 | + columns = [ |
| 135 | + { |
| 136 | + size = "full"; |
| 137 | + widgets = [ |
| 138 | + { |
| 139 | + type = "clock"; |
| 140 | + timezone = "\''${TIMEZONE}"; |
| 141 | + label = "Local Time"; |
| 142 | + } |
| 143 | + ]; |
| 144 | + } |
| 145 | + ]; |
| 146 | + } |
| 147 | + ]; |
| 148 | + ``` |
| 149 | +
|
| 150 | + Note that when using Glance's `''${ENV_VAR}` syntax in Nix, |
| 151 | + you need to escape it as follows: use `\''${ENV_VAR}` in `"` strings |
| 152 | + and `${singleQuotes}''${ENV_VAR}` in `${singleQuotes}` strings. |
| 153 | +
|
| 154 | + Alternatively, you can put each secret in it's own file, |
| 155 | + see `services.glance.settings`. |
| 156 | + ''; |
| 157 | + default = "/dev/null"; |
| 158 | + example = "/var/lib/secrets/glance"; |
| 159 | + }; |
| 160 | + |
109 | 161 | openFirewall = mkOption { |
110 | 162 | type = types.bool; |
111 | 163 | default = false; |
|
157 | 209 | ''; |
158 | 210 | ExecStart = "${getExe cfg.package} --config ${mergedSettingsFile}"; |
159 | 211 | WorkingDirectory = "/var/lib/glance"; |
| 212 | + EnvironmentFile = cfg.environmentFile; |
160 | 213 | StateDirectory = "glance"; |
161 | 214 | RuntimeDirectory = "glance"; |
162 | 215 | RuntimeDirectoryMode = "0755"; |
|
0 commit comments