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

riot-web: accept conf override as attrset and str #81452

Closed
wants to merge 1 commit into from

Conversation

pacien
Copy link
Contributor

@pacien pacien commented Mar 1, 2020

Motivation for this change

c9e5cca changed the type from str to attrset, which broke some people's config.

GitHub: closes #81416

@mguentner please test

This probably needs to be back-ported.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

c9e5cca changed the type from str to attrset, which broke some people's config.

GitHub: closes NixOS#81416
@mguentner
Copy link
Contributor

mguentner commented Mar 1, 2020

☑️ works for me with string

@mguentner
Copy link
Contributor

mguentner commented Mar 1, 2020

with an attrset I fail to overwrite the keys in default_server_config while merging:

This nix config

               default_server_config = {
                  m.homeserver = {
                    base_url = "https://example.org";
                    server_name = "example.org";
                  };
                  m.identity_server = {
                    base_url = "";
                  };
                };

becomes (json)

 "default_server_config": {
    "m.homeserver": {
      "base_url": "https://matrix-client.matrix.org",
      "server_name": "matrix.org"
    },
    "m.identity_server": {
      "base_url": "https://vector.im"
    },
    "m": {
      "homeserver": {
        "base_url": "https://example.org",
        "server_name": "example.org"
      },
      "identity_server": {
        "base_url": ""
      }
    }
  },

@pacien
Copy link
Contributor Author

pacien commented Mar 1, 2020

@mguentner You can use quotes around keys in the nix expression.

@mguentner
Copy link
Contributor

Indeed. Thanks :)

configOverrides = writeText "riot-config-overrides.json" (builtins.toJSON (noPhoningHome // conf));
});
userOverrides = writeText "riot-config-user.json" (
with builtins; if isAttrs conf then toJSON conf else conf
Copy link
Contributor

@rnhmjoj rnhmjoj Mar 1, 2020

Choose a reason for hiding this comment

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

I'm not a fan of options that have no proper type.
I think it would be better to add a configFile option for this: it would still be a breaking change but it would only happen in the next relase, with a mention in the release notes.

Copy link
Contributor

Choose a reason for hiding this comment

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

We could only backport this PR and leave attrset-only for the future.

@pacien
Copy link
Contributor Author

pacien commented Mar 1, 2020

Let's keep the compatibility with string configuration only for release-19.09.
See #81470.

@pacien pacien closed this Mar 1, 2020
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.

riot-web conf override broken
3 participants