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
endgame-singularity: init at 0.30c #45057
Conversation
# Tell it where to find python libraries | ||
# Also cd to the same directory as the code, since it uses relative paths | ||
postFixup = '' | ||
makeWrapper "$out/share/singularity.py" "$out/bin/singularity" \ |
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.
Is the exe name ok or should I change it to endgame-singularity
? Most distros and the source itself use just singularity
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.
Since you already add a wrapper here, you could just merge this with the shebang change.
I think the name is fine, especially if the official docs and other distros do the same.
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.
We do already have one other package with the same name: https://github.com/singularityware/singularity
But I guess conflicts can't be entirely avoided. Its your call. Changing the name from the upstream default might cause confusion.
postPatch = '' | ||
echo '#!${python2Packages.python}/bin/python'\ | ||
$'\n'$(cat singularity-${version}/singularity.py)\ | ||
> singularity-${version}/singularity.py |
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.
Will this cause problems? Should I use sponge
?
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 don't know sponge
. Maybe it would be easier and nicer to just add a wrapper script endgame-singularity
that just calls ${python2Packages.python}/bin/python $out/bin/singularity.py
or something?
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 managed to do it nicely with --add-flags
format = "other"; | ||
|
||
srcs = | ||
[ |
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.
Small style nitpick: I'd prefer if you included the opening ´[in the line before. So
srcs = [`. But since we don't have an official style guide and pretty much anybody just does whatever they want, you can keep it the way it is if you prefer.
]; | ||
sourceRoot = "."; | ||
|
||
buildInputs = [ unzip ]; # The music is zipped |
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.
This should be nativeBuildInputs
. The difference is that nativeBuildInputs
are used exclusively at build time. That is important for cross-compilation.
Similar to above comment, my style preference is one line per item for most lists. It makes for cleaner diffs when dependencies change and easier reordering.
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.
Also better for adding comments to individual items.
sourceRoot = "."; | ||
|
||
buildInputs = [ unzip ]; # The music is zipped | ||
propagatedBuildInputs = with python2Packages; [ python pygame numpy ]; |
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 don't think python
should be in this list.
postPatch = '' | ||
echo '#!${python2Packages.python}/bin/python'\ | ||
$'\n'$(cat singularity-${version}/singularity.py)\ | ||
> singularity-${version}/singularity.py |
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 don't know sponge
. Maybe it would be easier and nicer to just add a wrapper script endgame-singularity
that just calls ${python2Packages.python}/bin/python $out/bin/singularity.py
or something?
''; | ||
|
||
installPhase = '' | ||
install -Dm755 singularity-${version}/singularity.py $out/share/singularity.py |
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 quote all shell variables, including $out
in these couple of lines.
# Tell it where to find python libraries | ||
# Also cd to the same directory as the code, since it uses relative paths | ||
postFixup = '' | ||
makeWrapper "$out/share/singularity.py" "$out/bin/singularity" \ |
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.
Since you already add a wrapper here, you could just merge this with the shebang change.
I think the name is fine, especially if the official docs and other distros do the same.
# Tell it where to find python libraries | ||
# Also cd to the same directory as the code, since it uses relative paths | ||
postFixup = '' | ||
makeWrapper "$out/share/singularity.py" "$out/bin/singularity" \ |
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.
We do already have one other package with the same name: https://github.com/singularityware/singularity
But I guess conflicts can't be entirely avoided. Its your call. Changing the name from the upstream default might cause confusion.
|
||
meta = { | ||
homepage = "http://www.emhsoft.com/singularity/"; | ||
description = "A simulation of a true AI. Go from computer to computer, pursued by the entire world. Keep hidden, and you might have a chance"; |
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.
This is a bit too long for description
. Please split it into description
and longDescription
. It looks like the first sentence may be a good description
, the rest may be longDescription
. description
should not have a dot at the end. Maybe use A game about a true AI
to make clear it is a game.
''; | ||
|
||
meta = { | ||
homepage = "http://www.emhsoft.com/singularity/"; |
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 quoting is unnecessary here, nix has a URL type.
141a1b8
to
93116db
Compare
@timokau all done |
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.
Thanks for making the changes :)
# Also cd to the same directory as the code, since it uses relative paths | ||
postFixup = '' | ||
makeWrapper "${python}/bin/python" "$out/bin/endgame-singularity" \ | ||
--set PYTHONPATH "$PYTHONPATH" \ |
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.
Setting pythonpath should not be necessary with buildPythonApplication
. Does it fail without that?
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.
buildPythonApplication wraps exes only in certain cases. This is not one of them, since the package type is other and we don't have anything in $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.
Maybe it would be a little more beautiful to just symlink $out/share/singularity.py
to $out/bin/endgame-singularity
in the installPhase
and then add --run ...
to makeWrapperArgs
. Would that work? However, I think it's also ok as it is.
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.
This use of makeWrapper
is officially documented in the nixpkgs manual. The symlink does not work since imports are relative
makeWrapper "${python}/bin/python" "$out/bin/endgame-singularity" \ | ||
--set PYTHONPATH "$PYTHONPATH" \ | ||
--run "cd \"$out/share\"" \ | ||
--add-flags "$out/share/singularity.py" |
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.
Out of curiosity (not familiar with that flag): What does ´--add-flags` actually do?
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.
Well... it adds a flag :)
Note that the wrapped exe isn't anymore singularity.py
. Now I wrap the python exe and tell it what to execute using --add-flag
.
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.
Oh, I didn't notice that. But it is unfortunate if that defeats buildPythonPkgs
automatic patching. PYTHONPATH
is also less performant than buildPythonEnv
, although that probably doesn't matter much with a small amount of dependencies.
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.
Well, not that much of a loss since we have to wrap anyway
@@ -19578,6 +19578,8 @@ with pkgs; | |||
|
|||
EmptyEpsilon = callPackage ../games/empty-epsilon { }; | |||
|
|||
endgame-singularity = callPackage ../games/endgame-singularity { }; | |||
|
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.
Same here: @domenkozar should this be in python-packages
?
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.
Same here too :)
edit: I'll copy it here for reference too: Nope, since it isn't a library (see the nixpkgs docs, python section)
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.
Actually I thought the same applied for the python2Packages
←→python.pkgs
+disabled=!isPy3
thing, but apparently I was wrong?
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.
Very possible I'm the one who is wrong, @domenkozar should know better.
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.
Same here, I actually meant to ping you @dotlambda. Somehow the matching first two letters got me confused 😁
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.
@fgaz is 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.
Is there a reason not to call this singularity
as most distros are doing? https://repology.org/metapackage/singularity/versions
The executable should probably also be renamed: https://www.archlinux.org/packages/community/any/singularity/files/
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.
Singularity is taken:
Attribute name: nixpkgs.singularity
Package name: singularity
Version: 2.5.1
Description: Designed around the notion of extreme mobility of compute and reproducible science, Singularity enables users to have full control of their operating system environment
For the same reason I also changed the exe name (not that bad since an exe name equal to the pkg name is not surprising). Should I revert it to singularity
?
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, seems reasonable.
# Tell it where to find python libraries | ||
# Also cd to the same directory as the code, since it uses relative paths | ||
postFixup = '' | ||
makeWrapper "${python}/bin/python" "$out/bin/endgame-singularity" \ |
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.
indentation
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.
and please use python.interpreter
@@ -0,0 +1,57 @@ | |||
{ stdenv, fetchurl, unzip, python }: |
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 make this use python2
explicitly.
pname = "endgame-singularity"; | ||
version = "0.30c"; | ||
format = "other"; | ||
disabled = !(python.isPy3 or true); |
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.
not needed
93116db
to
c97e7e8
Compare
Success on aarch64-linux (full log) Attempted: endgame-singularity Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: endgame-singularity Partial log (click to expand)
|
# This is not an error: it needs both compilation rounds | ||
buildPhase = '' | ||
python -m compileall "singularity-${version}" | ||
python -O -m compileall "singularity-${version}" |
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.
python2.interpreter
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.
done
c97e7e8
to
46fcc11
Compare
Success on aarch64-linux (full log) Attempted: endgame-singularity Partial log (click to expand)
|
Success on x86_64-linux (full log) Attempted: endgame-singularity Partial log (click to expand)
|
Motivation for this change
A game about strong AI
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)