Skip to content

Commit

Permalink
chore(*): add warning for no precompiled binaries for nixos (#2551)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jolg42 committed May 25, 2020
1 parent a8180a1 commit 2f1948a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/packages/engine-core/src/NodeEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const knownPlatforms: Platform[] = [
'freebsd',
'openbsd',
'netbsd',
'nixos',
'arm',
]

Expand Down
8 changes: 4 additions & 4 deletions src/packages/fetch-engine/src/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ export async function download(options: DownloadOptions): Promise<BinaryPaths> {
const platform = await getPlatform()
const os = await getos()

if (os.distro === 'arm') {
if (['arm', 'nixos'].includes(os.distro)) {
console.error(
`${chalk.yellow(
'Warning',
)} Precompiled binaries are not available for ARM.`,
`${chalk.yellow('Warning')} Precompiled binaries are not available for ${
os.distro
}.`,
)
} else if (['freebsd', 'openbsd', 'netbsd'].includes(platform)) {
console.error(
Expand Down
6 changes: 5 additions & 1 deletion src/packages/get-platform/src/getPlatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const exists = promisify(fs.exists)
export type GetOSResult = {
platform: NodeJS.Platform
libssl?: string
distro?: 'rhel' | 'debian' | 'musl' | 'arm'
distro?: 'rhel' | 'debian' | 'musl' | 'arm' | 'nixos'
}

export async function getos(): Promise<GetOSResult> {
Expand Down Expand Up @@ -43,6 +43,10 @@ export function parseDistro(input: string): GetOSResult['distro'] {
return 'arm'
}

if (id === 'nixos') {
return 'nixos'
}

if (
idLike.includes('centos') ||
idLike.includes('fedora') ||
Expand Down
2 changes: 2 additions & 0 deletions src/packages/get-platform/src/platforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export type Platform =
| 'freebsd'
| 'openbsd'
| 'netbsd'
| 'nixos'
| 'arm'

export const platforms = [
Expand All @@ -23,6 +24,7 @@ export const platforms = [
'freebsd',
'openbsd',
'netbsd',
'nixos',
'arm',
]

Expand Down

0 comments on commit 2f1948a

Please sign in to comment.