-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
sympow: init at 1.018.1 #38804
sympow: init at 1.018.1 #38804
Conversation
}: | ||
|
||
stdenv.mkDerivation rec { | ||
pname = "sympow"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need pname if you're only using it to set the name
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its more of a style choice, I prefer to have separate attributes for name and version. But I can understand that inconsistency might be a negative here. Do you want me to remove pname
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The standard way of doing this is not to define pname unless it's actively used for something.
]; | ||
|
||
configurePhase = '' | ||
./Configure # doesn't take any options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add runHook preConfigure
and runHook postConfigure
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that only needed when preConfigure
or postConfigure
are actually used? Hooks don't use those right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone needs to override something in a package, that can be done easily through the pre/post hooks. If you don't run them when you override a phase, they cannot be used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alright that makes sense. Is there a reason configurePhase
etc. are not defined somewhat like this:
configurePhase() {
runHook preConfigure
if [[ -n "$configurePhase" ]]; then
eval "$configurePhase";
else
# what the default configure phase does
fi
runHook postConfigure
}
That would remove this necessary boiler plate and would remove confusion about how to execut phases when using `nix-shell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sure there's a reason - I just don't know what it is! Your suggestion makes perfect sense to me but @vcunat and/or @Ericson2314 might be able to shed some light on the current state of affairs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. It's probably just because of history; I suspect it comes from beginnings of nixpkgs. In time it turned out you usually only want to override the inside and not pre/post, and now it's much more difficult to change such basic things.
./Configure # doesn't take any options | ||
''; | ||
|
||
installPhase = '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
runHook preInstall
and runHook postInstall
''; | ||
|
||
installPhase = '' | ||
mkdir -p "$out/bin" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can use install
directly instead of mkdir and cp
''; | ||
|
||
patches = [ | ||
# don't hardcode paths |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a comment, you can pass name = "do_not_hardcode_paths.patch
to fetchpatch
which also makes it easier to work with.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added names (but also kept the comments, as they offer more freedom for explanation than a filename).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Documentation is always good!
9370006
to
f8fbe0f
Compare
--run 'export SYMPOW_LOCAL="$HOME/.local/share/sympow"' \ | ||
--run 'if [ ! -d "$SYMPOW_LOCAL" ]; then | ||
mkdir -p "$SYMPOW_LOCAL" | ||
cp -r ${placeholder "out"}/share/sympow/* "$SYMPOW_LOCAL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use placeholder in nixpkgs. We need to stay compatible with people using Nix 1.11 for a while. I'm not sure why but this single instance apparently breaks nix-env -i nix-repl
, as reported on IRC. This should be fixed ASAP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in bae15c8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't know we're still maintaining compatibility. Is that documented somewhere? How long?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea for how long, but ther is a fil sthat specifies the minimum required nix version: https://github.com/NixOS/nixpkgs/blob/master/.version
Edit: whoops, meant https://github.com/NixOS/nixpkgs/blob/master/lib/minver.nix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, there's no date for it AFAIK. I personally think we shouldn't until 18.09 unless there's a good reason not to, while placeholders are nice it's generally pretty straightforward to work around the recursion in other ways.
Motivation for this change
Package sympow.
Things done
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)