summaryrefslogtreecommitdiff
path: root/suweren/update.scm
blob: 23d2e60aa3916fd5117c4ec9c1bf8a471f96d183 (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
(define-module (suweren update)
  #:use-module (gnu home services shells)
  #:use-module (gnu services))

(define-public update-commands
  (let* ((allow-downgrades "--allow-downgrades ")
	 (and "&& ")
	 (collect-garbage "sudo guix gc -d 7d ")
	 (pull-guix "guix pull ")
	 (reconfigure-home (string-append "guix home "
					  "delete-generations 7d ; "
					  "guix home "
					  "reconfigure -e "
					  "'(@ (users marekpasnikowski)"
					  " home)'"))
	 (reconfigure-system (string-append "sudo guix system "
					    "delete-generations 7d ;"
					    "sudo guix system "
					    "reconfigure -e "
					    "'(@ (systems ayase "
					    "system-configuration) ayase)'"))

	 (reupdate-system (string-append pull-guix
					 allow-downgrades
					 and
					 reconfigure-system
					 allow-downgrades
					 and
					 reconfigure-home
					 allow-downgrades
					 and
					 collect-garbage))
	 (update-system (string-append pull-guix
				       and
				       reconfigure-system
				       and
				       reconfigure-home
				       and
				       collect-garbage))

	 (aliases `(("collect-garbage" . ,collect-garbage)
		    ("pull-guix" . ,pull-guix)
		    ("reconfigure-home" . ,reconfigure-home)
		    ("reconfigure-system" . ,reconfigure-system)
		    ("update-system" . ,update-system)
		    ("reupdate-system" . ,reupdate-system)))
	 
	 (value (home-bash-extension (aliases aliases))))
    
    (simple-service 'update-commands
		    home-bash-service-type
		    value)))