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

nix/copy: Add `--build` option #3762

Closed
wants to merge 1 commit into from
Closed

nix/copy: Add `--build` option #3762

wants to merge 1 commit into from

Conversation

@Ma27
Copy link
Member

Ma27 commented Jun 29, 2020

In 9570036 nix copy was changed to
actually build derivations that are supposed to be copied.

This is not desirable though if you want to copy derivations for a
different platform architecture to a remote store.

This patch only builds drvs if nix copy --build is specified,
otherwise it falls back to the previous behavior where drvs were only
copied.

cc @edolstra

In 9570036 `nix copy` was changed to
actually build derivations that are supposed to be copied.

This is not desirable though if you want to copy derivations for a
different platform architecture to a remote store.

This patch only builds drvs if `nix copy --build` is specified,
otherwise it falls back to the previous behavior where drvs were only
copied.
@ajs124
Copy link
Member

ajs124 commented Jun 29, 2020

Fixes #3696

@Ma27
Copy link
Member Author

Ma27 commented Jul 4, 2020

@edolstra anything missing to get this merged?

@edolstra
Copy link
Member

edolstra commented Jul 15, 2020

Not sure this works since RealiseMode only affects what gets build, not what gets copied. In any case, if you just want to copy the .drv, then the new --derivation flag can be used for that (3624c04).

@Ma27
Copy link
Member Author

Ma27 commented Jul 15, 2020

Not sure this works since RealiseMode only affects what gets build, not what gets copied

Well, I don't want to get anything built when using nix copy. When I do nix copy /nix/store/foobar.drv --to ssh://remote-host, I don't expect a build process. Especially since the .drv file is for the architecture on ssh://remote-host (which is not necessarily the same I have locally).

@Ericson2314
Copy link
Member

Ericson2314 commented Jul 16, 2020

I kinda of wish /nix/store/foo-bar.drv always meant just the drv, and one instead used /nix/store/foo-bar.drv!name or /nix/store/foo-bar.drv!* (for all of them, if we want) to mean the outputs.

I wanted this not with nix copy, but nix why-depends, when I want to do all the same logic but on the drvs themselves.

@Ma27
Copy link
Member Author

Ma27 commented Jul 17, 2020

While nix copy --derivation works as expected, we probably want to implement a patch which automatically sets the proper OperateOn-value depending on the input (e.g. OperateOn::Derivation for a .drv-file by default).

Apart from that this is just a discussion about which default should be preferred and I don't think that we'll reach an actual agreement there. Another idea would be to allow user-defined aliases for certain commands such like git does.

Will close this for now, as mentioned, a better solution would be to depend on the .drv file (@edolstra what do you think about this?).

@Ma27 Ma27 closed this Jul 17, 2020
@Ma27 Ma27 deleted the Ma27:nix-copy-flakes branch Jul 17, 2020
@dasJ
dasJ approved these changes Jul 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.