Browse Source

modules/pleroma.nix: handle configuration from the module.

co-authored-by: duponin <duponin@locahlo.st>
master
Félix Baylac-Jacqué 2 years ago
parent
commit
c57445a010
Signed by: NinjaTrappeur
GPG Key ID: EFD315F31848DBA4
  1. 32
      modules/pleroma.nix

32
modules/pleroma.nix

@ -23,10 +23,37 @@ in {
default = "pleroma";
description = "Group account under which pleroma runs.";
};
configs = mkOption {
type = with types; listOf str;
description = "TODO";
default = ''
'';
};
secretConfigFile = mkOption {
type = types.str;
default = "/var/lib/pleroma/secrets.exs";
description = "Path to the file containing your secret pleroma configuration.";
};
};
};
config = lib.mkIf cfg.enable {
assertions = [
{
assertion = (builtins.length cfg.configs) > 0;
message = ''
This is a brand new installation. In that case you can use
`pleroma_ctl instance gen --output config.exs --output-psql setup.psql`,
this will prompt you some questions and will generate both your
config file and database initial migration. Note: `pleroma_ctl`
will be in your system path as soon as you enable the pleroma
service. You can alternatively build it by building this repo's
`default.nix` derivation.
'';
}
];
users = {
users."${cfg.user}" = {
description = "Pleroma user";
@ -38,6 +65,11 @@ in {
environment.systemPackages = [ cfg.package ];
environment.etc."/pleroma/config.exs" = ''
${lib.concatMapStrings (x: "${x}") cfg.configs}
include "${cfg.secretConfigFile}"
'';
systemd.services.pleroma = {
description = "Pleroma social network";
after = [ "network-online.target" "postgresql.service" ];

Loading…
Cancel
Save