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 <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-08-23 10:28:19 +03:00 committed by clbot
parent c321a5136f
commit 35d5811eec

View file

@ -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).