61 lines
2 KiB
Nix
61 lines
2 KiB
Nix
{
|
||
description = "Octofriend (synthetic-lab/octofriend) packaged for Nix/NixOS";
|
||
|
||
inputs = {
|
||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||
flake-utils.url = "github:numtide/flake-utils";
|
||
|
||
# Upstream source (not a flake)
|
||
octofriend = {
|
||
url = "github:synthetic-lab/octofriend";
|
||
flake = false;
|
||
};
|
||
};
|
||
|
||
outputs = { self, nixpkgs, flake-utils, octofriend }:
|
||
flake-utils.lib.eachDefaultSystem (system:
|
||
let
|
||
pkgs = import nixpkgs { inherit system; };
|
||
lib = pkgs.lib;
|
||
in
|
||
{
|
||
packages.default = pkgs.buildNpmPackage {
|
||
pname = "octofriend";
|
||
version = "git-${builtins.substring 0 7 (octofriend.rev or "unknown")}";
|
||
|
||
src = octofriend;
|
||
|
||
# First build will fail telling you the correct value. Paste it here.
|
||
npmDepsHash = "sha256-luAdTozvb0MTuh+xa5qhZPH8YflF9R4GtREAaR8m6Y8=";
|
||
|
||
# Ensure a modern node (octofriend is a Node CLI). :contentReference[oaicite:1]{index=1}
|
||
nodejs = pkgs.nodejs_22;
|
||
|
||
nativeBuildInputs = [ pkgs.makeWrapper ];
|
||
|
||
# If octofriend shells out to git/ssh/etc, keep PATH sane.
|
||
postInstall = ''
|
||
if [ -x "$out/bin/octofriend" ]; then
|
||
wrapProgram "$out/bin/octofriend" \
|
||
--prefix PATH : ${lib.makeBinPath [ pkgs.git pkgs.openssh ]}
|
||
fi
|
||
# Provide the short alias if upstream didn’t already.
|
||
if [ -x "$out/bin/octofriend" ] && [ ! -e "$out/bin/octo" ]; then
|
||
ln -s "$out/bin/octofriend" "$out/bin/octo"
|
||
fi
|
||
'';
|
||
|
||
meta = with lib; {
|
||
description = "Octofriend CLI coding assistant";
|
||
homepage = "https://github.com/synthetic-lab/octofriend";
|
||
license = licenses.mit;
|
||
mainProgram = "octofriend";
|
||
};
|
||
};
|
||
|
||
apps.default = flake-utils.lib.mkApp {
|
||
drv = self.packages.${system}.default;
|
||
exePath = "/bin/octofriend";
|
||
};
|
||
});
|
||
}
|