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

sympow: init at 1.018.1 #38804

Merged
merged 1 commit into from
Apr 21, 2018
Merged

sympow: init at 1.018.1 #38804

merged 1 commit into from
Apr 21, 2018

Conversation

timokau
Copy link
Member

@timokau timokau commented Apr 11, 2018

Motivation for this change

Package sympow.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

}:

stdenv.mkDerivation rec {
pname = "sympow";
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

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 = ''
Copy link
Member

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"
Copy link
Member

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
Copy link
Member

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.

Copy link
Member Author

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).

Copy link
Member

Choose a reason for hiding this comment

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

Documentation is always good!

@timokau timokau force-pushed the sympow-init branch 2 times, most recently from 9370006 to f8fbe0f Compare April 20, 2018 08:28
@Mic92 Mic92 merged commit 38d6dec into NixOS:master Apr 21, 2018
@timokau timokau deleted the sympow-init branch April 22, 2018 17:08
--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"
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

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

Fixed in bae15c8

Copy link
Member Author

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?

Copy link
Member

@infinisil infinisil Apr 26, 2018

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

Copy link
Member

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.

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.

7 participants