This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
description = "bird - fast X CLI for tweeting, replying, and reading";
|
||||
|
||||
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
|
||||
|
||||
@@ -27,10 +27,107 @@
|
||||
in
|
||||
{
|
||||
overlays.default = final: prev: rec {
|
||||
nodejs = prev.nodejs;
|
||||
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 }:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user