summaryrefslogtreecommitdiff
path: root/abdul-blog/matterbridge-in-tildeserver.gmi
blob: f7e3e03df7cac9bd106b198077b30934f660e67f (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# Matterbridge in tildeserver

Hello friends, today I maked a bridge with Matterbridge program for Discord and Matrix room I talk in.  It is cool because I run this in Guix functional package manager with UNIX Tilde server.

## Config .scm

I added 1 line to mine home config to using new modules

```
             ((gnu packages messaging) #:select (matterbridge))
```

And I has added more lines down under

```
(define home-matterbridge-services
  (const
    (list (shepherd-service
           (provision '(mattermost))
           (modules '((shepherd support)))      ;for '%user-log-dir'
           (start #~(make-forkexec-constructor
                     '(#$(file-append matterbridge "/bin/matterbridge")
                       "--conf"
                       #$(local-file "config.toml"))
                     #:log-file (string-append %user-log-dir
                                               "/matterbridge.log")))
           (stop #~(make-kill-destructor))
           (documentation "Start local matterbridge.")))))

(define home-matterbridge-service-type
  (service-type
   (name 'home-matterbridge)
   (extensions
    (list (service-extension home-shepherd-service-type
                             home-matterbridge-services)))
   (description "Bridge messaging platforms using matterbridge.")
   (default-value #f)))
```

That define service, that I use in home environment, like this

```
   (service home-matterbridge-service-type)
```

This is similar to Minetest Server service.

=> /~abdul/minetest-server.gmi mine Minetest Server blog post

## Matterbridge config .toml

I use also an .toml file to configuring the Matterbridge program.  It have this

```
[matrix.noevil-pl]
Server="https://matrix.noevil.pl"
Login="abdul"
Password="***************"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
NoHomeServerSuffix=false

[discord.cyber]
Server="3333333333333333333"
Token="000000000000000000000000.111111.22222222222222222222222222222222222222"
RemoteNickFormat="[{PROTOCOL}] <{NICK}> "
PreserveThreading=true

[[gateway]]
name="secret_room"
enable=true

[[gateway.inout]]
account="matrix.noevil-pl"
channel="!HNiADouYMzLGUUxtxw:noevil.pl"

[[gateway.inout]]
account="discord.cyber"
channel="ID:1207786885481500702"
```

There I replace an real password with "***************".

## Full config .scm

This is mine config full

```
(use-modules ((gnu home) #:select (home-environment))
             ((gnu home services) #:select
              (home-activation-service-type home-files-service-type service
               service-extension service-type))
             ((gnu home services shells) #:select
              (home-bash-configuration home-bash-service-type))
             ((gnu home services shepherd) #:select
              (home-shepherd-service-type shepherd-service))
             ((gnu packages messaging) #:select (matterbridge))
             ((gnu packages minetest) #:select (minetest-server))
             ((gnu system shadow) #:select (%default-dotguile))
             ((guix gexp) #:select (file-append gexp local-file plain-file)))

(define home-matterbridge-services
  (const
    (list (shepherd-service
           (provision '(mattermost))
           (modules '((shepherd support)))      ;for '%user-log-dir'
           (start #~(make-forkexec-constructor
                     '(#$(file-append matterbridge "/bin/matterbridge")
                       "--conf"
                       #$(local-file "config.toml"))
                     #:log-file (string-append %user-log-dir
                                               "/matterbridge.log")))
           (stop #~(make-kill-destructor))
           (documentation "Start local matterbridge.")))))

(define home-matterbridge-service-type
  (service-type
   (name 'home-matterbridge)
   (extensions
    (list (service-extension home-shepherd-service-type
                             home-matterbridge-services)))
   (description "Bridge messaging platforms using matterbridge.")
   (default-value #f)))

(define home-minetest-services
  (const
    (list (shepherd-service
           (provision '(minetest))
           (modules '((shepherd support)))      ;for '%user-log-dir'
           (start #~(make-forkexec-constructor
                     '(#$(file-append minetest-server "/bin/minetestserver")
                       "--gameid" "minetest"
                       "--config" #$(local-file "abdultest.conf"))
                     #:environment-variables
                     (cons
                      (format #f "MINETEST_SUBGAME_PATH=~a/share/minetest/games"
                              #$(@@ (gnu packages minetest) minetest-data))
                      (default-environment-variables))
                     #:log-file (string-append %user-log-dir
                                               "/minetest.log")))
           (stop #~(make-kill-destructor))
           (documentation "Start Minetest block game like Minecraft.")))))

(define home-minetest-activation
  (const #~(mkdir-p "/home/ctftilde/ctftilde-abdul/.local/minetest/abdultest")))

(define home-minetest-service-type
  (service-type
   (name 'home-minetest)
   (extensions
    (list (service-extension home-shepherd-service-type
                             home-minetest-services)
          (service-extension home-activation-service-type
                             home-minetest-activation)))
   (description "Minetest block game like Minecraft.")
   (default-value #f)))

(home-environment
 (services
  (list
   (service home-bash-service-type
            (home-bash-configuration
             (bash-profile (list (plain-file
                                  "bash_ps1"
                                  "export PS1=\"\n↓← $PS1\n→ \"")))))

   (service home-files-service-type
            `((".guile" ,%default-dotguile)))

   (service home-matterbridge-service-type)

   (service home-minetest-service-type))))
```

=> /~abdul/index.gmi back into blog index