Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
# Build directories
package

# Standalone binary compiled by npm run build:standalone
seam

# Nix build results
result
result-*

# Shell completions generated on prepack
completions

Expand Down
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Alternatively, download a standalone binary for your platform from the
Inc. Apple Developer ID and notarized by Apple, so macOS runs them without a
Gatekeeper prompt.

After a manual download, install the shell completions with
After a manual download, install the [shell completion] with

```
$ seam completion --install
Expand All @@ -97,12 +97,27 @@ $ cd seam-bin
$ makepkg -si
```

The AUR and Homebrew packages install [shell completion] themselves. After an
npm or manual install, run `seam completion --install`.
### Nix

Run the CLI without installing it with [Nix] with

```
$ nix run github:seamapi/cli
```

Install it into your profile with

```
$ nix profile install github:seamapi/cli
```

The flake compiles the standalone binary from source for `x86_64-linux`,
`aarch64-linux`, and `aarch64-darwin`.

[aur]: https://aur.archlinux.org/packages/seam-bin
[Homebrew]: https://formulae.brew.sh/cask/seam
[latest GitHub release]: https://github.com/seamapi/cli/releases/latest
[Nix]: https://nixos.org/
[npm]: https://www.npmjs.com/
[Seam Wizard]: https://github.com/seamapi/wizard
[shell completion]: #shell-completion
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
description = "A command-line interface (CLI) for interacting with the Seam API.";

inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};

outputs =
{ nixpkgs, ... }:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
];
forEachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
in
{
packages = forEachSystem (pkgs: rec {
seam = pkgs.callPackage ./package.nix { };
default = seam;
});
};
}
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
"build:ts": "tsc --project tsconfig.build.json",
"prebuild:ts": "del 'index.*' bin lib",
"postbuild:ts": "tsc-alias --project tsconfig.build.json",
"build:standalone": "bun build src/bin/cli.ts --compile --minify --outfile seam",
"prebuild:standalone": "npm run prepack",
"typecheck": "tsc",
"test": "vitest run --coverage",
"pretest": "tsx src/index.ts",
Expand Down
54 changes: 54 additions & 0 deletions package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
lib,
stdenv,
bun,
buildNpmPackage,
importNpmLock,
installShellFiles,
}:

buildNpmPackage {
pname = "seam";
version = (lib.importJSON ./package.json).version;

src = lib.cleanSource ./.;

npmDeps = importNpmLock { npmRoot = ./.; };
npmConfigHook = importNpmLock.npmConfigHook;

nativeBuildInputs = [
bun
installShellFiles
];
npmBuildScript = "build:standalone";

installPhase = ''
runHook preInstall

install -Dm755 seam -t $out/bin

runHook postInstall
'';

postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
installShellCompletion --cmd seam \
--bash <($out/bin/seam completion --loader bash) \
--fish <($out/bin/seam completion --loader fish) \
--zsh <($out/bin/seam completion --loader zsh)
'';

# The executable is the Bun runtime with the JavaScript bundle appended, so
# rewriting the ELF loses the bundle: stripped it runs as plain Bun,
# patchelfed it segfaults.
dontStrip = true;
dontPatchELF = true;

meta = {
description = "Command-line interface (CLI) for interacting with the Seam API";
homepage = "https://github.com/seamapi/cli";
changelog = "https://github.com/seamapi/cli/releases";
license = lib.licenses.mit;
mainProgram = "seam";
platforms = bun.meta.platforms;
};
}
Loading