The GUIX Inferiors manual states that
Thus you can insert an inferior package pretty much anywhere you would insert a regular package: in manifests, in the packages field of your operating-system declaration, and so on.
However, I cannot figure out how to use an Inferior when rewriting the input of a package. E.g. this manifest, based on the Defining Package Variants section of the manual, does not work for me:
(use-modules (guix inferior) (guix channels) (guix packages) (srfi srfi-1)) (use-package-modules docker) (use-package-modules python-xyz) (define mychannels (list (channel (name 'guix) (url "https://git.savannah.gnu.org/git/guix.git") ;; Last commit that still has python-pyyaml 5.4.1. (commit "d3e1a94391a838332b0565d56762a58cf87ac6b1")))) (define myinferior (inferior-for-channels mychannels)) (define pyyaml5 (first (lookup-inferior-packages myinferior "python-pyyaml"))) (define pyyaml5-instead-of-pyyaml6 ;; This is a procedure to replace pyyaml 6.0 by pyyaml 5.4.1. ;; The line below does not work, raises this error: ;; In procedure package-properties: Wrong type argument: ;; #<inferior-package email@example.com 7f42653831b0> (package-input-rewriting `((,python-pyyaml . , pyyaml5))) ;; The line below does work (and has a similar result). ;(package-input-rewriting `((,python-pyyaml . , python-pyyaml-for-awscli))) ) (define docker-compose-with-pyyaml5 (pyyaml5-instead-of-pyyaml6 docker-compose)) (packages->manifest (list pyyaml5 (specification->package "python") docker-compose-with-pyyaml5 ))
docker-compose only works with
python-pyyaml 5.4.1 and the version in the channel has been upgraded to 6.0. The rewriting that I'm therefore trying to do is to rewrite the input to
docker-compose to use
python-pyyaml 5.4.1 from an earlier version of the channel. However, my attempts fail with
Backtrace: In guix/packages.scm: 1269:17 19 (supported-package? #<package firstname.lastname@example.org gu…> …) In guix/memoization.scm: 101:0 18 (_ #<hash-table 7fa05e6274c0 152/223> #<package docker…> …) In guix/packages.scm: 1247:37 17 (_) 1507:16 16 (package->bag _ _ _ #:graft? _) 1608:48 15 (thunk) 1403:25 14 (inputs _) In srfi/srfi-1.scm: 586:29 13 (map1 (("python-cached-property" #<package python-…>) …)) 586:29 12 (map1 (("python-distro" #<package python-distro@1.…>) …)) 586:29 11 (map1 (("python-docker" #<package python-docker@5.…>) …)) 586:29 10 (map1 (("python-dockerpty" #<package python-docker…>) …)) 586:29 9 (map1 (("python-docopt" #<package python-docopt@0.…>) …)) 586:29 8 (map1 (("python-dotenv" #<package python-dotenv@0.…>) …)) 586:29 7 (map1 (("python-jsonschema" #<package python-jsons…>) …)) 586:17 6 (map1 (("python-pyyaml" #<package python-pyyaml@6.…>) …)) In guix/packages.scm: 1360:20 5 (rewrite ("python-pyyaml" #<package email@example.com…>)) In guix/memoization.scm: 101:0 4 (_ #<hash-table 7fa06ac0b540 8/31> #<package python-py…> …) In guix/packages.scm: 1377:22 3 (_) 1435:37 2 (loop #<inferior-package firstname.lastname@example.org 7fa06304b3…>) In ice-9/boot-9.scm: 1685:16 1 (raise-exception _ #:continuable? _) 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: In procedure package-properties: Wrong type argument: #<inferior-package email@example.com 7fa06304b3f0>
How can I do this rewriting of input with an inferior?
Apparently there now is a
python-pyyaml 5.4.1 in the channel, called
python-pyyaml-for-awscli. Rewriting the input of
docker-compose with that package does work as expected, so as far as I can see I'm using the correct syntax when rewriting input. (I'm not sure what the backtick, the dot, and the commas do, maybe there is a mistake there.)
(As for the XY-problem, I can now run
python-pyaml-for-awscli, however I'm still interested in how to use the Inferior, because next there might not be such a package available.)