Leo Famulari skribis: > On Mon, Oct 02, 2017 at 10:00:33PM +0200, Ludovic Courtès wrote: >> Right. Jan suggested checking the content-addressed mirrors *before* >> the real upstream address. That would address the problem of upstream >> sources modified in-place, but at the cost of privacy/self-sufficiency >> as you note. (Though it’s not really making “privacy” any worse in this >> case: it’s gnu.org vs. github.com.) > > Yeah, I don't personally think there is a privacy issue with fetching > sources from our mirrors at gnu.org, or other domains we control. > >> Perhaps we should make content-addressed mirrors configurable in a way >> that’s orthogonal to derivations, something similar in spirit to >> --substitute-urls? The difficulty is that content-addressed mirrors are >> not just URLs; see (guix download). >> >> Thoughts? > > I do think we should make it so that users don't suffer from unreliable > upstream sources when we know the sources are available on our servers > (or the Nix mirror), even with --no-substitutes. The more I think about it, the more I’m inclined to simply move content-addressed mirrors to the front of the list. This means that users, in practice, would be fetching all the source from mirror.hydra.gnu.org. The main issue is making it configurable. Currently the content-addressed mirror configuration for regular files in (guix download) looks like this: --8<---------------cut here---------------start------------->8--- (define %content-addressed-mirrors ;; List of content-addressed mirrors. Each mirror is represented as a ;; procedure that takes a file name, an algorithm (symbol) and a hash ;; (bytevector), and returns a URL or #f. ;; Note: Avoid 'https' to mitigate . ;; TODO: Add more. '(list (lambda (file algo hash) ;; Files served by 'guix publish' are accessible under a single ;; hash algorithm. (string-append "http://mirror.hydra.gnu.org/file/" file "/" (symbol->string algo) "/" (bytevector->nix-base32-string hash))) (lambda (file algo hash) ;; 'tarballs.nixos.org' supports several algorithms. (string-append "http://tarballs.nixos.org/" (symbol->string algo) "/" (bytevector->nix-base32-string hash))))) --8<---------------cut here---------------end--------------->8--- That for VCS checkouts in (guix build download-nar) looks like this: --8<---------------cut here---------------start------------->8--- (define (urls-for-item item) "Return the fallback nar URL for ITEM--e.g., \"/gnu/store/cabbag3…-foo-1.2-checkout\"." ;; Here we hard-code nar URLs without checking narinfos. That's probably OK ;; though. ;; TODO: Use HTTPS? The downside is the extra dependency. (let ((bases '("http://mirror.hydra.gnu.org/guix" "http://berlin.guixsd.org")) (item (basename item))) (append (map (cut string-append <> "/nar/gzip/" item) bases) (map (cut string-append <> "/nar/" item) bases)))) --8<---------------cut here---------------end--------------->8--- The latter could be expressed by a command-line flag. In fact it’s the same as --substitute-urls. (Time passes…) Thinking more about it, why not simply always enable substitutes for fixed-output derivations, like this: