···666 The same thing applies to `cabal configure`, of course, if you're
667 building with `cabal-install` instead of Stack.
668000000000000000000000669670# Other resources
671
···666 The same thing applies to `cabal configure`, of course, if you're
667 building with `cabal-install` instead of Stack.
668669+## Creating statically linked binaries
670+671+There are two levels of static linking. The first option is to configure the
672+build with the Cabal flag `--disable-executable-dynamic`. In Nix expressions,
673+this can be achieved by setting the attribute:
674+675+ enableSharedExecutables = false;
676+677+That gives you a binary with statically linked Haskell libraries and
678+dynamically linked system libraries.
679+680+To link both Haskell libraries and system libraries statically, the additional
681+flags `--ghc-option=-optl=-static --ghc-option=-optl=-pthread` need to be used.
682+In Nix, this is accomplished with:
683+684+ configureFlags = [ "--ghc-option=-optl=-static" "--ghc-option=-optl=-pthread" ];
685+686+It's important to realize, however, that most system libraries in Nix are built
687+as shared libraries only, i.e. there is just no static library available that
688+Cabal could link!
689+690691# Other resources
692
···59 # place the interface which is named after the device at the beginning.
60 wlanListDeviceFirst = device: interfaces:
61 if hasAttr device interfaces
62- then [{"${device}"=interfaces.device; _iName=device;}] ++ mapAttrsToList (n: v: v//{_iName=n;}) (filterAttrs (n: _: n!=device) interfaces)
63 else mapAttrsToList (n: v: v // {_iName = n;}) interfaces;
6465 # udev script that configures a physical wlan device and adds virtual interfaces
···59 # place the interface which is named after the device at the beginning.
60 wlanListDeviceFirst = device: interfaces:
61 if hasAttr device interfaces
62+ then mapAttrsToList (n: v: v//{_iName=n;}) (filterAttrs (n: _: n==device) interfaces) ++ mapAttrsToList (n: v: v//{_iName=n;}) (filterAttrs (n: _: n!=device) interfaces)
63 else mapAttrsToList (n: v: v // {_iName = n;}) interfaces;
6465 # udev script that configures a physical wlan device and adds virtual interfaces
···1+{ stdenv, fetchurl, ncurses }:
2+3+stdenv.mkDerivation rec {
4+ version = "1.1.4";
5+ name = "iptraf-ng-${version}";
6+7+ src = fetchurl {
8+ url = "https://fedorahosted.org/releases/i/p/iptraf-ng/${name}.tar.gz";
9+ sha256 = "02gb8z9h2s6s1ybyikywz7jgb1mafdx88hijfasv3khcgkq0q53r";
10+ };
11+12+ buildInputs = [ ncurses ];
13+14+ configurePhase = ''
15+ ./configure --prefix=$out/usr --sysconfdir=$out/etc \
16+ --localstatedir=$out/var --sbindir=$out/bin
17+ '';
18+19+ meta = {
20+ description = "A console-based network monitoring utility (fork of iptraf)";
21+ longDescription = ''
22+ IPTraf-ng is a console-based network monitoring utility. IPTraf-ng
23+ gathers data like TCP connection packet and byte counts, interface
24+ statistics and activity indicators, TCP/UDP traffic breakdowns, and LAN
25+ station packet and byte counts. IPTraf-ng features include an IP traffic
26+ monitor which shows TCP flag information, packet and byte counts, ICMP
27+ details, OSPF packet types, and oversized IP packet warnings; interface
28+ statistics showing IP, TCP, UDP, ICMP, non-IP and other IP packet counts,
29+ IP checksum errors, interface activity and packet size counts; a TCP and
30+ UDP service monitor showing counts of incoming and outgoing packets for
31+ common TCP and UDP application ports, a LAN statistics module that
32+ discovers active hosts and displays statistics about their activity; TCP,
33+ UDP and other protocol display filters so you can view just the traffic
34+ you want; logging; support for Ethernet, FDDI, ISDN, SLIP, PPP, and
35+ loopback interfaces; and utilization of the built-in raw socket interface
36+ of the Linux kernel, so it can be used on a wide variety of supported
37+ network cards.
38+ '';
39+ homepage = https://fedorahosted.org/iptraf-ng/;
40+ license = stdenv.lib.licenses.gpl2;
41+ platforms = stdenv.lib.platforms.linux;
42+ maintainers = [ stdenv.lib.maintainers.devhell ];
43+ };
44+}
···157 setupLibDirs = if isTargetBuild then setupLibDirs_target
158 else setupLibDirs_multi;
1590000000160 # the target profile is the actual profile that will be used for the chroot
161 setupTargetProfile = ''
162 mkdir -m0755 usr
163 cd usr
164 ${setupLibDirs}
0165 for i in bin sbin share include; do
166 cp -r "${staticUsrProfileTarget}/$i" $i
167 done
···157 setupLibDirs = if isTargetBuild then setupLibDirs_target
158 else setupLibDirs_multi;
159160+ setupIncludeDir = ''
161+ if [ -x "${staticUsrProfileTarget}/include" ]
162+ then
163+ ln -s "${staticUsrProfileTarget}/include"
164+ fi
165+ '';
166+167 # the target profile is the actual profile that will be used for the chroot
168 setupTargetProfile = ''
169 mkdir -m0755 usr
170 cd usr
171 ${setupLibDirs}
172+ ${setupIncludeDir}
173 for i in bin sbin share include; do
174 cp -r "${staticUsrProfileTarget}/$i" $i
175 done
···1+diff -Naur a/tools/gyp/pylib/gyp/xcode_emulation.py b/tools/gyp/pylib/gyp/xcode_emulation.py
2+--- a/tools/gyp/pylib/gyp/xcode_emulation.py 2014-01-23 06:05:51.000000000 +0100
3++++ b/tools/gyp/pylib/gyp/xcode_emulation.py 2014-02-04 17:49:48.000000000 +0100
4+@@ -1018,12 +1033,16 @@
5+ # Since the value returned by this function is only used when ARCHS is not
6+ # set, then on iOS we return "i386", as the default xcode project generator
7+ # does not set ARCHS if it is not set in the .gyp file.
8+- if self.isIOS:
9++
10++ try:
11++ if self.isIOS:
12++ return 'i386'
13++ version, build = self._XcodeVersion()
14++ if version >= '0500':
15++ return 'x86_64'
16+ return 'i386'
17+- version, build = self._XcodeVersion()
18+- if version >= '0500':
19++ except:
20+ return 'x86_64'
21+- return 'i386'
22+23+ class MacPrefixHeader(object):
24+ """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.
···7071 def AdjustLibraries(self, libraries, config_name=None):
72 """Transforms entries like 'Cocoa.framework' in libraries into entries like
73-@@ -1018,12 +1033,16 @@
74- # Since the value returned by this function is only used when ARCHS is not
75- # set, then on iOS we return "i386", as the default xcode project generator
76- # does not set ARCHS if it is not set in the .gyp file.
77-- if self.isIOS:
78-+
79-+ try:
80-+ if self.isIOS:
81-+ return 'i386'
82-+ version, build = self._XcodeVersion()
83-+ if version >= '0500':
84-+ return 'x86_64'
85- return 'i386'
86-- version, build = self._XcodeVersion()
87-- if version >= '0500':
88-+ except:
89- return 'x86_64'
90-- return 'i386'
91-92- class MacPrefixHeader(object):
93- """A class that helps with emulating Xcode's GCC_PREFIX_HEADER feature.
···7071 def AdjustLibraries(self, libraries, config_name=None):
72 """Transforms entries like 'Cocoa.framework' in libraries into entries like
000000000000000000000
···1{ stdenv, fetchFromGitHub, autoreconfHook, gettext }:
23-let version = "0.5.2"; in
004stdenv.mkDerivation {
5 name = "duff-${version}";
67 src = fetchFromGitHub {
8- sha256 = "0yfm910wjj6z0f0cg68x59ykf4ql5m49apzy8sra00f8kv4lpn53";
9- rev = version;
10 repo = "duff";
11 owner = "elmindreda";
12 };
···14 nativeBuildInputs = [ autoreconfHook gettext ];
1516 preAutoreconf = ''
17- # duff is currently badly packaged, requiring us to do extra work here that
18- # should be done upstream. If that is ever fixed, this entire phase can be
19- # removed along with all buildInputs.
20-21 # gettexttize rightly refuses to run non-interactively:
22 cp ${gettext}/bin/gettextize .
23 substituteInPlace gettextize \
···30 enableParallelBuilding = true;
3132 meta = with stdenv.lib; {
033 description = "Quickly find duplicate files";
34- homepage = http://duff.dreda.org/;
35- license = licenses.zlib;
36 longDescription = ''
37 Duff is a Unix command-line utility for quickly finding duplicates in
38 a given set of files.
39 '';
00040 maintainers = with maintainers; [ nckx ];
41- platforms = with platforms; all;
42 };
43}
···1{ stdenv, fetchFromGitHub, autoreconfHook, gettext }:
23+# The last release (0.5.2) is more than 2 years old and lacks features like -D,
4+# limiting its usefulness. Upstream appears comatose if not dead.
5+let version = "2014-07-03"; in
6stdenv.mkDerivation {
7 name = "duff-${version}";
89 src = fetchFromGitHub {
10+ sha256 = "1k2dx38pjzc5d624vw1cs5ipj9fprsm5vqv55agksc29m63lswnx";
11+ rev = "f26d4837768b062a3f98fa075c791d9c8a0bb75c";
12 repo = "duff";
13 owner = "elmindreda";
14 };
···16 nativeBuildInputs = [ autoreconfHook gettext ];
1718 preAutoreconf = ''
000019 # gettexttize rightly refuses to run non-interactively:
20 cp ${gettext}/bin/gettextize .
21 substituteInPlace gettextize \
···28 enableParallelBuilding = true;
2930 meta = with stdenv.lib; {
31+ inherit version;
32 description = "Quickly find duplicate files";
0033 longDescription = ''
34 Duff is a Unix command-line utility for quickly finding duplicates in
35 a given set of files.
36 '';
37+ homepage = http://duff.dreda.org/;
38+ license = licenses.zlib;
39+ platforms = platforms.all;
40 maintainers = with maintainers; [ nckx ];
041 };
42}