Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reference-lock-file option #80

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nix_fast_build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class Options:
out_link: str = "result"
result_format: ResultFormat = ResultFormat.JSON
result_file: Path | None = None
reference_lock_file: str | None = None

cachix_cache: str | None = None

Expand Down Expand Up @@ -266,6 +267,12 @@ async def parse_args(args: list[str]) -> Options:
default="json",
help="Format of the build result file",
)
parser.add_argument(
"--reference-lock-file",
type=str,
default=None,
help="Read the given lock file instead of `flake.lock` within the top-level flake.",
)

a = parser.parse_args(args)

Expand Down Expand Up @@ -322,6 +329,7 @@ async def parse_args(args: list[str]) -> Options:
out_link=a.out_link,
result_format=ResultFormat[a.result_format.upper()],
result_file=a.result_file,
reference_lock_file=a.reference_lock_file,
)


Expand Down Expand Up @@ -480,6 +488,8 @@ async def nix_eval_jobs(tmp_dir: Path, opts: Options) -> AsyncIterator[Process]:
f"{opts.flake_url}#{opts.flake_fragment}",
*opts.options,
]
if opts.reference_lock_file:
args.extend(["--reference-lock-file", opts.reference_lock_file])
if opts.skip_cached:
args.append("--check-cache-status")
if opts.remote:
Expand Down