Separate home management in more specific modules

Julien LepillerSun Jun 09 20:31:52+0200 2019

db02699

Separate home management in more specific modules

README.md

5656
a new profile, that will only contain one package:
5757
5858
```
59-
guix package -i tyreunom-home -p /var/guix/profiles/per-user/tyreunom/home \
60-
  -L homes -L modules
59+
cd homes
60+
guix package -p /var/guix/profiles/per-user/tyreunom/home -L ../modules \
61+
  -f sybil-home.scm
6162
```
6263
6364
My home directory is now read-only which a lot of software doesn't like.

6970
this, I start pulseaudio from my window manager's autostart file, with
7071
a separate HOME variable set to a directory in `/tmp`.
7172
73+
A nice aspect of this however, is that we can now create more modules to
74+
support more software. These modules can be generic enough to be
75+
useful to anyone with a simple configuration, just like services are
76+
useful for system administrators. Home related modules can be found
77+
in `(home)`, that is in `modules/home`.
78+
7279
What do your System Names Reference?
7380
------------------------------------
7481

homes/files/gitconfig unknown status 1

1+
[user]
2+
	email = julien@lepiller.eu
3+
	name = Julien Lepiller
4+
	signingkey = 43111F4520086A0C
5+
6+
[sendemail]
7+
	smtpencryption = tls
8+
	smtpserver = lepiller.eu
9+
	smtpuser = tyreunom
10+
	smtpserverport = 587
11+
	suppresscc = self
12+
13+
[alias]
14+
    co = checkout
15+
    ci = commit
16+
    st = status
17+
    br = branch
18+
    # type = cat-file -t
19+
    # dump = cat-file -p
20+
    lol =  log --decorate=short --pretty=format:'%C(yellow) %h %C(white) %s %C(reset)(%C(green)%cN %C(bold blue)%cr%C(reset))%C(yellow)%d%C(reset)' --graph
21+
    lolu =  log --decorate=short --pretty=format:'%C(yellow) %h %C(white) %s %C(reset)(%C(green)%cN %C(bold blue)%cr%C(reset))%C(yellow)%d%C(reset)' --graph --all
22+
    lola = log --oneline --graph --decorate --all
23+
    pl = pull --ff-only
24+
    plr = pull --rebase
25+
    rb = rebase --autosquash --autostash -i
26+
    rc = rebase --continue
27+
    clean-remote-branchs = !git remote prune origin && git fetch
28+
    cif = commit --fixup=HEAD
29+
    cf = commit --fixup # commit-id
30+
    blame-follow = log -p -M --follow --stat --
31+
    cp = cherry-pick
32+
    ss = diff --staged
33+
    p = push
34+
    pf = push --force-with-lease
35+
    fetch = fetch --prune
36+
37+
[color]
38+
    branch = auto
39+
    diff = auto
40+
    interactive = auto
41+
    status = auto
42+
	ui = auto
43+
44+
[diff]
45+
    wsErrorHighlight = all
46+
    renameLimit = 20000
47+
    algorithm = patience
48+
49+
[core]
50+
    pager = less -F -X
51+
52+
[commit]
53+
    verbose = yes

homes/files/xfce4-terminal/terminalrc unknown status 1

1+
[Configuration]
2+
MiscAlwaysShowTabs=FALSE
3+
MiscBell=FALSE
4+
MiscBordersDefault=TRUE
5+
MiscCursorBlinks=FALSE
6+
MiscCursorShape=TERMINAL_CURSOR_SHAPE_BLOCK
7+
MiscDefaultGeometry=80x24
8+
MiscInheritGeometry=FALSE
9+
MiscMenubarDefault=FALSE
10+
MiscMouseAutohide=FALSE
11+
MiscToolbarDefault=FALSE
12+
MiscConfirmClose=TRUE
13+
MiscCycleTabs=TRUE
14+
MiscTabCloseButtons=TRUE
15+
MiscTabCloseMiddleClick=TRUE
16+
MiscTabPosition=GTK_POS_TOP
17+
MiscHighlightUrls=TRUE
18+
ScrollingBar=TERMINAL_SCROLLBAR_NONE
19+
FontName=Nimbus Mono L 14
20+
ScrollingOnOutput=FALSE
21+
ColorBackground=#0b17059e059e
22+
ColorForeground=#fcfcafaf3e3e
23+
ColorCursor=#3f3f4e4e5353
24+
ColorBold=#586e75
25+
ColorPalette=rgb(238,232,213);rgb(232,80,77);rgb(122,136,28);rgb(181,119,0);rgb(103,176,226);rgb(200,65,130);rgb(46,155,162);rgb(7,54,66);rgb(253,246,227);rgb(203,75,22);rgb(133,172,149);rgb(217,218,183);rgb(149,203,222);rgb(108,113,196);rgb(138,184,198);rgb(0,43,54)
26+
TabActivityColor=#dc322f
27+
MiscBellUrgent=FALSE
28+
MiscMouseWheelZoom=TRUE
29+
MiscMiddleClickOpensUri=FALSE
30+
MiscCopyOnSelect=FALSE
31+
MiscDefaultWorkingDir=
32+
MiscRewrapOnResize=TRUE
33+
MiscUseShiftArrowsToScroll=FALSE
34+
MiscSlimTabs=FALSE
35+
ScrollingUnlimited=TRUE
36+
BackgroundMode=TERMINAL_BACKGROUND_TRANSPARENT
37+
BackgroundDarkness=0,420000
38+

