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

doc/stdenv: how to mkDerivation with no srcs #23971

Closed
wants to merge 1 commit into from

Conversation

chris-martin
Copy link
Contributor

Copying the lesson learned from #23099 into the manual.

@mention-bot
Copy link

@chris-martin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @edolstra, @Ericson2314 and @pSub to be potential reviewers.

@vcunat
Copy link
Member

vcunat commented Mar 17, 2017

I think this rather belongs into the general part describing phases, as one may want to disable others as well. There is hint that you can override whole phases, so I imagine we might add that it's often useful to disable individual phases by namePhase = "true"; and add a note that preName and postName are also skipped in that case (or if you override whole phase). What do you think?

unpacked or copied. One of these must be set. To make a
derivation with no sources, you can avoid this requirement by
setting <literal>unpackPhase = "true";</literal> to replace the
default unpack phase with a noop.</para></listitem>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just use runCommand?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's the usual approach if you want to get rid of all phases.

@chris-martin
Copy link
Contributor Author

chris-martin commented Mar 17, 2017

However we fix it, the statement

One of these must be set.

must be qualified in some way, because right now it's flatly untrue? It's only true if you're using the default unpack phase.

@chris-martin
Copy link
Contributor Author

chris-martin commented Mar 17, 2017

I suppose we could also add a hint to the error message that you get when you don't specify src?

@vcunat
Copy link
Member

vcunat commented Mar 17, 2017

Anything related to a phase is void if you disable that phase or exchange its code – I'd think that doesn't need mentioning explicitly.

@chris-martin
Copy link
Contributor Author

I think user-friendly documentation explicitly addresses particular problems that people are likely to run into, in the specific place where they're likely to look for the solution - rather than requiring everyone to read the entire manual and having a complete understanding of how everything comes together.

@chris-martin
Copy link
Contributor Author

chris-martin commented Mar 17, 2017

@copumpkin Can you elaborate? I'll be happy to update the PR to suggest it, but I don't really know what "just use runCommand" means, and the manual doesn't mention runCommand at all.

@7c6f434c
Copy link
Member

There is runCommand function that takes three arguments (name, attributes to pass to mkDerivation — most will become environment variables by default, and the command to run). It doesn't do anything by default, so it is used when you want just to concatenate two files into the output file or something like that.

@chris-martin
Copy link
Contributor Author

It sounds like the consensus is that runCommand is the way to go here, so withdrawing this and putting in issue #25507 instead.

@Mic92
Copy link
Member

Mic92 commented May 11, 2017

mkDerivation without unpack phase is still useful because of its fixup phase: https://github.com/nixos-users/wiki/wiki/General-recommendations#package-simple-custom-scripts

@chris-martin
Copy link
Contributor Author

I don't know, I've lost all energy on this PR, it seems like an uphill battle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants