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

nixos/corerad: add settings option to supersede configFile #89781

Merged
merged 1 commit into from Jun 14, 2020
Merged

nixos/corerad: add settings option to supersede configFile #89781

merged 1 commit into from Jun 14, 2020

Conversation

mdlayher
Copy link
Member

@mdlayher mdlayher commented Jun 8, 2020

Motivation for this change

Compliance with NixOS/rfcs#42 since @marsam added go-toml which made outputting TOML config trivial. I borrowed the pattern here from the Prometheus module:

# Pretty-print JSON to a file
writePrettyJSON = name: x:
pkgs.runCommandNoCCLocal name {} ''
echo '${builtins.toJSON x}' | ${pkgs.jq}/bin/jq . > $out
'';

We also add a new test for HTTP metrics output and set up a monitoring interface which can't easily be tested, but does verify that the various config modes work.

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.

/cc @aanderse @jonringer @infinisil who discussed adding a settings option with me in my original PR: #77252

@mdlayher
Copy link
Member Author

mdlayher commented Jun 8, 2020

@GrahamcOfBorg test corerad

@mdlayher
Copy link
Member Author

mdlayher commented Jun 8, 2020

Config looks sane to me with go-toml's output:

[matt@servnerr-3:~/src/nixpkgs]$ cat /nix/store/zybrs1y0pmwys3djwkbcaskpaclzqv7b-corerad.toml

[debug]
  address = "localhost:9430"
  prometheus = true

[[interfaces]]
  monitor = true
  name = "eth0"

[[interfaces]]
  advertise = true
  name = "eth1"

  [[interfaces.prefix]]
    prefix = "::/64"

I did just notice that #89744 uses the tool yj for this. Is there a defacto config conversion tool in the tree? I'm happy to change if necessary.

@mdlayher mdlayher requested a review from infinisil June 9, 2020 13:09
nixos/modules/services/networking/corerad.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/corerad.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/corerad.nix Outdated Show resolved Hide resolved
nixos/modules/services/networking/corerad.nix Outdated Show resolved Hide resolved
@mdlayher
Copy link
Member Author

@GrahamcOfBorg test corerad

Copy link
Member

@infinisil infinisil left a comment

Choose a reason for hiding this comment

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

Looks good except for the nit below!

nixos/modules/services/networking/corerad.nix Outdated Show resolved Hide resolved
Signed-off-by: Matt Layher <mdlayher@gmail.com>
@mdlayher
Copy link
Member Author

@GrahamcOfBorg test corerad

@infinisil infinisil merged commit 00e4481 into NixOS:master Jun 14, 2020
@mdlayher mdlayher deleted the mdl-corerad-settings branch June 14, 2020 14:54
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

2 participants