Skip to content

Commit

Permalink
nixos/dex: Restart on referenced file changes
Browse files Browse the repository at this point in the history
Dex now restarts when EnvironmentFile or client secretFile paths
change.
  • Loading branch information
srounce committed Sep 22, 2024
1 parent fda8597 commit 35655b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,8 @@
- `nix.channel.enable = false` no longer implies `nix.settings.nix-path = []`.
Since Nix 2.13, a `nix-path` set in `nix.conf` cannot be overriden by the `NIX_PATH` configuration variable.

- `services.dex` now restarts upon changes to the `.environmentFile` or entries in `.settings.staticClients[].secretFile` when the entry is a `path` type.

## Detailed migration information {#sec-release-24.11-migration}

### `sound` options removal {#sec-release-24.11-migration-sound}
Expand Down
5 changes: 5 additions & 0 deletions nixos/modules/services/web-apps/dex.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ let
replace-secret '${file}' '${file}' /run/dex/config.yaml
'')
secretFiles));

restartTriggers = []
++ (optionals (cfg.environmentFile != null) [ cfg.environmentFile ])
++ (filter (file: builtins.typeOf file == "path") secretFiles);
in
{
options.services.dex = {
Expand Down Expand Up @@ -72,6 +76,7 @@ in
wantedBy = [ "multi-user.target" ];
after = [ "networking.target" ] ++ (optional (cfg.settings.storage.type == "postgres") "postgresql.service");
path = with pkgs; [ replace-secret ];
restartTriggers = restartTriggers;
serviceConfig = {
ExecStart = "${pkgs.dex-oidc}/bin/dex serve /run/dex/config.yaml";
ExecStartPre = [
Expand Down

0 comments on commit 35655b5

Please sign in to comment.