nixos/appflakes/octofriend/flake.nix
2025-12-18 18:32:51 -08:00

61 lines
1.9 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
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 = lib.fakeHash;
# 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 didnt 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";
};
});
}