summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/getmail.scm2
-rw-r--r--gnu/services/linux.scm125
-rw-r--r--gnu/services/mail.scm10
-rw-r--r--gnu/services/pm.scm2
-rw-r--r--gnu/services/virtualization.scm12
5 files changed, 145 insertions, 6 deletions
diff --git a/gnu/services/getmail.scm b/gnu/services/getmail.scm
index 7d77888517..933d820bc5 100644
--- a/gnu/services/getmail.scm
+++ b/gnu/services/getmail.scm
@@ -112,7 +112,7 @@
 @samp{passwd} and @samp{static}.")
   (server
    (string 'unset)
-   "Name or IP adddress of the server to retrieve mail from.")
+   "Name or IP address of the server to retrieve mail from.")
   (username
    (string 'unset)
    "Username to login to the mail server with.")
diff --git a/gnu/services/linux.scm b/gnu/services/linux.scm
new file mode 100644
index 0000000000..caa0326c31
--- /dev/null
+++ b/gnu/services/linux.scm
@@ -0,0 +1,125 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu services linux)
+  #:use-module (guix gexp)
+  #:use-module (guix records)
+  #:use-module (guix modules)
+  #:use-module (gnu services)
+  #:use-module (gnu services shepherd)
+  #:use-module (gnu packages linux)
+  #:use-module (srfi srfi-1)
+  #:use-module (srfi srfi-26)
+  #:use-module (ice-9 match)
+  #:export (earlyoom-configuration
+            earlyoom-configuration?
+            earlyoom-configuration-earlyoom
+            earlyoom-configuration-minimum-available-memory
+            earlyoom-configuration-minimum-free-swap
+            earlyoom-configuration-prefer-regexp
+            earlyoom-configuration-avoid-regexp
+            earlyoom-configuration-memory-report-interval
+            earlyoom-configuration-ignore-positive-oom-score-adj?
+            earlyoom-configuration-show-debug-messages?
+            earlyoom-configuration-send-notification-command
+            earlyoom-service-type))
+
+
+;;;
+;;; Early OOM daemon.
+;;;
+
+(define-record-type* <earlyoom-configuration>
+  earlyoom-configuration make-earlyoom-configuration
+  earlyoom-configuration?
+  (earlyoom earlyoom-configuration-earlyoom
+            (default earlyoom))
+  (minimum-available-memory earlyoom-configuration-minimum-available-memory
+                            (default 10)) ; in percent
+  (minimum-free-swap earlyoom-configuration-minimum-free-swap
+                     (default 10))      ; in percent
+  (prefer-regexp earlyoom-configuration-prefer-regexp ; <string>
+                 (default #f))
+  (avoid-regexp earlyoom-configuration-avoid-regexp  ; <string>
+                (default #f))
+  (memory-report-interval earlyoom-configuration-memory-report-interval
+                          (default 0)) ; in seconds; 0 means disabled
+  (ignore-positive-oom-score-adj?
+   earlyoom-configuration-ignore-positive-oom-score-adj? (default #f))
+  (run-with-higher-priority? earlyoom-configuration-run-with-higher-priority?
+                             (default #f))
+  (show-debug-messages? earlyoom-configuration-show-debug-messages?
+                        (default #f))
+  (send-notification-command
+   earlyoom-configuration-send-notification-command  ; <string>
+   (default #f)))
+
+(define (earlyoom-configuration->command-line-args config)
+  "Translate a <earlyoom-configuration> object to its command line arguments
+representation."
+  (match config
+    (($ <earlyoom-configuration> earlyoom minimum-available-memory
+                                 minimum-free-swap prefer-regexp avoid-regexp
+                                 memory-report-interval
+                                 ignore-positive-oom-score-adj?
+                                 run-with-higher-priority? show-debug-messages?
+                                 send-notification-command)
+     `(,(file-append earlyoom "/bin/earlyoom")
+       ,@(if minimum-available-memory
+             (list "-m" (format #f "~s" minimum-available-memory))
+             '())
+       ,@(if minimum-free-swap
+             (list "-s" (format #f "~s" minimum-free-swap))
+             '())
+       ,@(if prefer-regexp
+             (list "--prefer" prefer-regexp)
+             '())
+       ,@(if avoid-regexp
+             (list "--avoid" avoid-regexp)
+             '())
+       "-r" ,(format #f "~s" memory-report-interval)
+       ,@(if ignore-positive-oom-score-adj?
+             (list "-i")
+             '())
+       ,@(if run-with-higher-priority?
+             (list "-p")
+             '())
+       ,@(if show-debug-messages?
+             (list "-d")
+             '())
+       ,@(if send-notification-command
+             (list "-N" send-notification-command)
+             '())))))
+
+(define (earlyoom-shepherd-service config)
+  (shepherd-service
+   (documentation "Run the Early OOM daemon.")
+   (provision '(earlyoom))
+   (start #~(make-forkexec-constructor
+             '#$(earlyoom-configuration->command-line-args config)
+             #:log-file "/var/log/earlyoom.log"))
+   (stop #~(make-kill-destructor))))
+
+(define earlyoom-service-type
+  (service-type
+   (name 'earlyoom)
+   (default-value (earlyoom-configuration))
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list earlyoom-shepherd-service))))
+   (description "Run @command{earlyoom}, the Early OOM daemon.")))
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index 2606aa9e3e..d97316512f 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2015 Andy Wingo <wingo@igalia.com>
 ;;; Copyright © 2017, 2018 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
-;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2017, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Kristofer Buffington <kristoferbuffington@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -1621,8 +1621,12 @@ by @code{dovecot-configuration}.  @var{config} may also be created by
 (define %default-opensmtpd-config-file
   (plain-file "smtpd.conf" "
 listen on lo
-accept from any for local deliver to mbox
-accept from local for any relay
+
+action inbound mbox
+match for local action inbound
+
+action outbound relay
+match from local for any action outbound
 "))
 
 (define opensmtpd-shepherd-service
diff --git a/gnu/services/pm.scm b/gnu/services/pm.scm
index 1e01b5059d..256c6a7fa7 100644
--- a/gnu/services/pm.scm
+++ b/gnu/services/pm.scm
@@ -388,7 +388,7 @@ shutdown on system startup."))
     (with-imported-modules '((guix build utils))
       #~(begin
           (use-modules (guix build utils))
-          (copy-file #$config-file "/etc/tlp")))))
+          (copy-file #$config-file "/etc/tlp.conf")))))
 
 (define tlp-service-type
   (service-type
diff --git a/gnu/services/virtualization.scm b/gnu/services/virtualization.scm
index 2cd4e5e89c..d473c5342e 100644
--- a/gnu/services/virtualization.scm
+++ b/gnu/services/virtualization.scm
@@ -627,6 +627,16 @@ potential infinite waits blocking libvirt."))
                  (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x08\x00")
                  (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))
 
+(define %riscv32
+  (qemu-platform "riscv32" "riscv"
+                 (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00")
+                 (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))
+
+(define %riscv64
+  (qemu-platform "riscv64" "riscv"
+                 (bv "\x7fELF\x02\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\xf3\x00")
+                 (bv "\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff")))
+
 (define %sh4
   (qemu-platform "sh4" "sh4"
                  (bv "\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x2a\x00")
@@ -655,7 +665,7 @@ potential infinite waits blocking libvirt."))
 (define %qemu-platforms
   (list %i386 %i486 %alpha %arm %sparc32plus %ppc %ppc64 %ppc64le %m68k
         %mips %mipsel %mipsn32 %mipsn32el %mips64 %mips64el
-        %sh4 %sh4eb %s390x %aarch64 %hppa))
+        %riscv32 %riscv64 %sh4 %sh4eb %s390x %aarch64 %hppa))
 
 (define (lookup-qemu-platforms . names)
   "Return the list of QEMU platforms that match NAMES--a list of names such as