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:
;; #
(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? # …)
In guix/memoization.scm:
101:0 18 (_ # # …)
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" #) …))
586:29 12 (map1 (("python-distro" #) …))
586:29 11 (map1 (("python-docker" #) …))
586:29 10 (map1 (("python-dockerpty" #) …))
586:29 9 (map1 (("python-docopt" #) …))
586:29 8 (map1 (("python-dotenv" #) …))
586:29 7 (map1 (("python-jsonschema" #) …))
586:17 6 (map1 (("python-pyyaml" #) …))
In guix/packages.scm:
1360:20 5 (rewrite ("python-pyyaml" #))
In guix/memoization.scm:
101:0 4 (_ # # …)
In guix/packages.scm:
1377:22 3 (_)
1435:37 2 (loop #)
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: #
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 docker-compose
using 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.)
Asked by BlackShift
(313 rep)
Apr 15, 2022, 08:26 AM
Last activity: Oct 10, 2024, 10:03 AM
Last activity: Oct 10, 2024, 10:03 AM