default.nix 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Nix package for GNUnet development
  2. #
  3. ## INSTALL
  4. #
  5. # To build and install the package in the user environment, use:
  6. #
  7. # $ nix-env -f . -i
  8. #
  9. ## BUILD ONLY
  10. #
  11. # To build the package and add it to the nix store, use:
  12. #
  13. # $ nix-build
  14. #
  15. ## SHELL
  16. #
  17. # To launch a shell with all dependencies installed in the environment, use one of the following:
  18. # $ nix-shell
  19. #
  20. # After entering nix-shell, build it:
  21. #
  22. # $ configurePhase
  23. # $ buildPhase
  24. #
  25. ## NIXPKGS
  26. #
  27. # For all of the above commands, nixpkgs to use can be set the following way:
  28. #
  29. # a) by default it uses nixpkgs pinned to a known working version
  30. #
  31. # b) use nixpkgs from the system:
  32. # --arg pkgs 0
  33. #
  34. # c) use nixpkgs at a given path
  35. # --arg pkgs /path/to/nixpkgs
  36. #
  37. ## CCACHE
  38. #
  39. # To enable ccache, use the following:
  40. #
  41. # --argstr ccache_dir /var/cache/ccache
  42. # or when using nix-shell:
  43. # --argstr ccache_dir ~/.ccache
  44. #
  45. # and make sure the given directory is writable by the nixpkgs group when using nix-build or nix-env -i,
  46. # or the current user when using nix-shell
  47. #
  48. {
  49. pkgs ? null,
  50. ccache_dir ? "",
  51. }:
  52. let
  53. syspkgs = import <nixpkgs> { };
  54. pinpkgs = syspkgs.fetchFromGitHub {
  55. owner = "NixOS";
  56. repo = "nixpkgs";
  57. # binary cache exists for revisions in https://nixos.org/releases/nixos/<release>/<build>/git-revision
  58. rev = "c4469edac1fc1fa5e5b5aa2ceadeda8f3f92d30a"; # https://nixos.org/releases/nixos/16.09/nixos-16.09beta430.c4469ed/git-revision
  59. sha256 = "1x6hmf815d5anfxrxl6iivfkk60q5qxa6waa9xnwhwkbc14rhvn9";
  60. };
  61. usepkgs = if null == pkgs then
  62. import pinpkgs {}
  63. else
  64. if 0 == pkgs then
  65. import <nixpkgs> { }
  66. else
  67. import pkgs {};
  68. stdenv = usepkgs.stdenvAdapters.keepDebugInfo usepkgs.stdenv;
  69. in {
  70. gnunet-dev = usepkgs.callPackage ./gnunet-dev.nix {
  71. inherit ccache_dir;
  72. };
  73. }