diff options
author | ng0 <ng0@infotropique.org> | 2017-08-19 10:24:06 +0000 |
---|---|---|
committer | ng0 <ng0@infotropique.org> | 2017-08-19 10:24:06 +0000 |
commit | 2468776e9cd952364903c88e4ceba055dd2aff02 (patch) | |
tree | 5d9670d732501515571083c7567d7e880806418d /contrib/packages | |
parent | cf6497347f433d188a6c32f03f8d5c5fa83104de (diff) | |
download | gnunet-2468776e9cd952364903c88e4ceba055dd2aff02.tar.gz gnunet-2468776e9cd952364903c88e4ceba055dd2aff02.zip |
default.nix, gnunet-dev.nix: Move to contrib/packages/nix/.
Signed-off-by: ng0 <ng0@infotropique.org>
Diffstat (limited to 'contrib/packages')
-rw-r--r-- | contrib/packages/nix/default.nix | 78 | ||||
-rw-r--r-- | contrib/packages/nix/gnunet-dev.nix | 83 |
2 files changed, 161 insertions, 0 deletions
diff --git a/contrib/packages/nix/default.nix b/contrib/packages/nix/default.nix new file mode 100644 index 000000000..ffbcd4c44 --- /dev/null +++ b/contrib/packages/nix/default.nix | |||
@@ -0,0 +1,78 @@ | |||
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 | |||
43 | # or when using nix-shell: | ||
44 | # --argstr ccache_dir ~/.ccache | ||
45 | # | ||
46 | # and make sure the given directory is writable by the nixpkgs group when using nix-build or nix-env -i, | ||
47 | # or the current user when using nix-shell | ||
48 | # | ||
49 | |||
50 | { | ||
51 | pkgs ? null, | ||
52 | ccache_dir ? "", | ||
53 | }: | ||
54 | |||
55 | let | ||
56 | syspkgs = import <nixpkgs> { }; | ||
57 | pinpkgs = syspkgs.fetchFromGitHub { | ||
58 | owner = "NixOS"; | ||
59 | repo = "nixpkgs"; | ||
60 | |||
61 | # binary cache exists for revisions in https://nixos.org/releases/nixos/<release>/<build>/git-revision | ||
62 | rev = "c4469edac1fc1fa5e5b5aa2ceadeda8f3f92d30a"; # https://nixos.org/releases/nixos/16.09/nixos-16.09beta430.c4469ed/git-revision | ||
63 | sha256 = "1x6hmf815d5anfxrxl6iivfkk60q5qxa6waa9xnwhwkbc14rhvn9"; | ||
64 | }; | ||
65 | usepkgs = if null == pkgs then | ||
66 | import pinpkgs {} | ||
67 | else | ||
68 | if 0 == pkgs then | ||
69 | import <nixpkgs> { } | ||
70 | else | ||
71 | import pkgs {}; | ||
72 | stdenv = usepkgs.stdenvAdapters.keepDebugInfo usepkgs.stdenv; | ||
73 | |||
74 | in { | ||
75 | gnunet-dev = usepkgs.callPackage ./gnunet-dev.nix { | ||
76 | inherit ccache_dir; | ||
77 | }; | ||
78 | } | ||
diff --git a/contrib/packages/nix/gnunet-dev.nix b/contrib/packages/nix/gnunet-dev.nix new file mode 100644 index 000000000..89b65f6b4 --- /dev/null +++ b/contrib/packages/nix/gnunet-dev.nix | |||
@@ -0,0 +1,83 @@ | |||
1 | { stdenv, makeWrapper, pkgconfig, autoconf, automake, ccache, ccache_dir ? "" | ||
2 | , adns, curl, gettext, gmp, gnutls, gss, ncurses, openldap | ||
3 | , jansson, zlib, sqlite, mariadb, postgresql | ||
4 | , libextractor, libgcrypt, libgnurl, libidn, libmicrohttpd | ||
5 | , libpsl, libtool, libunistring, libxml2 | ||
6 | }: | ||
7 | |||
8 | stdenv.mkDerivation rec { | ||
9 | src = ./.; | ||
10 | name = "gnunet-dev"; | ||
11 | |||
12 | buildInputs = [ | ||
13 | makeWrapper pkgconfig autoconf automake ccache | ||
14 | adns curl gettext gmp gnutls gss ncurses openldap | ||
15 | jansson zlib sqlite mariadb postgresql | ||
16 | libextractor libgcrypt libgnurl libidn libmicrohttpd | ||
17 | libpsl libtool libunistring libxml2 | ||
18 | ]; | ||
19 | |||
20 | patchPhase = '' | ||
21 | if [ -e Makefile ]; then | ||
22 | make distclean | ||
23 | fi | ||
24 | ''; | ||
25 | |||
26 | NIX_CFLAGS_COMPILE = "-ggdb -O0"; | ||
27 | |||
28 | configureFlags = [ | ||
29 | "--enable-gcc-hardening" | ||
30 | "--enable-linker-hardening" | ||
31 | |||
32 | "--enable-poisoning" | ||
33 | "--enable-sanitizer" | ||
34 | "--enable-experimental" | ||
35 | "--enable-logging=verbose" | ||
36 | ]; | ||
37 | |||
38 | preConfigure = '' | ||
39 | ./bootstrap | ||
40 | configureFlags="$configureFlags --with-nssdir=$out/lib" | ||
41 | |||
42 | if [ -n "${ccache_dir}" ]; then | ||
43 | export CC='ccache gcc' | ||
44 | export CCACHE_COMPRESS=1 | ||
45 | export CCACHE_DIR="${ccache_dir}" | ||
46 | export CCACHE_UMASK=007 | ||
47 | fi | ||
48 | ''; | ||
49 | |||
50 | doCheck = false; | ||
51 | |||
52 | postInstall = '' | ||
53 | # Tests can be run this way | ||
54 | #export GNUNET_PREFIX="$out" | ||
55 | #export PATH="$out/bin:$PATH" | ||
56 | #make -k check | ||
57 | ''; | ||
58 | |||
59 | meta = with stdenv.lib; { | ||
60 | description = "GNU's decentralized anonymous and censorship-resistant P2P framework"; | ||
61 | |||
62 | longDescription = '' | ||
63 | GNUnet is a framework for secure peer-to-peer networking that | ||
64 | does not use any centralized or otherwise trusted services. A | ||
65 | first service implemented on top of the networking layer | ||
66 | allows anonymous censorship-resistant file-sharing. Anonymity | ||
67 | is provided by making messages originating from a peer | ||
68 | indistinguishable from messages that the peer is routing. All | ||
69 | peers act as routers and use link-encrypted connections with | ||
70 | stable bandwidth utilization to communicate with each other. | ||
71 | GNUnet uses a simple, excess-based economic model to allocate | ||
72 | resources. Peers in GNUnet monitor each others behavior with | ||
73 | respect to resource usage; peers that contribute to the | ||
74 | network are rewarded with better service. | ||
75 | ''; | ||
76 | |||
77 | homepage = https://gnunet.org/; | ||
78 | |||
79 | license = licenses.gpl3Plus; | ||
80 | platforms = platforms.gnu; | ||
81 | maintainers = with maintainers; [ ]; | ||
82 | }; | ||
83 | } | ||