]> Git — Sourcephile - sourcephile-nix.git/blob - install/logical/friot/redmine.nix
environment.systemPackages.
[sourcephile-nix.git] / install / logical / friot / redmine.nix
1 {pkgs, lib, config, ...}:
2 let inherit (config) networking;
3 inherit (config.services) redmine postgresql;
4 in
5 {
6 config = {
7 services = {
8 redmine = {
9 enable = true;
10 database = {
11 type = "postgresql";
12 host = "/tmp";
13 port = postgresql.port;
14 };
15 };
16 postgresql = {
17 users."${redmine.user}" = {
18 auth = "unix";
19 };
20 databases."${redmine.database.name}" = {
21 owner = redmine.user;
22 users = [ redmine.user ];
23 extraConfig = ''
24 GRANT USAGE ON SCHEMA pg_catalog TO ${redmine.user};
25 GRANT SELECT ON ALL TABLES IN SCHEMA pg_catalog TO ${redmine.user};
26 '';
27 };
28 };
29 nginx = {
30 upstreams."redmine" = {
31 servers = { "localhost:3000" = {}; };
32 };
33 virtualHosts."redmine" = {
34 serverName = "redmine.${networking.domain}";
35 serverAliases =
36 map (domainAlias: "redmine." + domainAlias)
37 config.networking.domainAliases;
38 locations = {
39 "/" = {
40 extraConfig = ''
41 proxy_next_upstream error timeout
42 invalid_header http_500 http_502 http_503;
43 proxy_pass http://localhost:3000;
44 '';
45 };
46 };
47 };
48 };
49 };
50 systemd.services.redmine = {
51 environment.REDMINE_LANG = lib.mkForce "fr";
52 };
53 #users.users."${redmine.user}" = {
54 # extraGroups = [ "postgres" ];
55 #};
56 };
57 }