aboutsummaryrefslogtreecommitdiff
path: root/sync/vps.scm
blob: 3a7f2e1caa37f857deb5b083700724988a028fd1 (plain) (blame)
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
(use-modules (gnu)
             (ice-9 textual-ports))
(use-service-modules networking ssh mcron admin)
(use-package-modules ssh backup)

(define user "andreh")

(define ssh-public-key
  "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDF+uy407LKZAFnfFkJPRiOBzwV98qIEcKhITnLYhqfITfrJvcFVOY0/YDCrs6WHXyLdM29AoywVWsQ1qXiB7xQCwknPV8YZoCnJQcn0gvH8jbCk+C8Po0Rx846wbhL49qYolnmlhe+Uoy30j7XIJSDtPVO9d/hZqt2GPwGVJ98HLyY2ak+j4i1YkHr+mPFgnCaqCAzA374d1Bop18+YENYtMMU0k8hCsomwZny/7qNo4V8mjLxQAS8FvTuljxlthEpOM4Jsjl07yDLgE69kLvU7mmFi8EeC26e50N18Ouse82dZigtVhAMeLBhbJnQbDff4WfUBzSjpKjZPGcxoRaej3qSRbIkcMMqCOSlww6GcjRi+COvlpA4c1i4hKI15wHceoiKghDLA6jbaHfOqEMldflYl5gCVUIYzJ5XehZppH6L7PzO+L4suNs+aFjWPDZ0jqEtcyTmgTMea40p7wwz086ExnBDorbG79oDiJrWc+swJjXuVakS+fQjb3mPsCC/FgUhsxEtqiVfvLo2mphp47pOYvs64aUp3RV9muqQNuS4tEuP9V1urGTLtgPL26LEjF0oLu1ag0H+VZY5O/T9KRYvWre8IWbj/KkZYo1tJaGJyEVr0plmyzLBEy8b3Hu/6Wtq7yB0Eii60fxqFWC24nEkvs1V0cxDa+o6I2iA9w== eu@euandre.org")

(define sudoers "\
root ALL=(ALL) ALL
%wheel ALL=NOPASSWD: ALL\n")

(define tld
  (string-trim-both (call-with-input-file "tld.txt" get-string-all)))

(define mail-domain
  (string-append "mail." tld))

(define aliases-file
  (mixed-text-file "euandreh-aliases" "
postmaster root

@ " user))

(define opensmtpd-config
  (mixed-text-file "euandreh-smtpd.conf" "
listen on eth0
table aliases file:/etc/aliases
accept from any domain " mail-domain " alias <aliases> deliver to maildir
accept for local alias <aliases> deliver to maildir
accept for any relay

pki " mail-domain " cert \"/etc/letsencrypt/live/" mail-domain "/fullchain.pem\"
pki " mail-domain " key  \"/etc/letsencrypt/live/" mail-domain "/privkey.pem\""))

(operating-system
  (locale "fr_FR.UTF-8")
  (timezone "America/Sao_Paulo")
  (keyboard-layout (keyboard-layout "us"))
  (host-name "guix-pet-server")
  (users (cons* (user-account
                  (name user)
                  (group "users")
                  (home-directory (string-append "/home/" user))
                  (supplementary-groups '("wheel")))
                %base-user-accounts))
  (sudoers-file (plain-file "sudoers" sudoers))
  (packages
    (append (map specification->package
                 '("git"
                   "nss-certs"
                   "rsync"))
      %base-packages))
  (services
    (append
      (list (service openssh-service-type
                     (openssh-configuration
                       (openssh openssh-sans-x)
                       (password-authentication? #false)
                       (authorized-keys
                         `((,user ,(plain-file "id_rsa.pub" ssh-public-key))))))
            (service mcron-service-type
                     (mcron-configuration
                      (jobs (list))))
            (service unattended-upgrade-service-type)
            (service dhcp-client-service-type)
;           (service opensmtdp-service-type
;                    (opensmtpd-configuration
;                     (config-file opensmtpd-config)))
)
      %base-services))
  (bootloader
    (bootloader-configuration
      (bootloader grub-bootloader)
      (target "/dev/vda")
      (keyboard-layout keyboard-layout)))
  (swap-devices
    (list (uuid "79a91c82-f3e1-4ed7-8c4e-23569f1ae0ca")))
  (file-systems
    (cons* (file-system
             (mount-point "/")
             (device
               (uuid "fddb6a4c-8b8c-4f57-b274-5d6d33200f28"
                     'ext4))
             (type "ext4"))
           %base-file-systems)))