beads/flake.nix
Patrick Farrell 51dc5ffed6 feat: add 'beads' alias for bd command during installation
Add a 'beads' symlink/alias that points to the 'bd' binary across all
installation methods, allowing users to invoke the tool using either
'bd' or 'beads'.

Changes:
- Makefile: Create 'beads' symlink in install target
- scripts/install.sh: Add create_beads_alias function, call it in all
  three installation paths (release download, go install, build from source)
- flake.nix: Add 'beads' symlink in Nix package installPhase
- install.ps1: Add Create-BeadsAlias function for Windows (creates a copy
  since symlinks require admin privileges)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:19:00 +00:00

97 lines
2.9 KiB
Nix

{
description = "beads (bd) - An issue tracker designed for AI-supervised coding workflows";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
]
(
system:
let
pkgs = nixpkgs.legacyPackages.${system};
bdBase = pkgs.callPackage ./default.nix { inherit pkgs self; };
# Wrap the base package with shell completions baked in
bd = pkgs.stdenv.mkDerivation {
pname = "beads";
version = bdBase.version;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp ${bdBase}/bin/bd $out/bin/bd
# Create 'beads' alias symlink
ln -s bd $out/bin/beads
# Generate shell completions
mkdir -p $out/share/fish/vendor_completions.d
mkdir -p $out/share/bash-completion/completions
mkdir -p $out/share/zsh/site-functions
$out/bin/bd completion fish > $out/share/fish/vendor_completions.d/bd.fish
$out/bin/bd completion bash > $out/share/bash-completion/completions/bd
$out/bin/bd completion zsh > $out/share/zsh/site-functions/_bd
'';
meta = bdBase.meta;
};
in
{
packages = {
default = bd;
# Keep separate completion packages for users who only want specific shells
fish-completions = pkgs.runCommand "bd-fish-completions" { } ''
mkdir -p $out/share/fish/vendor_completions.d
ln -s ${bd}/share/fish/vendor_completions.d/bd.fish $out/share/fish/vendor_completions.d/bd.fish
'';
bash-completions = pkgs.runCommand "bd-bash-completions" { } ''
mkdir -p $out/share/bash-completion/completions
ln -s ${bd}/share/bash-completion/completions/bd $out/share/bash-completion/completions/bd
'';
zsh-completions = pkgs.runCommand "bd-zsh-completions" { } ''
mkdir -p $out/share/zsh/site-functions
ln -s ${bd}/share/zsh/site-functions/_bd $out/share/zsh/site-functions/_bd
'';
};
apps.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/bd";
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
go
git
gopls
gotools
golangci-lint
sqlite
];
shellHook = ''
echo "beads development shell"
echo "Go version: $(go version)"
'';
};
}
);
}