use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum NixSystem {
X86_64Linux,
Aarch64Linux,
X86_64Darwin,
Aarch64Darwin,
}
impl NixSystem {
pub fn as_str(&self) -> &'static str {
match self {
Self::X86_64Linux => "x86_64-linux",
Self::Aarch64Linux => "aarch64-linux",
Self::X86_64Darwin => "x86_64-darwin",
Self::Aarch64Darwin => "aarch64-darwin",
}
}
pub fn all() -> Vec<Self> {
vec![Self::X86_64Linux, Self::Aarch64Linux, Self::X86_64Darwin, Self::Aarch64Darwin]
}
pub fn linux_only() -> Vec<Self> {
vec![Self::X86_64Linux, Self::Aarch64Linux]
}
}
impl std::fmt::Display for NixSystem {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.as_str())
}
}