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/bind: allow zone declaration in nix expression #87973

Open
wants to merge 3 commits into
base: master
from

Conversation

@paumr
Copy link
Contributor

paumr commented May 16, 2020

Motivation for this change

This PR will allow the declaration of zone-files with a nix expression.

Minimal example:

        {
          name = "minimal";
          file = {
            records = [
              { name = "ns"; value = "192.168.1.1"; }
            ];
          };
        }
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.
''
zone "${name}" {
type ${if master then "master" else "slave"};
file "${if (builtins.isAttrs file) && !(isDerivation file) then zoneFile { inherit name; opts = file; } else file}";

This comment has been minimized.

Copy link
@paumr

paumr May 16, 2020

Author Contributor

Is there a better way to solve this?

file was previously untyped, thus str, path, or derivation (which result in a path) was accepted (maybe even more types?)
Now file should allow the previous types OR the new submodule, what's the best way to check which one it is?

Copy link
Member

peti left a comment

No reformatting noise, please.

@@ -103,15 +265,15 @@ in
};

listenOn = mkOption {
default = ["any"];

This comment has been minimized.

Copy link
@peti

peti May 16, 2020

Member

Please don't mix cosmetic changes into the same PR with actual code changes as this makes the diffs uncessarily long and hard to review.

This comment has been minimized.

Copy link
@paumr

paumr May 16, 2020

Author Contributor

Sorry, i assumed separating them on a commit-level was enough (this is the diff you are looking for) Should i close this PR in the meantime?

@paumr paumr force-pushed the paumr:bind-nixify branch from a418f4f to 6b3a31c May 17, 2020
@paumr paumr changed the title WIP nixos/bind: allow zone declaration in nix expression nixos/bind: allow zone declaration in nix expression May 17, 2020
@paumr paumr force-pushed the paumr:bind-nixify branch from 6b3a31c to 8bb112a May 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.