summary refs log tree commit diff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-11-23 11:22:30 +0100
committerLudovic Courtès <ludo@gnu.org>2021-11-23 11:29:38 +0100
commitb15e543d303ea58fdc0f0541c708389f9d513e3d (patch)
tree5c4bd48d67d4d3cd4806269dcabf58382f448bed /gnu/system
parent4efc08d895274ee39e6e6e5c49121fb05a0281b6 (diff)
parentdaf7b5ecef8de0e536ffd8d2957f022d010767a8 (diff)
downloadguix-b15e543d303ea58fdc0f0541c708389f9d513e3d.tar.gz
Merge branch 'master' into core-updates-frozen
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/examples/desktop.tmpl7
-rw-r--r--gnu/system/file-systems.scm24
2 files changed, 29 insertions, 2 deletions
diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl
index c928008c92..6df53844b1 100644
--- a/gnu/system/examples/desktop.tmpl
+++ b/gnu/system/examples/desktop.tmpl
@@ -1,6 +1,6 @@
 ;; This is an operating system configuration template
 ;; for a "desktop" setup with GNOME and Xfce where the
-;; root partition is encrypted with LUKS.
+;; root partition is encrypted with LUKS, and a swap file.
 
 (use-modules (gnu) (gnu system nss))
 (use-service-modules desktop xorg)
@@ -42,6 +42,11 @@
                          (type "vfat")))
                  %base-file-systems))
 
+  ;; Specify a swap file for the system, which resides on the
+  ;; root file system.
+  (swap-devices (list (swap-space
+                       (target "/swapfile"))))
+
   ;; Create user `bob' with `alice' as its initial password.
   (users (cons (user-account
                 (name "bob")
diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm
index c6c1b96d16..e1d1fb72cc 100644
--- a/gnu/system/file-systems.scm
+++ b/gnu/system/file-systems.scm
@@ -97,7 +97,14 @@
 
             %store-mapping
             %network-configuration-files
-            %network-file-mappings))
+            %network-file-mappings
+
+            swap-space
+            swap-space?
+            swap-space-target
+            swap-space-dependencies
+            swap-space-priority
+            swap-space-discard?))
 
 ;;; Commentary:
 ;;;
@@ -712,4 +719,19 @@ subvolume name is unknown."))
                   (G_ "Use the @code{subvol} Btrfs file system option."))))))))
 
 
+;;;
+;;; Swap space
+;;;
+
+(define-record-type* <swap-space> swap-space make-swap-space
+  swap-space?
+  this-swap-space
+  (target swap-space-target)
+  (dependencies swap-space-dependencies
+                (default '()))
+  (priority swap-space-priority
+            (default #f))
+  (discard? swap-space-discard?
+           (default #f)))
+
 ;;; file-systems.scm ends here