lol

Merge pull request #264808 from gmemstr/coder-environment

nixos/coder: add environment.extra and environment.file

authored by

superherointj and committed by
GitHub
787dcb7c e214dd26

+19 -1
+19 -1
nixos/modules/services/web-apps/coder.nix
··· 72 72 example = "*.coder.example.com"; 73 73 }; 74 74 75 + environment = { 76 + extra = mkOption { 77 + type = types.attrs; 78 + description = lib.mdDoc "Extra environment variables to pass run Coder's server with. See Coder documentation."; 79 + default = {}; 80 + example = { 81 + CODER_OAUTH2_GITHUB_ALLOW_SIGNUPS = true; 82 + CODER_OAUTH2_GITHUB_ALLOWED_ORGS = "your-org"; 83 + }; 84 + }; 85 + file = mkOption { 86 + type = types.nullOr types.path; 87 + description = lib.mdDoc "Systemd environment file to add to Coder."; 88 + default = null; 89 + }; 90 + }; 91 + 75 92 database = { 76 93 createLocally = mkOption { 77 94 type = types.bool; ··· 152 169 after = [ "network.target" ]; 153 170 wantedBy = [ "multi-user.target" ]; 154 171 155 - environment = { 172 + environment = config.environment.extra // { 156 173 CODER_ACCESS_URL = cfg.accessUrl; 157 174 CODER_WILDCARD_ACCESS_URL = cfg.wildcardAccessUrl; 158 175 CODER_PG_CONNECTION_URL = "user=${cfg.database.username} ${optionalString (cfg.database.password != null) "password=${cfg.database.password}"} database=${cfg.database.database} host=${cfg.database.host} ${optionalString (cfg.database.sslmode != null) "sslmode=${cfg.database.sslmode}"}"; ··· 177 194 ExecStart = "${cfg.package}/bin/coder server"; 178 195 User = cfg.user; 179 196 Group = cfg.group; 197 + EnvironmentFile = lib.mkIf (cfg.environment.file != null) cfg.environment.file; 180 198 }; 181 199 }; 182 200