Files
josh-sync/flake.nix
T
sbproandClaude Sonnet 5 be4aef588d fix(josh-sync): expose yq directly in the consumer devenv module
devenvModules.default only added the wrapProgram-wrapped josh-sync binary,
whose bundled PATH (yq, jq, etc.) only applies while josh-sync itself runs.
Plain `yq` was never actually on PATH in a consumer's devenv shell, breaking
the manual `yq -i` config-editing commands the josh-sync skill's docs call
for. Adds pkgs.yq-go to the module's packages list directly. Bumps to v2.3.1.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TNXgcFWVgSh3wkQS55cCX6
2026-07-16 10:24:47 +01:00

92 lines
2.7 KiB
Nix

{
description = "josh-sync: bidirectional monorepo ↔ subrepo sync via josh-proxy";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = { self, nixpkgs }:
let
forAllSystems = nixpkgs.lib.genAttrs [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
in
{
packages = forAllSystems (system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = builtins.replaceStrings [ "\n" ] [ "" ] (builtins.readFile ./VERSION);
in
{
default = pkgs.stdenv.mkDerivation {
pname = "josh-sync";
inherit version;
src = ./.;
nativeBuildInputs = [ pkgs.makeWrapper pkgs.shellcheck ];
installPhase = ''
mkdir -p $out/{bin,lib}
cp VERSION $out/
cp lib/*.sh $out/lib/
cp bin/josh-sync $out/bin/
chmod +x $out/bin/josh-sync
wrapProgram $out/bin/josh-sync \
--set JOSH_SYNC_ROOT "$out" \
--prefix PATH : ${pkgs.lib.makeBinPath [
pkgs.bash
pkgs.git
pkgs.curl
pkgs.jq
pkgs.yq-go
pkgs.openssh
pkgs.coreutils
pkgs.findutils
pkgs.rsync
]}
'';
meta = {
description = "Bidirectional monorepo ↔ subrepo sync via josh-proxy";
license = pkgs.lib.licenses.mit;
mainProgram = "josh-sync";
};
};
});
# devenv module for consumers
#
# `self.packages.${pkgs.system}.default` is wrapProgram-wrapped, so its
# PATH additions (yq, jq, etc.) only apply while `josh-sync` itself is
# running — they don't reach the ambient devenv shell. Add yq-go
# directly so consumers can run the `yq -i` commands the josh-sync
# skill's config-editing docs call for (e.g. schema migrations),
# without needing a system-wide yq install.
devenvModules.default = { pkgs, ... }: {
packages = [ self.packages.${pkgs.system}.default pkgs.yq-go ];
dotenv.disableHint = true;
};
# Dev shell for library contributors
devShells = forAllSystems (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.mkShell {
packages = [
pkgs.bash
pkgs.git
pkgs.curl
pkgs.jq
pkgs.yq-go
pkgs.openssh
pkgs.shellcheck
pkgs.bats
pkgs.rsync
];
};
});
};
}