summaryrefslogtreecommitdiff
path: root/abdul-blog/minetest-server.gmi
blob: 0a0c819e68dbd16c53baff7272d45390680bf614 (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
# Mine Minetest

Haha, 2x "Mine", I hope you see an joke.
I write to explain you how I setup minetest server under this Tilde UNIX server.  Also is this mine first blog post which only is on Gemini and not on HTTPS.  You have to installed a Gemini client to reading it.

## Guix config

Mine Guix Home config has growing a lot and this is now

```
(use-modules ((gnu home) #:select (home-environment))
             ((gnu home services) #:select
              (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 minetest) #:select (minetest-server))
             ((gnu system shadow) #:select (%default-dotguile))
             ((guix gexp) #:select (file-append gexp local-file plain-file)))

(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"))
                     #: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-minetest-service-type))))
```

But this is no all, and I had advice to writing Minetest Server map config in a new file abdultest.conf.  This is inside that

```
map-dir = /home/ctftilde/abdul/.local/minetest/abdultest
server_name = Abdul & friends
motd = I and mine friends build of blocks
port = 20030
```

Then I use

```
#$(local-file "abdultest.conf")
```

to putting the file into Guix and it put an path to .conf file in Minetest Server command.  (I had been said this helps because Guix can "declaratively" define the system)

## Adding to Cron

Services from .scm configuration file are runned by shepderd who is started when user logins.  So yeah, I want a initial shepherd process starting when reboot and a Minetest Server process starting by shepherd then.  For that I edit crontab like

```
crontab -e
```

and write line like

```
* * * * * bash -l
```

## Thanks

I wanted to thank to Wojtek Kosior for helping me 2x to write Guix home configs and write cron configs.  Thank you and you also for wanting to reading my blog.

## Mine currently working

I am now plan to using matterbridge software to connecting Matrix and Discord.  I try to doing this similar to doing the Minetest Server and to using Guix Home functional package manager to doing that.

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