home.scm
| 1 | ;;; Guix Home Manager. |
| 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 | use-home-modules)) |
| 28 | |
| 29 | (define-syntax-rule (use-home-modules module ...) |
| 30 | (use-modules (home module) ...)) |
| 31 | |
| 32 | (define* (home basedir inputs #:key |
| 33 | (guix-symlink (string-append basedir "/.guix-profile")) |
| 34 | (guix-config-symlink (string-append basedir "/.config/guix")) |
| 35 | (local-symlink (string-append basedir "/.local")) |
| 36 | (cache-symlink (string-append basedir "/.cache"))) |
| 37 | (define union |
| 38 | (computed-file "home" |
| 39 | #~(begin |
| 40 | (use-modules (guix build union)) |
| 41 | (union-build #$output '#$inputs)) |
| 42 | #:options |
| 43 | '(#:local-build? #t |
| 44 | #:modules ((guix build union))))) |
| 45 | (package |
| 46 | (name "tyreunom-home") |
| 47 | (version "0") |
| 48 | (source #f) |
| 49 | (build-system trivial-build-system) |
| 50 | (arguments |
| 51 | `(#:modules ((guix build utils) (home build utils)) |
| 52 | #:builder |
| 53 | (begin |
| 54 | (use-modules (guix build utils) (home build utils)) |
| 55 | (mkdir-p (home-file %outputs ".config")) |
| 56 | ;; For guix |
| 57 | (symlink guix-config-symlink (home-file %outputs ".config/guix")) |
| 58 | (symlink guix-symlink (home-file %outputs ".guix-profile")) |
| 59 | ;; symlink writeable directories |
| 60 | (symlink local-symlink (home-file %outputs ".local")) |
| 61 | (symlink cache-symlink (home-file %outputs ".cache")) |
| 62 | ;; rest of the files |
| 63 | (with-directory-excursion (assoc-ref %build-inputs "union") |
| 64 | (for-each |
| 65 | (lambda (f) |
| 66 | (mkdir-p (home-file %outputs (dirname f))) |
| 67 | (symlink (string-append (assoc-ref %build-inputs "union") "/" f) |
| 68 | (home-file %outputs f))) |
| 69 | (find-files "." ".*")))))) |
| 70 | (inputs |
| 71 | `(("union" ,union))) |
| 72 | (home-page "") |
| 73 | (synopsis "") |
| 74 | (description "") |
| 75 | (license gpl3+))) |