homes/sybil-home.scm unknown status 1

1+
(use-modules (home openbox))
2+
(use-modules (home utils))
3+
(use-modules (home))
4+
(use-modules (gnu packages compton))
5+
(use-modules (gnu packages dunst))
6+
(use-modules (gnu packages games))
7+
(use-modules (gnu packages ibus))
8+
(use-modules (gnu packages image-viewers))
9+
(use-modules (gnu packages pulseaudio))
10+
(use-modules (gnu packages xfce))
11+
(use-modules (guix gexp))
12+
(use-modules (guix import utils)); for flatten
13+
14+
(define bashrc
15+
  (computed-file "bashrc"
16+
    #~(with-output-to-file #$output
17+
        (lambda _
18+
          (format #t "export SHELL
19+
20+
if [[ $- != *i* ]]; then
21+
      # Non interative shell. For SSH session, load /etc/profile to get
22+
      # PATH and other variables set up.
23+
        [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile
24+
      return
25+
fi
26+
27+
source /etc/bashrc
28+
29+
if [ -n \"$GUIX_ENVIRONMENT\" ]; then
30+
        PS1='\\u@\\h \\w [env]\\$ '
31+
else
32+
        PS1='\\u@\\h \\w\\$ '
33+
fi
34+
alias ls='ls -p --color=auto'
35+
alias ll='ls -l'
36+
alias grep='grep --color=auto'
37+
alias vim='nvim'")))))
38+
39+
(define bash_profile
40+
  (plain-file "bash_profile" "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
41+
"))
42+
43+
(define gtkrc-2
44+
  (plain-file "gtkrc-2.0" "gtk-theme-name=\"Arc-Dark\"
45+
gtk-icon-theme-name=\"Arc\"
46+
"))
47+
48+
(define gtkrc-3
49+
  (plain-file "settings.ini" "[Settings]
50+
gtk-theme-name=Arc-Dark
51+
gtk-icon-theme-name=Arc
52+
"))
53+
54+
(define gitconfig (local-file "files/gitconfig"))
55+
(define openbox-rc (local-file "files/openbox/rc.xml"))
56+
(define openbox-autostart
57+
  (computed-file "autostart"
58+
     #~(with-output-to-file #$output
59+
         (lambda _
60+
           (format #t "HOME=/tmp/pa ~a --start~%" #$(file-append pulseaudio "/bin/pulseaudio"))
61+
           (format #t "~a --bg-fill ~a~%" #$(file-append feh "/bin/feh")
62+
                   #$(local-file "/data/tyreunom/background.png"))
63+
           (format #t "~a -CGb~%" #$(file-append compton "/bin/compton"))
64+
           (format #t "~a -conf ~a &~%" #$(file-append dunst "/bin/dunst")
65+
                   #$(plain-file "dunstrc" ""))
66+
           (format #t "export GTK_IM_MODULE=ibus
67+
export XMODIFIERS=@im=ibus
68+
export QT_IM_MODULE=ibus
69+
export GUIX_GTK2_IM_MODULE_FILE=~~/.guix-profile/lib/gtk-2.0/2.10.0/immodules-gtk2.cache
70+
export GUIX_GTK3_IM_MODULE_FILE=~~/.guix-profile/lib/gtk-3.0/3.0.0/immodules-gtk3.cache
71+
~a -drx~%" #$(file-append ibus "/bin/ibus-daemon"))))))
72+
73+
(define xfce4-terminalrc
74+
  (local-file "files/xfce4-terminal/terminalrc"))
75+
76+
(home
77+
  (flatten
78+
    (list
79+
      (openbox-home (openbox-configuration
80+
                      (autostart openbox-autostart)
81+
                      (menus
82+
			(list
83+
			  (openbox-menu
84+
			    (id "apps-game-menu")
85+
			    (label "Jeux")
86+
			    (elements
87+
			      (list
88+
				(openbox-element-execute
89+
				  (label "MineTest")
90+
				  (command (file-append minetest "/bin/minetest"))))))))
91+
                      (root-elements
92+
			(list
93+
			  (openbox-element-menu (id "apps-game-menu"))
94+
			  (openbox-element-execute
95+
			    (label "Terminal")
96+
			    (command (file-append xfce4-terminal "/bin/xfce4-terminal")))))
97+
                      (rc openbox-rc)))
98+
      (simple-file-home bashrc ".bashrc")
99+
      (simple-file-home bash_profile ".bash_profile")
100+
      (simple-file-home gitconfig ".gitconfig")
101+
      (simple-file-home gtkrc-2 ".gtkrc-2.0")
102+
      (simple-file-home gtkrc-3 ".config/gtk-3.0/settings.ini")
103+
      (simple-file-home xfce4-terminalrc ".config/xfce4/terminal/terminalrc"))))

homes/tyreunom.manifest unknown status 1

1+
(specifications->manifest
2+
 '("hicolor-icon-theme" "arc-theme" "arc-icon-theme"
3+
   "font-dejavu" "font-wqy-microhei" "font-linuxlibertine" "font-tamzen"
4+
   "font-google-roboto" "font-terminus" "font-liberation" "font-google-noto"
5+
   "font-fira-code"
6+
7+
   "guile-readline" "guile"
8+
9+
   "gettext" "unzip" "hunspell-dict-fr" "file" "licensecheck" "git:send-email"
10+
   "bind:utils" "keepassxc" "gnupg" "pinentry" "youtube-dl" "git"
11+
12+
   "adb" "icedtea:jdk"
13+
14+
   "poedit"
15+
16+
   "zathura" "zathura-pdf-poppler" "owncloud-client"
17+
   "transmission:gui" "pavucontrol" "ibus" "ibus-anthy"
18+
19+
   "dunst" "compton"
20+
21+
   "icecat" "hexchat" "claws-mail" "wget" "feh" "mpv" "libreoffice"
22+
   "pcmanfm" "inkscape"
23+
24+
   "glibc-locales" "diffoscope"
25+
   "python" "python-neovim" "neovim"))

homes/tyreunom.scm unknown status 2

1-
;;; Tyreunom's system administration and configuration tools.
2-
;;;
3-
;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu>
4-
;;;
5-
;;; This program is free software: you can redistribute it and/or modify
6-
;;; it under the terms of the GNU General Public License as published by
7-
;;; the Free Software Foundation, either version 3 of the License, or
8-
;;; (at your option) any later version.
9-
;;;
10-
;;; This program is distributed in the hope that it will be useful,
11-
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13-
;;; GNU General Public License for more details.
14-
;;;
15-
;;; You should have received a copy of the GNU General Public License
16-
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17-
18-
(define-module (tyreunom)
19-
  #:use-module (guix packages)
20-
  #:use-module (guix gexp)
21-
  #:use-module (guix build-system trivial)
22-
  #:use-module (guix build utils)
23-
  #:use-module (guix licenses)
24-
  #:use-module (gnu packages)
25-
  #:use-module (gnu packages image-viewers)
26-
  #:use-module (gnu packages pulseaudio))
27-
28-
(define bashrc
29-
  (computed-file "bashrc"
30-
    #~(with-output-to-file #$output
31-
        (lambda _
32-
          (format #t "export SHELL
33-
34-
if [[ $- != *i* ]]; then
35-
      # Non intercative shell. For SSH session, load /etc/profile to get
36-
      # PATH and other variables set up.
37-
        [[ -n \"$SSH_CLIENT\" ]] && source /etc/profile
38-
      return
39-
fi
40-
41-
source /etc/bashrc
42-
43-
if [ -n \"$GUIX_ENVIRONMENT\" ]; then
44-
        PS1='\\u@\\h \\w [env]\\$ '
45-
else
46-
        PS1='\\u@\\h \\w\\$ '
47-
fi
48-
alias ls='ls -p --color=auto'
49-
alias ll='ls -l'
50-
alias grep='grep --color=auto'")))))
51-
52-
(define bash_profile
53-
  (plain-file "bash_profile" "if [ -f ~/.bashrc ]; then . ~/.bashrc; fi
54-
"))
55-
56-
(define-public tyreunom-home
57-
  (package
58-
    (name "tyreunom-home")
59-
    (version "0")
60-
    (source #f)
61-
    (build-system trivial-build-system)
62-
    (arguments
63-
     `(#:modules ((guix build utils) (home utils))
64-
       #:builder
65-
       (begin
66-
         (use-modules (guix build utils) (home utils))
67-
         ;; Install openbox
68-
         (mkdir-p (home-file %outputs ".config/openbox"))
69-
         (copy-file (assoc-ref %build-inputs "openbox-rc.xml")
70-
                    (home-file %outputs ".config/openbox/rc.xml"))
71-
         (copy-file (assoc-ref %build-inputs "openbox-autostart")
72-
                    (home-file %outputs ".config/openbox/autostart"))
73-
         (for-each
74-
           (lambda (file)
75-
             (symlink (assoc-ref %build-inputs file)
76-
                      (home-file %outputs file)))
77-
           '(".bashrc" ".bash_profile"))
78-
         ;; TODO: manage profiles, plugins, etc through guix.
79-
         (symlink "/data/tyreunom/.mozilla"
80-
                  (home-file %outputs ".mozilla"))
81-
         ;; For guix
82-
         (symlink "/data/tyreunom/.config/guix"
83-
                  (home-file %outputs ".config/guix"))
84-
         (symlink "/data/tyreunom/.guix-profile"
85-
                  (home-file %outputs ".guix-profile"))
86-
         ;; symlink writeable directories
87-
         (symlink "/data/tyreunom/.local"
88-
                  (home-file %outputs ".local"))
89-
         (symlink "/data/tyreunom/.cache"
90-
                  (home-file %outputs ".cache")))))
91-
    (inputs
92-
     `((".bashrc" ,bashrc)
93-
       (".bash_profile" ,bash_profile)
94-
       ("openbox-rc.xml" ,(local-file "files/openbox/rc.xml"))
95-
       ("openbox-autostart"
96-
        ,(computed-file "autostart"
97-
           #~(with-output-to-file #$output
98-
               (lambda _
99-
                 (format #t "HOME=/tmp/pa ~a --start~%" #$(file-append pulseaudio "/bin/pulseaudio"))
100-
                 (format #t "~a --bg-fill ~a~%" #$(file-append feh "/bin/feh")
101-
                         #$(local-file "/data/tyreunom/background.png"))))))))
102-
    (home-page "")
103-
    (synopsis "")
104-
    (description "")
105-
    (license gpl3+)))

modules/home.scm unknown status 1

1+
;;; Tyreunom's system administration and configuration tools.
2+
;;;
3+
;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu>
4+
;;;
5+
;;; This program is free software: you can redistribute it and/or modify
6+
;;; it under the terms of the GNU General Public License as published by
7+
;;; the Free Software Foundation, either version 3 of the License, or
8+
;;; (at your option) any later version.
9+
;;;
10+
;;; This program is distributed in the hope that it will be useful,
11+
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13+
;;; GNU General Public License for more details.
14+
;;;
15+
;;; You should have received a copy of the GNU General Public License
16+
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17+
18+
(define-module (home)
19+
  #:use-module (guix build union)
20+
  #:use-module (guix build utils)
21+
  #:use-module (guix build-system trivial)
22+
  #:use-module (guix gexp)
23+
  #:use-module (guix licenses)
24+
  #:use-module (guix packages)
25+
  #:use-module (home build utils)
26+
  #:export (home))
27+
28+
(define (home inputs)
29+
  (define union
30+
    (computed-file "home"
31+
      #~(begin
32+
          (use-modules (guix build union))
33+
          (union-build #$output '#$inputs))
34+
      #:options
35+
      '(#:local-build? #t
36+
        #:modules ((guix build union)))))
37+
  (package
38+
    (name "tyreunom-home")
39+
    (version "0")
40+
    (source #f)
41+
    (build-system trivial-build-system)
42+
    (arguments
43+
     `(#:modules ((guix build utils) (home build utils))
44+
       #:builder
45+
       (begin
46+
         (use-modules (guix build utils) (home build utils))
47+
	 (mkdir-p (home-file %outputs ".config"))
48+
         ;; TODO: manage profiles, plugins, etc through guix.
49+
         (symlink "/data/tyreunom/.mozilla"
50+
                  (home-file %outputs ".mozilla"))
51+
         ;; For guix
52+
         (symlink "/data/tyreunom/.config/guix"
53+
                  (home-file %outputs ".config/guix"))
54+
         (symlink "/data/tyreunom/.guix-profile"
55+
                  (home-file %outputs ".guix-profile"))
56+
         ;; symlink writeable directories
57+
         (symlink "/data/tyreunom/.local"
58+
                  (home-file %outputs ".local"))
59+
         (symlink "/data/tyreunom/.cache"
60+
                  (home-file %outputs ".cache"))
61+
         ;; rest of the files
62+
	 (with-directory-excursion (assoc-ref %build-inputs "union")
63+
	 (for-each
64+
	   (lambda (f)
65+
	     (mkdir-p (home-file %outputs (dirname f)))
66+
	     (symlink (string-append (assoc-ref %build-inputs "union") "/" f)
67+
		      (home-file %outputs f)))
68+
	   (find-files "." ".*"))))))
69+
    (inputs
70+
     `(("union" ,union)))
71+
    (home-page "")
72+
    (synopsis "")
73+
    (description "")
74+
    (license gpl3+)))

modules/home/build/utils.scm unknown status 1

1+
;;; Tyreunom's system administration and configuration tools.
2+
;;;
3+
;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu>
4+
;;;
5+
;;; This program is free software: you can redistribute it and/or modify
6+
;;; it under the terms of the GNU General Public License as published by
7+
;;; the Free Software Foundation, either version 3 of the License, or
8+
;;; (at your option) any later version.
9+
;;;
10+
;;; This program is distributed in the hope that it will be useful,
11+
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13+
;;; GNU General Public License for more details.
14+
;;;
15+
;;; You should have received a copy of the GNU General Public License
16+
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17+
18+
(define-module (home build utils)
19+
  #:export (home-file))
20+
21+
(define (home-file outputs . path)
22+
  (apply string-append (assoc-ref outputs "out") "/" path))

modules/home/openbox.scm unknown status 1

1+
;;; Tyreunom's system administration and configuration tools.
2+
;;;
3+
;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu>
4+
;;;
5+
;;; This program is free software: you can redistribute it and/or modify
6+
;;; it under the terms of the GNU General Public License as published by
7+
;;; the Free Software Foundation, either version 3 of the License, or
8+
;;; (at your option) any later version.
9+
;;;
10+
;;; This program is distributed in the hope that it will be useful,
11+
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13+
;;; GNU General Public License for more details.
14+
;;;
15+
;;; You should have received a copy of the GNU General Public License
16+
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17+
18+
(define-module (home openbox)
19+
  #:use-module (guix build utils)
20+
  #:use-module (guix build-system trivial)
21+
  #:use-module (guix gexp)
22+
  #:use-module (guix licenses)
23+
  #:use-module (guix packages)
24+
  #:use-module (guix records)
25+
  #:use-module (gnu packages lxde)
26+
  #:use-module (ice-9 match)
27+
  #:export (openbox-configuration
28+
	    openbox-configuration?
29+
	    openbox-configuration-autostart
30+
	    openbox-configuration-environ
31+
	    openbox-configuration-menu
32+
	    openbox-configuration-rc
33+
	    
34+
	    openbox-menu
35+
            openbox-menu-id
36+
            openbox-menu-label
37+
            opebnox-menu-elements
38+
            
39+
            openbox-element-menu
40+
            openbox-element-execute
41+
            
42+
            openbox-home))
43+
44+
(define-record-type* <openbox-configuration>
45+
  openbox-configuration make-openbox-configuration
46+
  openbox-configuration?
47+
  (autostart     openbox-configuration-autostart
48+
		 (default #f))
49+
  (environ       openbox-configuration-environ
50+
		 (default #f))
51+
  (menus         openbox-configuration-menus
52+
		 (default '()))
53+
  (root-elements openbox-configuration-root-elements
54+
		 (default '()))
55+
  (rc            openbox-configuration-rc
56+
		 (default #f)))
57+
58+
(define-record-type* <openbox-menu>
59+
  openbox-menu make-openbox-menu
60+
  openbox-menu?
61+
  (id       openbox-menu-id)
62+
  (label    openbox-menu-label)
63+
  (elements openbox-menu-elements))
64+
65+
(define-record-type* <openbox-element-menu>
66+
  openbox-element-menu make-openbox-element-menu
67+
  openbox-element-menu?
68+
  (id openbox-element-menu-id))
69+
70+
(define-record-type* <openbox-element-execute>
71+
  openbox-element-execute make-openbox-element-execute
72+
  openbox-element-execute?
73+
  (label   openbox-element-execute-label)
74+
  (command openbox-element-execute-command)
75+
  (notify? openbox-element-execute-notify?
76+
           (default #t)))
77+
78+
(define (generate-openbox-menu menus root-menu)
79+
  (define (element->item element)
80+
    (match element
81+
      (($ <openbox-element-menu> id)
82+
       `(menu (@ (id ,id))))
83+
      (($ <openbox-element-execute> label command notify?)
84+
       `(item (@ (label ,label))
85+
          (action (@ (name "Execute"))
86+
            (command ,command)
87+
            ,@(if notify? '(startupnotify (enabled "yes")) '()))))))
88+
  #~(begin
89+
      (use-modules (sxml simple))
90+
      (with-output-to-file #$output
91+
         (lambda _
92+
           (sxml->xml
93+
             `(openbox_menu (@ (xmlns "http://openbox.org/3.4/menu"))
94+
                #$(map
95+
                   (lambda (menu)
96+
                     `(menu (@ (id ,(openbox-menu-id menu)) (label ,(openbox-menu-label menu)))
97+
                        ,(map element->item (openbox-menu-elements menu))))
98+
                   menus)
99+
                (menu (@ (id "root-menu") (label "Openbox 3"))
100+
                  #$(map element->item root-menu))))))))
101+
102+
(define (openbox-autostart autostart)
103+
  (match autostart
104+
    (#f (plain-file "autostart" ""))
105+
    (_ autostart)))
106+
107+
(define (openbox-environment environ)
108+
  (match environ
109+
    (#f (plain-file "environ" ""))
110+
    (_ environ)))
111+
112+
(define (openbox-rc rc)
113+
  (match rc
114+
    (#f (plain-file "rc.xml" ""))
115+
    (_ rc)))
116+
117+
(define (openbox-home config)
118+
  (computed-file "openbox-home"
119+
    (match config
120+
      (($ <openbox-configuration> autostart environ menus root-elements rc)
121+
       #~(let ((menu.xml #$(computed-file "menu.xml" (generate-openbox-menu menus root-elements)))
122+
	       (autostart #$(openbox-autostart autostart))
123+
	       (environ #$(openbox-environment environ))
124+
	       (rc #$(openbox-rc rc))
125+
	       (openbox-dir (string-append #$output "/.config/openbox")))
126+
	   (use-modules (guix build utils))
127+
	   (mkdir-p openbox-dir)
128+
	   (copy-file autostart (string-append openbox-dir "/autostart"))
129+
	   (copy-file environ (string-append openbox-dir "/environment"))
130+
	   (copy-file menu.xml (string-append openbox-dir "/menu.xml"))
131+
	   (copy-file rc (string-append openbox-dir "/rc.xml")))))
132+
    #:options
133+
    '(#:local-build? #t
134+
      #:modules ((guix build utils)))))

modules/home/utils.scm

1+
;;; Tyreunom's system administration and configuration tools.
2+
;;;
3+
;;; Copyright ?? 2019 Julien Lepiller <julien@lepiller.eu>
4+
;;;
5+
;;; This program is free software: you can redistribute it and/or modify
6+
;;; it under the terms of the GNU General Public License as published by
7+
;;; the Free Software Foundation, either version 3 of the License, or
8+
;;; (at your option) any later version.
9+
;;;
10+
;;; This program is distributed in the hope that it will be useful,
11+
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13+
;;; GNU General Public License for more details.
14+
;;;
15+
;;; You should have received a copy of the GNU General Public License
16+
;;; along with this program.  If not, see <http://www.gnu.org/licenses/>.
17+
118
(define-module (home utils)
2-
  #:export (home-file))
19+
  #:use-module (guix build utils)
20+
  #:use-module (guix gexp)
21+
  #:export (simple-file-home))
322
4-
(define (home-file outputs . path)
5-
  (apply string-append (assoc-ref outputs "out") "/" path))
23+
(define (simple-file-home file-gexp location)
24+
  (computed-file "simple-file-home"
25+
    #~(begin
26+
	(use-modules (guix build utils))
27+
        (mkdir-p (string-append #$output "/" #$(dirname location)))
28+
        (copy-file #$file-gexp (string-append #$output "/" #$location)))
29+
    #:options
30+
    '(#:local-build? #t
31+
      #:modules ((guix build utils)))))