aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFredrik Salomonsson <plattfot@posteo.net>2021-01-27 16:30:01 -0800
committerFredrik Salomonsson <plattfot@posteo.net>2021-01-27 16:30:01 -0800
commitef49320df475d9c246243904af7074c318c6c3d0 (patch)
treefdb5d0331a0baf6ad9a027efabd5d8ab38badc9f
parent9d0198e131f38d1fbd812dee1170a605e9efddb9 (diff)
downloadpinentry-rofi-ef49320df475d9c246243904af7074c318c6c3d0.tar.gz
Update guix.scm to build from source for both guile 3.0 and 2.22.0.2
Inspired by the talk "Just build it with Guix" by Efraim Flashner from the guix days which allows to use: guix build --file=guix.scm to run tests for both guile-3.0 and guile-2.2.
-rw-r--r--guix.scm167
1 files changed, 83 insertions, 84 deletions
diff --git a/guix.scm b/guix.scm
index af3b341..6e57adb 100644
--- a/guix.scm
+++ b/guix.scm
@@ -1,94 +1,93 @@
(use-modules
(guix packages)
- ((guix licenses) #:prefix license:)
(guix git-download)
+ (guix gexp)
(guix build-system gnu)
- (gnu packages)
+ ((guix licenses) #:prefix license:)
(gnu packages autotools)
(gnu packages guile)
- (gnu packages guile-xyz)
(gnu packages pkg-config)
(gnu packages texinfo)
- (gnu packages xdisorg))
+ (gnu packages xdisorg)
+ (ice-9 popen)
+ (ice-9 rdelim)
+ )
+
+;; From the talk "Just build it with Guix" by Efraim Flashner
+;; presented on the Guix days 2020
+;; https://guix.gnu.org/en/blog/2020/online-guix-day-announce-2/
+(define %source-dir (dirname (current-filename)))
+
+(define %git-commit
+ (read-string (open-pipe "git show HEAD | head -1 | cut -d ' ' -f2" OPEN_READ)))
+
+(define (skip-git-directory file stat)
+ "Skip the `.git` directory when collecting the source."
+ (not (string=? (basename file) ".git")))
-(package
- (name "pinentry-rofi")
- (version "2.0.1")
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://github.com/plattfot/pinentry-rofi/")
- (commit version)))
- (file-name (git-file-name name version))
- (sha256 (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
- (build-system gnu-build-system)
- (arguments
- `(#:modules
- ((ice-9 match)
- (ice-9 ftw)
- ,@%gnu-build-system-modules)
- #:phases
- (modify-phases
- %standard-phases
- (add-after
- 'install
- 'hall-wrap-binaries
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((compiled-dir
- (lambda (out version)
- (string-append
- out
- "/lib/guile/"
- version
- "/site-ccache")))
- (uncompiled-dir
- (lambda (out version)
- (string-append
- out
- "/share/guile/site"
- (if (string-null? version) "" "/")
- version)))
- (dep-path
- (lambda (env modules path)
- (list env
- ":"
- 'prefix
- (cons modules
- (map (lambda (input)
- (string-append
- (assoc-ref inputs input)
- path))
- ,''("rofi"))))))
- (out (assoc-ref outputs "out"))
- (bin (string-append out "/bin/"))
- (site (uncompiled-dir out "")))
- (match (scandir site)
- (("." ".." version)
- (for-each
- (lambda (file)
- (wrap-program
- (string-append bin file)
- (dep-path
- "GUILE_LOAD_PATH"
- (uncompiled-dir out version)
- (uncompiled-dir "" version))
- (dep-path
- "GUILE_LOAD_COMPILED_PATH"
- (compiled-dir out version)
- (compiled-dir "" version))))
- ,''("pinentry-rofi"))
- #t))))))))
- (native-inputs
- `(("autoconf" ,autoconf)
- ("automake" ,automake)
- ("pkg-config" ,pkg-config)
- ("texinfo" ,texinfo)))
- (inputs `(("guile" ,guile-3.0)))
- (propagated-inputs `(("rofi" ,rofi)))
- (synopsis "Rofi frontend to pinentry")
- (description
- "Simple pinentry gui using rofi, it is written in GNU guile.")
- (home-page
- "https://github.com/plattfot/pinentry-rofi/")
- (license license:gpl3+))
+(define-public pinentry-rofi
+ (package
+ (name "pinentry-rofi")
+ (version "2.0.2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/plattfot/pinentry-rofi/")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "044bnldz7k74s873jwsjgff176l1jsvpbaka7d1wcj8b5pwqv2av"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:modules
+ ((ice-9 match)
+ (ice-9 ftw)
+ ,@%gnu-build-system-modules)
+ #:phases
+ (modify-phases
+ %standard-phases
+ (add-after 'install 'hall-wrap-binaries
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (bin (string-append out "/bin/"))
+ (site (string-append out "/share/guile/site"))
+ (rofi-bin (string-append (assoc-ref inputs "rofi") "/bin")))
+ (match (scandir site)
+ (("." ".." version)
+ (wrap-program
+ (string-append bin "pinentry-rofi")
+ (list "PATH" ":" 'prefix `(,rofi-bin)))
+ #t))))))))
+ (native-inputs
+ `(("autoconf" ,autoconf)
+ ("automake" ,automake)
+ ("pkg-config" ,pkg-config)
+ ("texinfo" ,texinfo)))
+ (inputs `(("guile" ,guile-3.0)
+ ("rofi" ,rofi)))
+ (synopsis "Rofi GUI for GnuPG's passphrase input")
+ (description "Pinentry-rofi is a simple graphical user interface for
+passphrase or PIN when required by @code{gpg} or other software. It is using
+the Rofi application launcher as the user interface. Which makes it combined
+with @code{rofi-pass} a good front end for @code{password-store}.")
+ (home-page "https://github.com/plattfot/pinentry-rofi/")
+ (license license:gpl3+)))
+(list
+ (package
+ (inherit pinentry-rofi)
+ (name "pinentry-rofi-git-with-guile-3.0")
+ (version (git-version (package-version pinentry-rofi) "HEAD" %git-commit))
+ (source (local-file %source-dir
+ #:recursive? #t
+ #:select? skip-git-directory)))
+ (package
+ (inherit pinentry-rofi)
+ (name "pinentry-rofi-git-with-guile-2.2")
+ (version (git-version (package-version pinentry-rofi) "HEAD" %git-commit))
+ (source (local-file %source-dir
+ #:recursive? #t
+ #:select? skip-git-directory))
+ (inputs `(("guile" ,guile-2.2)
+ ("rofi" ,rofi))))
+ )