Skip to content

To much new lines #47

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions dns/types/zone.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
{ lib }:

let
inherit (builtins) attrValues filter map removeAttrs;
inherit (builtins) filter removeAttrs;
inherit (lib) concatMapStringsSep concatStringsSep mapAttrs
mapAttrsToList optionalString;
mapAttrsToList optionalString trim;
inherit (lib) mkOption literalExample types;

inherit (import ./record.nix { inherit lib; }) recordType writeRecord;
Expand All @@ -33,7 +33,7 @@ let
description = "Records for subdomains of the domain";
};
} //
mapAttrs (n: t: mkOption rec {
mapAttrs (n: t: mkOption {
type = types.listOf (recordType t);
default = [];
# example = [ t.example ]; # TODO: any way to auto-generate an example for submodule?
Expand All @@ -47,21 +47,21 @@ let
writeSubzone = name: zone:
let
groupToString = pseudo: subt:
concatMapStringsSep "\n" (writeRecord name subt) (zone."${pseudo}");
concatMapStringsSep "\n" (writeRecord name subt) zone."${pseudo}";
groups = mapAttrsToList groupToString rsubtypes';
groups' = filter (s: s != "") groups;

writeSubzone' = subname: writeSubzone "${subname}.${name}";
sub = concatStringsSep "\n\n" (mapAttrsToList writeSubzone' zone.subdomains);
in
concatStringsSep "\n\n" groups'
+ optionalString (sub != "") ("\n\n" + sub);
+ optionalString (sub != "") ("\n\n" + trim sub);
zone = types.submodule ({ name, ... }: {
options = {
useOrigin = mkOption {
type = types.bool;
default = false;
description = "Wether to use $ORIGIN and unqualified name or fqdn when exporting the zone.";
description = "Whether to use $ORIGIN and unqualified name or fqdn when exporting the zone.";
};

TTL = mkOption {
Expand Down