try with local path

This commit is contained in:
lurchi 2019-06-28 17:43:56 +02:00
parent cb0dc2ddf4
commit a25ffd22e1
2 changed files with 58 additions and 34 deletions

View File

@ -12,23 +12,21 @@ let
'' ''
[PATHS] [PATHS]
SERVICEHOME = ${homeDir} SERVICEHOME = ${homeDir}
SUID_BINARY_PATH = ${config.security.wrapperDir}
[ARM] [ARM]
START_SYSTEM_SERVICES = YES START_SYSTEM_SERVICES = YES
START_USER_SERVICES = NO START_USER_SERVICES = NO
[DNS] [DNS]
HELPER_PATH = ${config.security.wrapperDir}/ #HELPER_PATH = ${config.security.wrapperDir}/
BINARY = ${config.security.wrapperDir}/gnunet-service-dns BINARY = ${config.security.wrapperDir}/gnunet-service-dns
[EXIT] #[EXIT]
HELPER_PATH = ${config.security.wrapperDir}/ #HELPER_PATH = ${config.security.wrapperDir}/
[NAT] #[VPN]
HELPER_PATH = ${config.security.wrapperDir}/ #HELPER_PATH = ${config.security.wrapperDir}/
[VPN]
HELPER_PATH = ${config.security.wrapperDir}/
${extraOptions} ${extraOptions}
''; '';
@ -59,6 +57,14 @@ in
example = literalExample "pkgs.gnunet_git"; example = literalExample "pkgs.gnunet_git";
}; };
nsswitch = mkOption {
default = false;
description = ''
Whether to use the GNU Name System for name resolution by enabling
the NSS module in nsswitch.conf
'';
};
extraOptions = mkOption { extraOptions = mkOption {
default = ""; default = "";
description = '' description = ''
@ -81,6 +87,7 @@ in
home = homeDir; home = homeDir;
createHome = true; createHome = true;
uid = config.ids.uids.gnunet; uid = config.ids.uids.gnunet;
shell = pkgs.bashInteractive;
}; };
users.groups = { users.groups = {
@ -137,13 +144,20 @@ in
}; };
}; };
system.nssModules = optional cfg.nsswitch cfg.package;
#environment.extraInit = ''
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${config.system.nssModules.path}
#'';
systemd.services.gnunet = { systemd.services.gnunet = {
description = "GNUnet"; description = "GNUnet";
after = [ "network.target" ]; after = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
path = [ cfg.package pkgs.miniupnpc ]; path = [ cfg.package pkgs.miniupnpc ];
environment.TMPDIR = "/tmp"; environment.TMPDIR = "/tmp";
serviceConfig.ExecStart = "${cfg.package}/lib/gnunet/libexec/gnunet-service-arm -c ${configFile}"; serviceConfig.ExecStart = "${cfg.package}/lib/gnunet/libexec/gnunet-service-arm -c ${configFile}";
serviceConfig.ExecStop = "${cfg.package}/bin/gnunet-arm -c ${configFile} -e";
serviceConfig.User = "gnunet"; serviceConfig.User = "gnunet";
serviceConfig.Group = "gnunet"; serviceConfig.Group = "gnunet";
#serviceConfig.UMask = "0007"; #serviceConfig.UMask = "0007";

View File

@ -1,9 +1,8 @@
{ stdenv, fetchgit, libtool, pkgconfig, autoconf, automake, gettext, libgcrypt { stdenv, fetchgit, libtool, pkgconfig, autoconf, automake, gettext, libgcrypt
, libidn2, zlib, libunistring, glpk, miniupnpc, libextractor, jansson, libgnurl , libidn2, zlib, libunistring, glpk, miniupnpc, libextractor, jansson, libgnurl
, sqlite, postgresql, mariadb, libmicrohttpd, iptables, nettools, gnutls , sqlite, postgresql, mariadb, libmicrohttpd, iptables, nettools, gnutls
, unbound, coreutils, file, python3, texinfo , unbound, coreutils, file, python3, texinfo, procps, iproute
, makeWrapper , withVerbose ? false
, withVerbose ? true
, withDocumentation ? false , withDocumentation ? false
, withSqlite ? true , withSqlite ? true
, withPostgres ? false , withPostgres ? false
@ -12,17 +11,18 @@
with stdenv.lib; with stdenv.lib;
let let
rev = "b0b7de092d65d189baff2201eaa913861ef12223"; rev = "93cb4a4f1ddecdd1d4a727dea07a53b19a5c3421";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "gnunet-${rev}"; name = "gnunet-${rev}";
src = fetchgit { src = /home/christian/projects/gnunet-dev;
#url = https://gnunet.org/git/gnunet.git; #src = fetchgit {
url = https://ulrich.earth/code/gnunet; # #url = https://gnunet.org/git/gnunet.git;
inherit rev; # url = https://ulrich.earth/code/gnunet;
sha256 = "1qgqw0gl3zwpl2pzdgfl6wdzsw5ild4qldf1cvfki7s3hki3myyf"; # inherit rev;
}; # sha256 = "1qgqw0gl3zwpl2pzdgfl6wdzsw5ild4qldf1cvfki7s3hki3myyf";
#};
phases = [ phases = [
"unpackPhase" "preConfigure" "configurePhase" "buildPhase" "installPhase" "unpackPhase" "preConfigure" "configurePhase" "buildPhase" "installPhase"
@ -34,40 +34,50 @@ stdenv.mkDerivation rec {
#doCheck = true; #doCheck = true;
nativeBuildInputs = [ nativeBuildInputs = [
makeWrapper libtool pkgconfig autoconf automake gettext coreutils file libtool pkgconfig autoconf automake gettext coreutils file python3
python3
] ]
++ optional withDocumentation texinfo; ++ optional withDocumentation texinfo;
buildInputs = [ propagatedBuildInputs = [
libgcrypt libidn2 zlib libunistring glpk miniupnpc libextractor jansson libgcrypt libidn2 zlib libunistring glpk miniupnpc libextractor jansson
libgnurl libmicrohttpd iptables nettools gnutls unbound libgnurl libmicrohttpd iptables nettools gnutls unbound procps iproute
] ]
++ optional withSqlite sqlite ++ optional withSqlite sqlite
++ optional withPostgres postgresql ++ optional withPostgres postgresql
++ optional withMariadb mariadb; ++ optional withMariadb mariadb;
configureFlags = configureFlags =
optional withVerbose "--enable-logging=verbose" [ "--enable-logging=verbose" ]
++ optional (!withDocumentation) "--disable-documentation"; ++ optional (!withDocumentation) "--disable-documentation";
NIX_CFLAGS_COMPILE = "-g -Wall -O0";
preConfigure = '' preConfigure = ''
substituteInPlace configure.ac --replace "/usr/sbin/iptables" "iptables" #substituteInPlace configure.ac --replace "/usr/sbin/iptables" "${iptables}/bin/iptables"
substituteInPlace configure.ac --replace "/sbin/ifconfig" "ifconfig" #substituteInPlace configure.ac --replace "/sbin/ifconfig" "ifconfig"
sh bootstrap sh bootstrap
substituteInPlace configure --replace "/usr/bin/file" "file" #substituteInPlace configure --replace "/usr/bin/file" "file"
substituteInPlace configure --replace "/usr/bin/objformat" "objformat" #substituteInPlace configure --replace "/usr/bin/objformat" "objformat"
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/iptables"' '"${iptables}/bin/iptables"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/ip6tables"' '"${iptables}/bin/ip6tables"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/ip"' '"${iproute}/bin/ip"'
substituteInPlace src/dns/gnunet-helper-dns.c --replace '"/sbin/sysctl"' '"${procps}/bin/sysctl"'
'';
postInstall = ''
mv $out/lib/gnunet/nss/* $out/lib/
rmdir $out/lib/gnunet/nss
''; '';
/* FIXME: Tests must be run this way, but there are still a couple of /* FIXME: Tests must be run this way, but there are still a couple of
failures. */ failures. */
checkPhase = checkPhase = ''
'' export GNUNET_PREFIX="$out" export GNUNET_PREFIX="$out"
export GNUNET_TMP="$TMPDIR" export GNUNET_TMP="$TMPDIR"
export PATH="$out/bin:$PATH" export PATH="$out/bin:$PATH"
make -k check make -k check
''; '';
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework"; description = "GNUnet, GNU's decentralized anonymous and censorship-resistant P2P framework";