summaryrefslogtreecommitdiff
path: root/doc/examples/cloud-guix.scm
blob: 3d4bde024fd89ba37e83f3f0d99bf66cbf35b9ca (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
;; Most cloud service providers use qemu / cloud-init to run images inside
;; inside of a virtual machine. This example was written for the "linode"
;; tutorial originally, but it should apply to other cloud services as well.

(use-modules (gnu)
             (guix modules))
(use-service-modules networking
                     ssh)
(use-package-modules admin
                     package-management
                     ssh
                     tls)

;; if you want to add new packages, services and users later, you can
;; use "guix deploy"
(operating-system
  (host-name "localhost")
  (timezone "UTC")
  (locale "en_US.UTF-8")
  
  (bootloader (bootloader-configuration (bootloader grub-bootloader)))

  ;; we configure our bootable guix system to be on device "/dev/sda"
  ;; if you want to use a different device, change it here
  (file-systems (cons (file-system
                        (device "/dev/sda")
                        (mount-point "/")
                        (type "ext4"))
                      %base-file-systems))


  ;; our swap is assumed to be /dev/sdb.
  ;; if your vm will have a different swap device, change it here
  (swap-devices (list "/dev/sdb"))

  (initrd-modules (cons "virtio_scsi"    ; Needed to find the disk
                        %base-initrd-modules))

  (packages (cons* %base-packages))

  (services (cons*
             (service dhcp-client-service-type)
             (service openssh-service-type
                      (openssh-configuration
                       (password-authentication? #f)
                       (permit-root-login 'prohibit-password)
                       (authorized-keys
                        `(("root" ,(local-file "/path/to/key.pub"))))))
             %base-services)))