Skip to content

Commit

Permalink
Merge pull request #73 from fgaz/loaOf-attrsOf
Browse files Browse the repository at this point in the history
20.09: Use attrsOf instead of loaOf
  • Loading branch information
qknight authored Feb 19, 2021
2 parents 2ed24bc + 87547cc commit 7e421fe
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
14 changes: 6 additions & 8 deletions modules/services/email/opendkim.nix
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,14 @@ in {

config = mkIf cfg.enable {

users.extraUsers = optionalAttrs (cfg.user == "opendkim") (singleton
{ name = "opendkim";
group = cfg.group;
users.extraUsers = optionalAttrs (cfg.user == "opendkim") { opendkim =
{ group = cfg.group;
uid = config.ids.uids.opendkim;
});
};};

users.extraGroups = optionalAttrs (cfg.group == "opendkim") (singleton
{ name = "opendkim";
gid = config.ids.gids.opendkim;
});
users.extraGroups = optionalAttrs (cfg.group == "opendkim") { opendkim =
{ gid = config.ids.gids.opendkim;
};};

environment.systemPackages = [ pkgs.opendkim ];

Expand Down
24 changes: 8 additions & 16 deletions modules/services/email/postfix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -666,10 +666,7 @@ in
{

environment = {
etc = singleton
{ source = "/var/lib/postfix/conf";
target = "postfix";
};
etc = { postfix.source = "/var/lib/postfix/conf"; };

# This makes comfortable for root to run 'postqueue' for example.
systemPackages = [ pkgs.postfix ];
Expand All @@ -685,22 +682,17 @@ in
setgid = true;
};

users.extraUsers = optional (user == "postfix")
{ name = "postfix";
description = "Postfix mail server user";
users.extraUsers = optionalAttrs (user == "postfix") { postfix =
{ description = "Postfix mail server user";
uid = config.ids.uids.postfix;
group = group;
};
};};

users.extraGroups =
optional (group == "postfix")
{ name = group;
gid = config.ids.gids.postfix;
}
++ optional (setgidGroup == "postdrop")
{ name = setgidGroup;
gid = config.ids.gids.postdrop;
};
optionalAttrs (group == "postfix")
{ "${group}".gid = config.ids.gids.postfix; }
// optionalAttrs (setgidGroup == "postdrop")
{ "${setgidGroup}".gid = config.ids.gids.postdrop; };

systemd.services.postfix =
{ description = "Postfix mail server";
Expand Down
11 changes: 3 additions & 8 deletions modules/services/reverse-proxy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,9 @@ in
};


users.extraUsers = (singleton
{ name = "${user}";
group = "${group}";
});

users.extraGroups = (singleton
{ name = "${user}";
});
users.extraUsers."${user}".group = "${group}";

users.extraGroups."${user}" = {};

nixcloud.tests.wanted = [ ./test.nix ];
};
Expand Down

0 comments on commit 7e421fe

Please sign in to comment.