initial octofriend flake

This commit is contained in:
Julian Sutter 2025-12-18 18:32:51 -08:00
parent bfd1d51370
commit 7fc42d321a
2 changed files with 62 additions and 0 deletions

View file

@ -0,0 +1,61 @@
{
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";
};
});
}

View file

@ -120,6 +120,7 @@
lshw # lshw
nvme-cli
smartmontools
ripgrep
];
services.flatpak.enable = true;