|
100 | 100 | for more. |
101 | 101 |
|
102 | 102 | Settings containing secret data should be set to an |
103 | | - attribute set containing the attribute |
104 | | - <literal>_secret</literal> - a string pointing to a file |
105 | | - containing the value the option should be set to. See the |
106 | | - example in `services.glance.settings.pages` at the weather widget |
| 103 | + attribute set with this format: `{ _secret = "/path/to/secret"; }`. |
| 104 | + See the example in `services.glance.settings.pages` at the weather widget |
107 | 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`. |
108 | 109 | ''; |
109 | 110 | }; |
110 | 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 | + |
111 | 161 | openFirewall = mkOption { |
112 | 162 | type = types.bool; |
113 | 163 | default = false; |
|
159 | 209 | ''; |
160 | 210 | ExecStart = "${getExe cfg.package} --config ${mergedSettingsFile}"; |
161 | 211 | WorkingDirectory = "/var/lib/glance"; |
| 212 | + EnvironmentFile = cfg.environmentFile; |
162 | 213 | StateDirectory = "glance"; |
163 | 214 | RuntimeDirectory = "glance"; |
164 | 215 | RuntimeDirectoryMode = "0755"; |
|
0 commit comments