diff --git a/modules/pleroma.nix b/modules/pleroma.nix index 7cb6f2e..986e93e 100644 --- a/modules/pleroma.nix +++ b/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" ];