fix rps
[oweals/gnunet.git] / default.nix
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 }