[ Prev ] [ Index ] [ Next ]

Snippets

Created Tuesday 14 August 2018

Using a newer/older release source for a package

(define-public newer-package
(package (inherit original-package)

(version "new-package-version")
(source
(origin
(method url-fetch)
(uri "new-download-url")
(sha256
(base32
"new-download-hash"))))
))

Adding a .desktop file to a package

(define-module (adding-desktop-file)
#:use-module (guix packages)
#:use-module (guix utils)
)

(define-public package-with-desktop-file
(package (inherit original-package)

(arguments (substitute-keyword-arguments (package-arguments original-package)
((#:phases phases)
`(modify-phases ,phases
(add-after 'install 'add-desktop-integration
(lambda _
(mkdir-p (string-append (assoc-ref %outputs "out") "/share/applications"))
(with-output-to-file
(string-append (assoc-ref %outputs "out") "/share/applications/application.desktop")
(lambda _
(format #t
"[Desktop Entry]~@
Name=ApplicationName~@
Comment=Application comment~@
Exec=~a/bin/application~@
Icon=application~@
Categories=Category~@
Type=Application~%"
(assoc-ref %outputs "out"))))
))))))
))

Replacing an input of a package

(define-module (replacing-an-input)
#:use-module (srfi srfi-1))

(define-public package-with-replaced-input
(package (inherit original-package)

(inputs
`(,@(alist-delete "original-input" (package-inputs original-package))
("replacement-input" ,replacement-input)))
))

Adding a configure flag to a package

(define-module (adding-a-configure-flag))
(define-public package-with-additional-configure-flag
(package (inherit original-package)

(arguments
`(,@(substitute-keyword-arguments (package-arguments original-package)
((#:configure-flags cf)
`(cons "--new-configure-flag=new_configuration" ,cf)))))
))