entrenar/sovereign/nix/
system.rs1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
7pub enum NixSystem {
8 X86_64Linux,
10 Aarch64Linux,
12 X86_64Darwin,
14 Aarch64Darwin,
16}
17
18impl NixSystem {
19 pub fn as_str(&self) -> &'static str {
21 match self {
22 Self::X86_64Linux => "x86_64-linux",
23 Self::Aarch64Linux => "aarch64-linux",
24 Self::X86_64Darwin => "x86_64-darwin",
25 Self::Aarch64Darwin => "aarch64-darwin",
26 }
27 }
28
29 pub fn all() -> Vec<Self> {
31 vec![Self::X86_64Linux, Self::Aarch64Linux, Self::X86_64Darwin, Self::Aarch64Darwin]
32 }
33
34 pub fn linux_only() -> Vec<Self> {
36 vec![Self::X86_64Linux, Self::Aarch64Linux]
37 }
38}
39
40impl std::fmt::Display for NixSystem {
41 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
42 write!(f, "{}", self.as_str())
43 }
44}