47 lines
907 B
Nix
47 lines
907 B
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
userOpts = { name, config, ... }: {
|
|
options = {
|
|
passwd = mkOption {
|
|
type = types.str;
|
|
description = ''
|
|
The password of a given user.
|
|
'';
|
|
};
|
|
|
|
databases = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [];
|
|
description = ''
|
|
A list of databases to which this user should have access.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
in {
|
|
|
|
options = {
|
|
fudo.postgresql = {
|
|
databases = mkOption {
|
|
type = types.attrsOf types.lines;
|
|
default = {};
|
|
description = ''
|
|
A map of database_name => database_defn.
|
|
'';
|
|
};
|
|
users = mkOption {
|
|
type = with types; attrsOf (submodule userOpts);
|
|
default = {};
|
|
description = ''
|
|
A map of user_name => { user_attributes }.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|