Serve the /nix-cache-info response

This should be the last piece of the puzzle for providing substitutes for
derivations.
This commit is contained in:
Christopher Baines 2019-12-26 10:07:55 +00:00
parent 66e886a6b4
commit a3ea38d545

View file

@ -45,6 +45,11 @@
(define %narinfo-signing-public-key (define %narinfo-signing-public-key
(make-parameter #f)) (make-parameter #f))
(define %nix-cache-info
`(("StoreDir" . "/gnu/store")
("WantMassQuery" . 0)
("Priority" . 100)))
(define (nar-controller request (define (nar-controller request
method-and-path-components method-and-path-components
mime-types mime-types
@ -54,6 +59,13 @@
(string-suffix? ".narinfo" s)) (string-suffix? ".narinfo" s))
(match method-and-path-components (match method-and-path-components
(('GET "nix-cache-info")
(render-text
(string-concatenate
(map (match-lambda
((key . value)
(format #f "~a: ~a~%" key value)))
%nix-cache-info))))
(('GET "nar" derivation) (('GET "nar" derivation)
(render-nar request (render-nar request
mime-types mime-types