(zilch nix path): support content-addressed paths with references

This commit is contained in:
puck 2025-05-11 22:21:07 +00:00
parent f8dd673609
commit 9d72e8a246

View file

@ -3,13 +3,14 @@
;; These helpers all use the `%store-dir` parameter as base store directory.
(define-library (zilch nix path)
(import
(scheme base)
(scheme base) (srfi 152)
(zilch lib hash) (zilch nix hash))
(export
%store-dir
impure-placeholder make-upstream-output-placeholder make-placeholder
make-store-path-from-parts make-text-path make-fixed-output-path make-output-path)
make-store-path-from-parts make-text-path make-fixed-output-path make-output-path
make-fixed-output-with-references)
(begin
;; The path to the store dir, as a parameter.
@ -61,4 +62,9 @@
(sha256
(string->utf8
(string-append "fixed:out:" (if recursive "r:" "") hash-algo ":" (hex hash-value) ":")))
name)))))
name)))
(define (make-fixed-output-with-references hash-value name references self-references)
(make-store-path-from-parts
(string-join (append (cons "source" references) (if self-references '("self") '())) ":")
"sha256" hash-value name))))