namespace Rhea.Nar; /// Common strings/flags in NAR archives public static class NarConsts { /// Nix archive header public static readonly byte[] Header = NarWriter.GetLengthPrefixedPadded("nix-archive-1"u8); /// Start of object marker public static readonly byte[] LeftParen = NarWriter.GetLengthPrefixedPadded("("u8); /// End of object marker public static readonly byte[] RightParen = NarWriter.GetLengthPrefixedPadded(")"u8); /// Indicates the node is a regular file public static readonly byte[] Regular = NarWriter.GetLengthPrefixedPadded("regular"u8); /// Indicates the node is a directory public static readonly byte[] Directory = NarWriter.GetLengthPrefixedPadded("directory"u8); /// Indicates the node is a symlink public static readonly byte[] Symlink = NarWriter.GetLengthPrefixedPadded("symlink"u8); /// Indicates a directory entry public static readonly byte[] Entry = NarWriter.GetLengthPrefixedPadded("entry"u8); /// Indicates a directory entry public static readonly byte[] Node = NarWriter.GetLengthPrefixedPadded("node"u8); /// Indicates the name of a directory entry public static readonly byte[] Name = NarWriter.GetLengthPrefixedPadded("name"u8); /// Indicates the target of a symlink public static readonly byte[] Target = NarWriter.GetLengthPrefixedPadded("target"u8); /// Indicates the type of an entry public static readonly byte[] Type = NarWriter.GetLengthPrefixedPadded("type"u8); /// Indicates that a regular file is executable public static readonly byte[] Executable = NarWriter.GetLengthPrefixedPadded("executable"u8); /// Indicates the start of regular file contents public static readonly byte[] Contents = NarWriter.GetLengthPrefixedPadded("contents"u8); } /// Some pre-combined constants public static class CombinedNarConsts { /// Entry of type Regular public static readonly byte[] TypeRegular = [..NarConsts.Type, ..NarConsts.Regular]; /// Entry of type Directory public static readonly byte[] TypeDirectory = [..NarConsts.Type, ..NarConsts.Directory]; /// Entry of type Symlink public static readonly byte[] TypeSymlink = [..NarConsts.Type, ..NarConsts.Symlink]; /// Entry with name public static readonly byte[] EntryWithName = [..NarConsts.Entry, ..NarConsts.LeftParen, ..NarConsts.Name]; /// Symlink with target public static readonly byte[] SymlinkWithTarget = [..NarConsts.Type, ..NarConsts.Symlink, ..NarConsts.Target]; /// Executable with 8 bytes of padding public static readonly byte[] ExecutableWithPadding = [..NarConsts.Executable, ..new byte[8]]; }