diff --git a/README.md b/README.md index 92fe63a..26e68b9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,12 @@ brew tap ruimarinho/tap brew install gsts ``` +### nix flakes + +```shell +nix shell github:ruimarinho/gsts +``` + ### Other Platforms Install the package via `npm`: diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..42f7d07 --- /dev/null +++ b/flake.lock @@ -0,0 +1,77 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1695194023, + "narHash": "sha256-UYkG8SIcSDNczkabVRpJ9Xq35dyFA3FsJgRucfqlIzk=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "8acedb7656bedb347dc5b6b673fa4c497a8838a1", + "type": "github" + }, + "original": { + "owner": "nixos", + "repo": "nixpkgs", + "type": "github" + } + }, + "npmlock2nixSrc": { + "flake": false, + "locked": { + "lastModified": 1673447413, + "narHash": "sha256-sJM82Sj8yfQYs9axEmGZ9Evzdv/kDcI9sddqJ45frrU=", + "owner": "nix-community", + "repo": "npmlock2nix", + "rev": "9197bbf397d76059a76310523d45df10d2e4ca81", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "npmlock2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "npmlock2nixSrc": "npmlock2nixSrc" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..cac11c2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,59 @@ +{ + description = "gsts: AWS STS credentials via Google Workspace"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:nixos/nixpkgs"; + npmlock2nixSrc = { + url = "github:nix-community/npmlock2nix"; + flake = false; + }; + }; + + outputs = { self, nixpkgs, npmlock2nixSrc, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + config.permittedInsecurePackages = [ + "nodejs-16.20.2" + ]; + }; + + npmlock2nix = import npmlock2nixSrc { inherit pkgs; lib = pkgs.lib; }; + + in rec { + packages.gsts = npmlock2nix.v2.build { + src = ./.; + installPhase = '' + mkdir -p $out/bin + cp -r * $out + ln -sf $out/index.js $out/bin/gsts + ''; + + node_modules_attrs = { + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = 1; + }; + + buildCommands = []; + }; + + defaultPackage = self.packages.${system}.gsts; + + overlays = final: prev: { + inherit (packages) gsts; + }; + + devShell = pkgs.mkShell { + + CHROMIUM_PATH = "${pkgs.chromium}/bin/chromium"; + + packages = [ + defaultPackage + pkgs.chromium + ]; + }; + } + ); +}