Commands & Regeneration
sbtix-gen, sbtix-gen-all2, and lockfile maintenance
Sbtix commands
sbtix- loads the sbtix global plugin and launches sbt. Setssbt.global.basedirectory to$HOME/.sbtix.sbtix-gen- generatesrepo.nixlockfiles (including nestedproject/**/repo.nixlayers as needed). Internally runs:sbtix genNix.sbtix-gen-all- kept for backwards compatibility. Internally runs:sbtix genNix.sbtix-gen-all2- generatesrepo.nixlockfiles (including nestedproject/**/repo.nixlayers) and runsgenCompositionto rendersbtix-generated.nix. Internally runs:sbtix genComposition.
By default, sbtix keeps verbose resolver diagnostics off for performance. To enable the full [SBTIX_DEBUG] output, set SBTIX_DEBUG=1 (or pass -Dsbtix.debug=true).
By default, generated locks include main artifacts plus the tests and sources classifier artifacts, and skip javadoc jars to avoid extra downloads. To include javadocs, add this to your sbt build:
sbtixArtifactClassifiers += "javadoc"
Set sbtixArtifactClassifiers := Seq.empty if you only want main artifacts.
Typical regeneration flow
Choose the regeneration flow that matches your Nix build entry point:
Flake-native helper builds: run
sbtix-gento regenerate everyrepo.nixlayer (repo.nix,project/repo.nix,project/project/repo.nix). Commit those lockfiles so CI and teammates get the same dependencies. This is the usual flow when your flake imports${sbtix}/plugin/nix-exprs/sbtix.nixand callsbuildSbtProgram,buildSbtLibrary, orbuildSbtProjectitself.Generated composition builds: run
sbtix-gen-all2to regenerate therepo.nixlayers and rungenCompositionto rendersbtix-generated.nix. Commit the generated composition files only when your project imports them as part of its build.For generated composition builds, if you did not use
sbtix-gen-all2, runsbtix genCompositionto rendersbtix-generated.nixusing the shared template.When sbtix is run from a flake-provided binary (or when
SBTIX_SOURCE_URL,SBTIX_SOURCE_REV, andSBTIX_SOURCE_NAR_HASHare set), the generated file embeds a pinnedbuiltins.fetchTree/fetchgitblock that points back to the exact sbtix revision you used for generation. This keeps flake evaluation pure.If those pins are not available, sbtix cannot emit a portable, flake-pure-safe source reference. In that case, regenerate using a flake-provided sbtix (or provide the pins) before running
nix buildin a downstream flake.
Commit the refreshed
repo.nixfiles (and any generated.nixfiles that your build actually imports, e.g.sbtix-generated.nix) before runningnix build.