Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix-synapse: Add module parameter extraConfigFiles #33276

Merged
merged 1 commit into from Jan 7, 2018

Conversation

johbo
Copy link
Contributor

@johbo johbo commented Jan 1, 2018

This allows to configure additional configuration files for Synapse. This way
secrets can be kept in a secure place on the file system without a need to go
through the Nix store.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

ExecStart = "${cfg.package}/bin/homeserver --config-path ${configFile} --keys-directory ${cfg.dataDir}";
ExecStart = ''
${cfg.package}/bin/homeserver \
--config-path ${ concatStringsSep " \\\n --config-path " ([ configFile ] ++ cfg.extraConfigFiles) } \
Copy link
Contributor

@joachifm joachifm Jan 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, can you show me the desired expansion here? Just eyeballing this, it seems off to me. What about

lib.concatMapStringsSep " " (x: "--config-path ${x}") ([ configFile ] ++ cfg.extraConfigFiles)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep sure, here is a snipped from a machine which I did produce this way:

ExecStart=/nix/store/f4g8ym6pk6w3g8fb1wk3b4g75p1vfhhl-python2.7-matrix-synapse-0.25.1/bin/homeserver \
  --config-path /nix/store/nmnb1zmni95csqfljwidiyz5mwgn3r1c-homeserver.yaml \
  --config-path /run/keys/matrix-synapse-secret-config \
  --keys-directory /var/lib/matrix-synapse

Still, using the other function is a better approach, it would be more obvious for the reader, I'll update it based on concatMapStringsSep, hope I'll find some time for it today.

This allows to configure additional configuration files for Synapse. This way
secrets can be kept in a secure place on the file system without a need to go
through the Nix store.
@johbo
Copy link
Contributor Author

johbo commented Jan 7, 2018

Got it updated, example results form quick local test runs.

Using no extraConfigFiles:

ExecStart=/nix/store/f4g8ym6pk6w3g8fb1wk3b4g75p1vfhhl-python2.7-matrix-synapse-0.25.1/bin/homeserver \
  --config-path /nix/store/nmnb1zmni95csqfljwidiyz5mwgn3r1c-homeserver.yaml \
  --keys-directory /var/lib/matrix-synapse

And using extraConfigFiles:

ExecStart=/nix/store/f4g8ym6pk6w3g8fb1wk3b4g75p1vfhhl-python2.7-matrix-synapse-0.25.1/bin/homeserver \
  --config-path /nix/store/nmnb1zmni95csqfljwidiyz5mwgn3r1c-homeserver.yaml \
  --config-path /run/keys/matrix-synapse-secret-config \
  --keys-directory /var/lib/matrix-synapse

@joachifm joachifm merged commit a88b4d4 into NixOS:master Jan 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants