diff --git a/.gitignore b/.gitignore index e68238d..056e6d3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ dist/ /stl *.exe /completions +/result diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..bb1d357 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1772624091, + "narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "80bdc1e5ce51f56b19791b52b2901187931f5353", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..690396d --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs?ref=nixos-unstable"; + }; + + outputs = + { nixpkgs, ... }: + let + lib = nixpkgs.lib; + forEachSystem = + f: + builtins.foldl' lib.recursiveUpdate { } ( + map f [ + "aarch64-linux" + "aarch64-darwin" + "x86_64-darwin" + "x86_64-linux" + ] + ); + in + forEachSystem ( + system: + let + pkgs = nixpkgs.legacyPackages.${system}; + in + { + packages.${system} = rec { + stl = pkgs.callPackage ./nix/package.nix { }; + default = stl; + }; + } + ); +} diff --git a/nix/package.nix b/nix/package.nix new file mode 100644 index 0000000..c0ada74 --- /dev/null +++ b/nix/package.nix @@ -0,0 +1,28 @@ +{ + lib, + buildGoModule, + go_1_25, +}: + +let + manifest = builtins.fromJSON (builtins.readFile ../.release-please-manifest.json); +in +buildGoModule rec { + pname = "stl"; + version = manifest."."; + + vendorHash = "sha256-OWfYAhV9jFuRTMtjjMdut2htFcYzjDl/RqgzesOBptk="; + + src = ../.; + + nativeBuildInputs = [ go_1_25 ]; + + doCheck = false; + + meta = { + description = "The official CLI for the Stainless REST API"; + homepage = "https://github.com/stainless-api/stainless-api-cli"; + license = lib.licenses.asl20; + mainProgram = pname; + }; +}