]> git.ekhem.eu.org Git - guix.git/commitdiff
[common] Install programs from local source code.
authorJakub Czajka <jakub@ekhem.eu.org>
Fri, 23 Dec 2022 19:47:12 +0000 (20:47 +0100)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:53:07 +0000 (19:53 +0100)
Guix downloads programs and source code from the internet. However, if
we want to install custom versions of these programs, we need to
compile them manually from local source code. This commit adds helper
functions for working with such programs.

README
conf/common/local-package.scm [new file with mode: 0644]

diff --git a/README b/README
index 2c0b177c98828f4520384f600e6dfffad3e11fa5..0a911a7cea879919674c4a7510dbf3948fa6644e 100644 (file)
--- a/README
+++ b/README
@@ -8,7 +8,9 @@ installation instructions.
 Files
 -----
 
-* home.scm   - home directory configuration for the GNU Guix operating system.
-* system.scm - system configuration for the GNU Guix operating system.
-* conf/home/ - custom GNU Guix programs and services for the home directory.
-* <program>/ - program-specific dotfiles.
+* home.scm     - home directory configuration for the GNU Guix operating system.
+* system.scm   - system configuration for the GNU Guix operating system.
+* conf/home/   - custom GNU Guix programs and services for the home directory.
+* conf/common/ - custom GNU Guix programs and services shared by home and system
+                 configurations.
+* <program>/   - program-specific dotfiles.
diff --git a/conf/common/local-package.scm b/conf/common/local-package.scm
new file mode 100644 (file)
index 0000000..d3b754a
--- /dev/null
@@ -0,0 +1,31 @@
+;; Copyright (c) 2022 Jakub Czajka <jakub@ekhem.eu.org>
+;; License: GPL-3.0 or later.
+;;
+;; local-package.scm - install package from local source code.
+
+(define-module (conf common local-package)
+  #:use-module (guix gexp)
+  #:use-module (guix packages)
+  #:export (local-package))
+
+(define (local-package guix-package)
+  (define guix-package-name
+    (package-name guix-package))
+
+  (define local-package-name
+    (string-concatenate
+     (list "conf-" guix-package-name)))
+
+  (define local-source-path
+    (string-concatenate
+     (list (getenv "GUIX_PACKAGE_PATH") "/" guix-package-name)))
+
+  (define local-source
+    (local-file local-source-path
+               local-package-name
+               #:recursive? #t))
+
+  (package
+   (inherit guix-package)
+   (name local-package-name)
+   (source local-source)))