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

fix nix-build invocation in non-flake builds #272

Merged
merged 2 commits into from
Jun 12, 2024

Conversation

stuebinm
Copy link
Contributor

@stuebinm stuebinm commented May 7, 2024

The drvpath^out syntax is only part of nix build, not nix-build. The latter still behaves as before Nix 2.15 and produces the outPath, but produces an error if one attempts to call it the same way as nix build.

@PhilTaken
Copy link
Collaborator

I wonder if we could set up some nixos tests to make sure there are no regressions. Would you mind looking into it?

stuebinm added a commit to stuebinm/deploy-rs that referenced this pull request May 15, 2024
this adds a nixos vm test doing a deploy on a nix which does not have
flakes enabled, to guard against this breaking as it has done before [1].

The existing test infrastructure is changed slightly to make enabling
flakes configurable inside the vm's config.

[1] serokell#272
stuebinm added a commit to stuebinm/deploy-rs that referenced this pull request May 15, 2024
this adds a nixos vm test doing a deploy on a nix which does not have
flakes enabled, to guard against this breaking as it has done before [1].

The existing test infrastructure is changed slightly to make enabling
flakes configurable inside the vm's config.

[1] serokell#272
@stuebinm
Copy link
Contributor Author

@PhilTaken I've attempted to write a test for this (changing the existing test setup slightly to allow for non-flake-enabled nix inside the vms & their configuration, and adding a flake-compat shim).

However, it seems to hang on the deploy step for me for an unreasonable amount of time. I'm unsure if this is an actual issue in the test — the existing tests using flakes likewise take very long, although they do eventually succeed.

I might have another look at this later, when I have access to more powerful hardware than my laptop.

stuebinm added a commit to stuebinm/deploy-rs that referenced this pull request Jun 11, 2024
this adds a nixos vm test doing a deploy on a nix which does not have
flakes enabled, to guard against this breaking as it has done before [1].

The existing test infrastructure is changed slightly to make enabling
flakes configurable inside the vm's config.

[1] serokell#272
@stuebinm
Copy link
Contributor Author

ah i forgot about doing this back then. so here we go:

the problem with the test seems to be that nix uses a surprising amount of memory to evaluate anything inside the vm (and more so without flakes); with the limit given in nix/tests/common.nix it becomes very slow and eventually either runs out of memory or into the default timeout of client.succeed() and then aborts. With an increased memory limit for the client vm, running the test takes a reasonable time (and the test succeeds).

I've also been using this patch locally for over a month now to deploy a couple of my own machines.

The drvpath^out syntax is only part of `nix build', not `nix-build',
which still produces the outPath as it did before, but errors out if
attempted to be called in the same way as `nix build'.
stuebinm added a commit to stuebinm/deploy-rs that referenced this pull request Jun 11, 2024
this adds a nixos vm test doing a deploy on a nix which does not have
flakes enabled, to guard against this breaking as it has done before [1].

The existing test infrastructure is changed slightly to make enabling
flakes configurable inside the vm's config.

[1] serokell#272
@rvem
Copy link
Member

rvem commented Jun 12, 2024

With an increased memory limit for the client vm, running the test takes a reasonable time (and the test succeeds).

Sounds like a good enough way to resolve the issue:)

nix/tests/default.nix Show resolved Hide resolved
this adds a nixos vm test doing a deploy on a nix which does not have
flakes enabled, to guard against this breaking as it has done before [1].

The existing test infrastructure is changed slightly to make enabling
flakes configurable inside the vm's config.

[1] serokell#272
@rvem rvem merged commit 3867348 into serokell:master Jun 12, 2024
8 checks passed
@stuebinm stuebinm deleted the fix-nonflake-build branch June 12, 2024 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants