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

Add csfml package #33000

Merged
merged 4 commits into from Dec 28, 2017
Merged

Add csfml package #33000

merged 4 commits into from Dec 28, 2017

Conversation

jpdoyle
Copy link
Contributor

@jpdoyle jpdoyle commented Dec 23, 2017

Motivation for this change

I needed this library, and it was not in nixpkgs.

Things done

Tested by running rust-sfml examples, which depend on csfml.

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

version = "2.4";
in

stdenv.mkDerivation rec {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that rec is not needed.

stdenv.mkDerivation rec {
name = "csfml-${version}";
src = fetchurl {
url = "https://github.com/SFML/CSFML/archive/${version}.tar.gz";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use fetchFromGitHub for this kind of URLs: the archive may get regenerated, which may invalidate the hash.

Copy link
Contributor Author

@jpdoyle jpdoyle Dec 23, 2017

Choose a reason for hiding this comment

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

Is the preferred choice of rev for this a tag (in this case, "${version}", or "2.4") or a commit hash?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm attempting to revise this patch to use fetchFromGithub, but I'm seeing the following error:

these derivations will be built:
  /nix/store/57si6znxrp5r6s81m50mxj5pddm414hh-source.drv
  /nix/store/7pkcj3k8ln1zhdpj5ph1599wmb0p93hz-csfml-2.4.drv
building path(s) ‘/nix/store/hr9zs38gy9axf3jqxl49d6580md36wil-source’

trying https://github.com/SFML/CSFML/archive/b5facb85d13bff451a5fd2d088a97472a685576c.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   152    0   152    0     0    152      0 --:--:-- --:--:-- --:--:--   894
100  123k  100  123k    0     0   123k      0  0:00:01 --:--:--  0:00:01 1233k
unpacking source archive /tmp/nix-build-source.drv-0/b5facb85d13bff451a5fd2d088a97472a685576c.tar.gz
output path ‘/nix/store/hr9zs38gy9axf3jqxl49d6580md36wil-source’ has r:sha256 hash ‘1q716gd7c7jlxzwpq5z4rjj5lsrn71ql2djphccdf9jannllqizn’ when ‘01cj7fzbdi8xsmwfdawwd00x81pv94fzmm6pqgp9d3973f3zrh92’ was expected
cannot build derivation ‘/nix/store/7pkcj3k8ln1zhdpj5ph1599wmb0p93hz-csfml-2.4.drv’: 1 dependencies couldn't be built
error: build of ‘/nix/store/7pkcj3k8ln1zhdpj5ph1599wmb0p93hz-csfml-2.4.drv’ failed
/run/current-system/sw/bin/nix-shell: failed to build all dependencies

The hash it mentions not matching (01cj7fzbdi8xsmwfdawwd00x81pv94fzmm6pqgp9d3973f3zrh92) doesn't appear anywhere in my package, so I'm confused about what I've screwed up. I assume that it's a problem with the sha256sum value I added (22c1fc871b278d96eec3d7d4fa1d49fb06d401689cabe678d51dc5b6be3b9205, as obtained by running wget http://github.com/SFML/CSFML/archive/b5facb85d13bff451a5fd2d088a97472a685576c.tar.gz && sha256sum b5facb85d13bff451a5fd2d088a97472a685576c.tar.gz), but I don't understand what could have gone wrong.

url = "https://github.com/SFML/CSFML/archive/${version}.tar.gz";
sha256 = "4e3d9a03afafbd3a507c39457a7619b68616ec79e870b975e09665e924f9c4c6";
};
#preInstall = "echo 'SFML dir:' '${sfml}'";
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove such debug comments.

#preInstall = "echo 'SFML dir:' '${sfml}'";
buildInputs = [ cmake sfml ];
cmakeFlags = [ "-DCMAKE_MODULE_PATH=${sfml}/share/SFML/cmake/Modules/"
"-DSFML_INSTALL_PKGCONFIG_FILES=yes"
Copy link
Contributor

Choose a reason for hiding this comment

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

This variable is not used.

It is written in C++, and has bindings for various languages such as C, .Net, Ruby, Python.
'';
license = licenses.zlib;
maintainers = [ maintainers.astsmtl ];
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this you, @jpdoyle?

'';
license = licenses.zlib;
maintainers = [ maintainers.astsmtl ];
platforms = platforms.linux;
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems to build fine on darwin as well.

@@ -10826,6 +10826,7 @@ with pkgs;
simp_le = callPackage ../tools/admin/simp_le { };

sfml = callPackage ../development/libraries/sfml { };
csfml = callPackage ../development/libraries/csfml { };
Copy link
Contributor

Choose a reason for hiding this comment

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

The alphabetical order is usually preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figure it's a good idea to group these together because csfml is just a binding for sfml, much like cppzmq and czmq for zeromq. I can definitely make this change if it's a strong preference though.

@grahamc
Copy link
Member

grahamc commented Dec 23, 2017

@GrahamcOfBorg eval

(sorry for the noise, master was broken by a merge)

@jpdoyle
Copy link
Contributor Author

jpdoyle commented Dec 28, 2017

@vbgl have my revisions addressed your concerns?

@vbgl vbgl merged commit e9886dd into NixOS:master Dec 28, 2017
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

5 participants