From 35d5811eec4f2d610e811d24b412aa05479a7358 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 23 Aug 2024 10:28:19 +0300 Subject: [PATCH] feat(nix-compat): add constants for mime types This adds the MIME types Nix uses when uploading files to a S3 bucket / HTTP endpoint. It ignores them when retrieving. Change-Id: I75fa96d5e53349f0470bbe8cbba93f961fbd5f05 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12266 Autosubmit: flokli Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/nix-compat/src/nix_http/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tvix/nix-compat/src/nix_http/mod.rs b/tvix/nix-compat/src/nix_http/mod.rs index cbb629784..89ba147b8 100644 --- a/tvix/nix-compat/src/nix_http/mod.rs +++ b/tvix/nix-compat/src/nix_http/mod.rs @@ -2,6 +2,13 @@ use tracing::trace; use crate::nixbase32; +/// The mime type used for NAR files, both compressed and uncompressed +pub const MIME_TYPE_NAR: &str = "application/x-nix-nar"; +/// The mime type used for NARInfo files +pub const MIME_TYPE_NARINFO: &str = "text/x-nix-narinfo"; +/// The mime type used for the `nix-cache-info` file +pub const MIME_TYPE_CACHE_INFO: &str = "text/x-nix-cache-info"; + /// Parses a `14cx20k6z4hq508kqi2lm79qfld5f9mf7kiafpqsjs3zlmycza0k.nar` /// string and returns the nixbase32-decoded digest, as well as the compression /// suffix (which might be empty).