From 9d72e8a2460cc6cfc9f7058cc689472b9b0fe7c2 Mon Sep 17 00:00:00 2001 From: Puck Meerburg Date: Sun, 11 May 2025 22:21:07 +0000 Subject: [PATCH] (zilch nix path): support content-addressed paths with references --- core/src/nix/path.sld | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/nix/path.sld b/core/src/nix/path.sld index 5629c47..0a56ffa 100644 --- a/core/src/nix/path.sld +++ b/core/src/nix/path.sld @@ -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))))