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

(define-public (update-commands system user)
  (let* ((and "&& ")
	 (delete-home-generations "guix home delete-generations 7d ; ")
	 (delete-roots "sudo guix gc -d 7d ")
	 (delete-system-generations "sudo guix system delete-generations 7d ; ")
	 (guile-load-path "GUILE_LOAD_PATH='$HOME/Szablony/distribution:$HOME/Szablony/deployment' ")
	 (pull-guix "guix pull ")
	 (reconfigure-home (string-append "guix home reconfigure -e "
					  "'((@ (users "
					  user
					  ") "
					  user
					  "-home-environment) \""
					  system
					  "\")' "))
	 (reconfigure-system (string-append "sudo guix system reconfigure -e "
					    "'(@ (systems "
					    system
					    " system-configuration) "
					    system
					    ")' "))

	 (collect-garbage (string-append delete-home-generations
					 delete-system-generations
					 delete-roots))
	 (test-home (string-append guile-load-path
				   reconfigure-home))
	 (test-system (string-append guile-load-path
				     reconfigure-system))
	 (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)
		    ("test-home" . ,test-home)
		    ("test-system" . ,test-system)
		    ("update-system" . ,update-system)))
	 
	 (value (home-bash-extension (aliases aliases))))
    
    (simple-service 'update-commands
		    home-bash-service-type
		    value)))