{ description = "bird - fast X CLI for tweeting, replying, and reading"; inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs outputs = { self, ... }@inputs: let supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ]; forEachSupportedSystem = f: inputs.nixpkgs.lib.genAttrs supportedSystems ( system: f { inherit system; pkgs = import inputs.nixpkgs { inherit system; overlays = [ inputs.self.overlays.default ]; }; } ); in { overlays.default = final: prev: rec { bird = final.callPackage ( { fetchPnpmDeps, lib, makeWrapper, nodejs-slim_22, pnpm_10, pnpmConfigHook, stdenv, }: let packageJson = builtins.fromJSON (builtins.readFile ./package.json); pnpm = pnpm_10.override { nodejs-slim = nodejs-slim_22; }; in stdenv.mkDerivation (finalAttrs: { pname = "bird"; version = packageJson.version; src = lib.cleanSource ./.; pnpmDeps = fetchPnpmDeps { inherit (finalAttrs) pname version src; inherit pnpm; fetcherVersion = 4; pnpmInstallFlags = [ "--config.auto-install-peers=true" ]; hash = "sha256-nB6IPSG/2XSVJVNHwtDFVL3ocwVWEzmR7o3o3rNSKP0="; }; nativeBuildInputs = [ makeWrapper nodejs-slim_22 pnpm pnpmConfigHook ]; pnpmInstallFlags = [ "--config.auto-install-peers=true" ]; buildPhase = '' runHook preBuild ./node_modules/.bin/tsc node scripts/copy-dist-assets.js CI=true pnpm prune --prod --config.auto-install-peers=true find node_modules -xtype l -delete runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/lib/bird $out/bin cp -r dist node_modules package.json README.md CHANGELOG.md LICENSE $out/lib/bird/ chmod +x $out/lib/bird/dist/cli.js makeWrapper ${lib.getExe nodejs-slim_22} $out/bin/bird \ --add-flags "$out/lib/bird/dist/cli.js" runHook postInstall ''; meta = { description = packageJson.description; homepage = "https://bird.fast/"; license = lib.licenses.mit; mainProgram = "bird"; }; }) ) { }; nodejs = prev.nodejs_22; yarn = (prev.yarn.override { inherit nodejs; }); }; packages = forEachSupportedSystem ( { pkgs, ... }: { default = pkgs.bird; bird = pkgs.bird; } ); apps = forEachSupportedSystem ( { system, ... }: { default = { type = "app"; program = "${self.packages.${system}.default}/bin/bird"; meta.description = "Run bird"; }; } ); checks = forEachSupportedSystem ( { pkgs, ... }: { default = pkgs.bird; } ); devShells = forEachSupportedSystem ( { pkgs, system }: { default = pkgs.mkShellNoCC { packages = with pkgs; [ nodejs pnpm yarn bun self.formatter.${system} ]; }; } ); formatter = forEachSupportedSystem ({ pkgs, ... }: pkgs.nixfmt); }; }