|
| 1 | +;;; GNU Guix --- Functional package management for GNU |
| 2 | +;;; Copyright © 2022 Attila Lendvai <[email protected]> |
| 3 | +;;; |
| 4 | +;;; This file is part of GNU Guix. |
| 5 | +;;; |
| 6 | +;;; GNU Guix is free software; you can redistribute it and/or modify it |
| 7 | +;;; under the terms of the GNU General Public License as published by |
| 8 | +;;; the Free Software Foundation; either version 3 of the License, or (at |
| 9 | +;;; your option) any later version. |
| 10 | +;;; |
| 11 | +;;; GNU Guix is distributed in the hope that it will be useful, but |
| 12 | +;;; WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +;;; GNU General Public License for more details. |
| 15 | +;;; |
| 16 | +;;; You should have received a copy of the GNU General Public License |
| 17 | +;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +;; To build and install: |
| 20 | +;; guix package -f guix.scm |
| 21 | +;; |
| 22 | +;; To build it, but not install it: |
| 23 | +;; guix build -f guix.scm |
| 24 | +;; |
| 25 | +;; To enter a shell environment for development: |
| 26 | +;; guix shell |
| 27 | + |
| 28 | +(use-modules |
| 29 | + (gnu packages idris) |
| 30 | + (git) |
| 31 | + (guix gexp) |
| 32 | + (guix git) |
| 33 | + (guix git-download) |
| 34 | + (guix packages)) |
| 35 | + |
| 36 | +(define *source-dir* (dirname (current-filename))) |
| 37 | + |
| 38 | +(define *include-worktree-changes* #false) |
| 39 | + |
| 40 | +(define (latest-git-commit-hash dir) |
| 41 | + (with-repository dir repo |
| 42 | + (oid->string (reference-target (repository-head repo))))) |
| 43 | + |
| 44 | +(define (current-git-branch-name dir) |
| 45 | + (with-repository dir repo |
| 46 | + (branch-name (repository-head repo)))) |
| 47 | + |
| 48 | +(let ((template-package idris-1.3.4) |
| 49 | + (branch-name (current-git-branch-name *source-dir*))) |
| 50 | + (package |
| 51 | + (inherit template-package) |
| 52 | + (name "idris") |
| 53 | + (version (git-version (package-version template-package) |
| 54 | + (string-append |
| 55 | + branch-name |
| 56 | + (if *include-worktree-changes* |
| 57 | + "-dirty" |
| 58 | + "")) |
| 59 | + (latest-git-commit-hash *source-dir*))) |
| 60 | + (source (if *include-worktree-changes* |
| 61 | + (local-file *source-dir* |
| 62 | + #:recursive? #t |
| 63 | + #:select? (git-predicate *source-dir*)) |
| 64 | + (git-checkout (url *source-dir*) |
| 65 | + (branch branch-name)))))) |
0 commit comments