Skip to content

Commit

Permalink
use arm64 instead of aarch64 to match uname, fixes #6
Browse files Browse the repository at this point in the history
  • Loading branch information
timbertson committed Jan 29, 2024
1 parent 393acc7 commit 26a2997
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion builder/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn all_platforms() -> Vec<&'static str> {
vec!(
"x86_64-Linux",
"x86_64-Darwin",
"aarch64-Darwin",
"arm64-Darwin",
)
}

Expand Down
2 changes: 1 addition & 1 deletion builder/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fn crossplatform_file_types() -> Result<()> {
(arch, os) => {
let arch_name = match arch {
"x86_64" => "x86-64",
"aarch64" => "arm64",
"arm64" => "arm64",
_ => todo!(),
};
let exe_type = match os {
Expand Down
8 changes: 4 additions & 4 deletions cli/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Display for OS {
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Arch {
x86_64,
aarch64,
arm64,
}

impl FromStr for Arch {
Expand All @@ -51,7 +51,7 @@ impl FromStr for Arch {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"x86_64" => Ok(Self::x86_64),
"aarch64" => Ok(Self::aarch64),
"arm64" => Ok(Self::arm64),
other => Err(anyhow!("Unknown arch: {}", other))
}
}
Expand All @@ -62,7 +62,7 @@ impl Arch {
if cfg!(target_arch = "x86_64") {
Ok(Self::x86_64)
} else if cfg!(target_arch = "aarch64") {
Ok(Self::aarch64)
Ok(Self::arm64)
} else {
Err(anyhow!("Unknown architecture: {}", std::env::consts::ARCH))
}
Expand All @@ -73,7 +73,7 @@ impl Display for Arch {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(match self {
Self::x86_64 => "x86_64",
Self::aarch64 => "aarch64",
Self::arm64 => "arm64",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion nix/all-platforms.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ listToAttrs (map (platform: {
}) [
"x86_64-Darwin"
"x86_64-Linux"
"aarch64-Darwin"
"arm64-Darwin"
])
4 changes: 2 additions & 2 deletions nix/lock.gup
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mkdir "$1"
fetlock -o "$1/x86_64-Linux.nix" -p .. --cargo-platform x86_64-unknown-linux-gnu
fetlock -o "$1/x86_64-Darwin.nix" -p .. --cargo-platform x86_64-apple-darwin

# assume aarch64 has the same deps :shrug:
ln -sfn "./x86_64-Darwin.nix" "$1/aarch64-Darwin.nix"
# assume arm64 has the same deps :shrug:
ln -sfn "./x86_64-Darwin.nix" "$1/arm64-Darwin.nix"

platform="$(echo "$(uname -m)-$(uname -s)")"
ln -sfn "./$platform.nix" "$1/current.nix"
2 changes: 1 addition & 1 deletion nix/runix.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ let
_platformArg = platform;
sources = import ./sources.nix {};
getNixPlatform = p: builtins.getAttr p {
"aarch64-Darwin" = "aarch64-apple-darwin";
"arm64-Darwin" = "aarch64-apple-darwin";
"x86_64-Darwin" = "x86_64-apple-darwin";
"x86_64-Linux" = "x86_64-unknown-linux-musl";
};
Expand Down

0 comments on commit 26a2997

Please sign in to comment.