From 5fc6c380ca08b285eb047c27894104a9bbc45b29 Mon Sep 17 00:00:00 2001 From: lurchi Date: Wed, 14 Nov 2018 18:02:43 +0100 Subject: [PATCH] initial commit --- README.md | 33 ++++++++++++++ default.nix | 9 ++++ pkgs/gnunet/default.nix | 96 +++++++++++++++++++++++++++++++++++++++ pkgs/libgnurl/default.nix | 31 +++++++++++++ 4 files changed, 169 insertions(+) create mode 100644 README.md create mode 100644 default.nix create mode 100644 pkgs/gnunet/default.nix create mode 100644 pkgs/libgnurl/default.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..b1e1866 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Nixpgs overlay with GNUnet-related packages +This repository contains experimental packages related to [GNUnet](https://gnunet.org) for the Nix package manager. There exists a GNUnet package in the official nixpkgs repository but as GNUnet is still under heavy development, it is recommended to use a fairly recent version from the master branch of GNUnet's git repository. + +# Installation +We can install the overlay into the user environment like this: + +```shell +$ ln -s ~/.config/nixpkgs/overlays/gnunet-overlay.nix gnunet-overlay +``` +Now we can install the packages using + +```shell +$ nix-env -f '' -iA gnunet +``` + +To use the packages from the overlay system-wide (on NixOS) we can add this to our ``/etc/nixos/configuration.nix``: + +``` +{ config, pkgs, ... }: + +{ + ... + nixpkgs.overlays = [ + (import (fetchGit https://ulrich.earth/code/nixpkgs-gnunet)) + ]; + + environment.systemPackages = with pkgs; [ + ... + gnunet + ]; + ... +} +``` diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..525a807 --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +self: super: + +{ + libgnurl = super.callPackage ./pkgs/libgnurl { }; + + gnunet = super.callPackage ./pkgs/gnunet { + libgnurl = self.libgnurl; + }; +} diff --git a/pkgs/gnunet/default.nix b/pkgs/gnunet/default.nix new file mode 100644 index 0000000..88cadb3 --- /dev/null +++ b/pkgs/gnunet/default.nix @@ -0,0 +1,96 @@ +{ stdenv, fetchgit, libtool, pkgconfig, autoconf, automake, gettext, libgcrypt +, libidn2, zlib, libunistring, glpk, miniupnpc, libextractor, jansson, libgnurl +, sqlite, postgresql, mariadb, libmicrohttpd, iptables, nettools, gnutls +, unbound, coreutils, file, python3, texinfo +, makeWrapper +, withVerbose ? true +, withDocumentation ? false +, withSqlite ? true +, withPostgres ? false +, withMariadb ? false}: + +with stdenv.lib; + +let + rev = "75c351e315e2e8578ed7eaec4323d66d3db901d8"; +in +stdenv.mkDerivation rec { + name = "gnunet-${rev}"; + + src = fetchgit { + url = https://gnunet.org/git/gnunet.git; + inherit rev; + sha256 = "013sxqwffdj95a1dxbij71vmf642mn71z20gj044z3w9bznfnay4"; + }; + + phases = [ + "unpackPhase" "preConfigure" "configurePhase" "buildPhase" "installPhase" + "checkPhase" + ]; + + enableParallelBuilding = true; + + #doCheck = true; + + nativeBuildInputs = [ + makeWrapper libtool pkgconfig autoconf automake gettext coreutils file + python3 + ] + ++ optional withDocumentation texinfo; + + buildInputs = [ + libgcrypt libidn2 zlib libunistring glpk miniupnpc libextractor jansson + libgnurl libmicrohttpd iptables nettools gnutls unbound + ] + ++ optional withSqlite sqlite + ++ optional withPostgres postgresql + ++ optional withMariadb mariadb; + + configureFlags = + optional withVerbose "--enable-logging=verbose" + ++ optional (!withDocumentation) "--disable-documentation"; + + preConfigure = '' + substituteInPlace configure.ac --replace "/usr/sbin/iptables" "iptables" + substituteInPlace configure.ac --replace "/sbin/ifconfig" "ifconfig" + sh bootstrap + substituteInPlace configure --replace "/usr/bin/file" "file" + substituteInPlace configure --replace "/usr/bin/objformat" "objformat" + ''; + + /* FIXME: Tests must be run this way, but there are still a couple of + failures. */ + + checkPhase = + '' export GNUNET_PREFIX="$out" + export GNUNET_TMP="$TMPDIR" + export PATH="$out/bin:$PATH" + make -k check + ''; + + meta = with stdenv.lib; { + description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework"; + + longDescription = '' + GNUnet is a framework for secure peer-to-peer networking that + does not use any centralized or otherwise trusted services. A + first service implemented on top of the networking layer + allows anonymous censorship-resistant file-sharing. Anonymity + is provided by making messages originating from a peer + indistinguishable from messages that the peer is routing. All + peers act as routers and use link-encrypted connections with + stable bandwidth utilization to communicate with each other. + GNUnet uses a simple, excess-based economic model to allocate + resources. Peers in GNUnet monitor each others behavior with + respect to resource usage; peers that contribute to the + network are rewarded with better service. + ''; + + homepage = https://gnunet.org/; + + license = licenses.agpl3; + + maintainers = with maintainers; [ ]; + platforms = platforms.gnu ++ platforms.linux; + }; +} diff --git a/pkgs/libgnurl/default.nix b/pkgs/libgnurl/default.nix new file mode 100644 index 0000000..dd443ae --- /dev/null +++ b/pkgs/libgnurl/default.nix @@ -0,0 +1,31 @@ +{ stdenv, fetchurl, libtool, groff, perl, pkgconfig, python2, zlib, gnutls, + libidn2, libunistring, nghttp2, autoreconfHook }: + +stdenv.mkDerivation rec { + version = "7.61.1"; + + name = "libgnurl-${version}"; + + src = fetchurl { + url = "mirror://gnu/gnunet/gnurl-${version}.tar.gz"; + sha256 = "0y56k15vp3m2r8q6mnc6ivflwq9lv6npdhbbvxxcf4r8vwjhv91q"; + }; + + nativeBuildInputs = [ libtool groff perl pkgconfig python2 autoreconfHook ]; + + propagatedBuildInputs = [ gnutls zlib libidn2 libunistring nghttp2 ]; + + configureFlags = [ + "--disable-ntlm-wb" + "--without-ca-bundle" + "--with-ca-fallback" + ]; + + meta = with stdenv.lib; { + description = "A fork of libcurl used by GNUnet"; + homepage = https://gnunet.org/gnurl; + maintainers = with maintainers; [ falsifian vrthra ]; + platforms = platforms.linux; + license = licenses.curl; + }; +}