Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 05962c4ad558
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7119d076248b
Choose a head ref

Commits on Dec 10, 2019

  1. docker-machine-xhyve: update repository location

    The zchee repository now redirects to machine-drivers.
    mroi committed Dec 10, 2019
    Copy the full SHA
    5c01936 View commit details

Commits on Dec 12, 2019

  1. Add pkgs.lib.renderOptions

    This adds a new utility to intelligently convert Nix records to
    command line options to reduce boilerplate for simple use cases and to
    also reduce the likelihood of malformed command lines
    Gabriella439 committed Dec 12, 2019
    Copy the full SHA
    183a997 View commit details

Commits on Dec 14, 2019

  1. Rename renderOptions to encodeGNUCommandLine

    ... as suggested by @edolstra
    Gabriella439 committed Dec 14, 2019
    Copy the full SHA
    8c6a05c View commit details
  2. Make behavior of encodeGNUCommandLine customizable

    ... based on feedback from @edolstra
    Gabriella439 committed Dec 14, 2019
    Copy the full SHA
    693096d View commit details

Commits on Dec 15, 2019

  1. Use a more realistic example that exercises all encodings

    ... as suggested by @roberth
    
    This also caught a bug in rendering lists, which this change also fixes
    Gabriella439 committed Dec 15, 2019
    Copy the full SHA
    5edd4dd View commit details

Commits on Dec 21, 2019

  1. docker-machine-xhyve: 0.3.3 -> 0.4.0

    remove explicit dependencies, upstream vendorizes them properly
    mroi committed Dec 21, 2019
    Copy the full SHA
    475bf6d View commit details
  2. docker-machine-xhyve: support lib9p shared file system

    The lib9p library for host-guest file sharing in xhyve needs to be built separately.
    mroi committed Dec 21, 2019
    Copy the full SHA
    08ecf22 View commit details
  3. docker-machine-xhyve: fix file mode inconsistencies

    File modes are not properly translated from L9P to host values.
    Instead, they are assumed to be identical, which is wrong on macOS.
    machine-drivers/docker-machine-driver-xhyve#225
    mroi committed Dec 21, 2019
    Copy the full SHA
    338386b View commit details

Commits on Jan 1, 2020

  1. rgl: fix build

    It seems that the dev output of libGLU needs to be included explicitly
    for this to work. I've also moved the libraries from nativeBuildInputs
    to buildInputs to be more semantically correct (and maybe support
    cross compilation, not tested though).
    lheckemann committed Jan 1, 2020
    Copy the full SHA
    1e840fc View commit details

Commits on Jan 5, 2020

  1. Factor out a toGNUCommandLine utility

    ... as suggested by @roberth
    Gabriella439 committed Jan 5, 2020
    Copy the full SHA
    6d584c2 View commit details
  2. Export toGNUCommandLine

    ... as suggested by @roberth
    
    Co-Authored-By: Robert Hensing <roberth@users.noreply.github.com>
    Gabriella439 and roberth authored Jan 5, 2020
    Copy the full SHA
    a46679f View commit details

Commits on Jan 9, 2020

  1. blender: switch to OpenJPEG 2.x

    Fixes:
    
    -- Could NOT find OpenJPEG (missing: OPENJPEG_LIBRARY OPENJPEG_INCLUDE_DIR)
    
    and
    
      - WITH_IMAGE_OPENJPEG         OFF
    veprbl committed Jan 9, 2020
    Copy the full SHA
    e57392d View commit details
  2. openimageio: enable on darwin

    veprbl committed Jan 9, 2020
    Copy the full SHA
    95b8c85 View commit details
  3. blender: fix on darwin

    This enables building of Blender.app. The standard build process assumes
    that the dependencies are installed in subdirectoris inside $LIBDIR with
    libraries built as static. In current implementation we are not looking
    to achieve portability, so cmake files are patched to link dynamically
    with the libraries in the nix store. Linking to the transitive
    dependencies is not needed in the shared case. There are also some minor
    inconsistensies in the expected paths, which also need to be patched.
    
    Alternatively, we could patch cmake files to treat darwin as "unix", but
    that would require more tweaking to ensure that the frameworks are being
    linked properly.
    veprbl committed Jan 9, 2020
    Copy the full SHA
    2287d54 View commit details

Commits on Jan 10, 2020

  1. Copy the full SHA
    8aa0e2f View commit details

Commits on Jan 13, 2020

  1. Disable further pass tests that end up relying on gpg-agent on Darwin

    Fixes #58975
    Pass Automated Testing Suite authored and Pass Automated Testing Suite committed Jan 13, 2020
    Copy the full SHA
    669318b View commit details
  2. soapysdr: 0.7.1 -> 0.7.2

    markuskowa committed Jan 13, 2020
    Copy the full SHA
    cc4b59f View commit details
  3. Copy the full SHA
    e1e61f3 View commit details
  4. gitlab: 12.6.2 -> 12.6.4

    flokli committed Jan 13, 2020
    Copy the full SHA
    57560cc View commit details
  5. snapper: 0.8.7 -> 8.8.8

    markuskowa committed Jan 13, 2020
    Copy the full SHA
    e664a14 View commit details
  6. azure-cli: 2.0.79 -> 2.0.80

    Jonathan Ringer committed Jan 13, 2020
    Copy the full SHA
    32b5c57 View commit details

Commits on Jan 14, 2020

  1. Copy the full SHA
    2becf7f View commit details
  2. Copy the full SHA
    f03b833 View commit details
  3. Copy the full SHA
    7f69fdd View commit details
  4. Copy the full SHA
    e1b1f5a View commit details
  5. Copy the full SHA
    adf5642 View commit details
  6. Merge pull request #77649 from markuskowa/upd-snapper

    snapper: 0.8.7 -> 8.8.8
    markuskowa authored Jan 14, 2020
    Copy the full SHA
    fc073e4 View commit details
  7. Merge pull request #77643 from markuskowa/upd-soapy

    soapysdr: 0.7.1 -> 0.7.2
    markuskowa authored Jan 14, 2020
    Copy the full SHA
    e5fd468 View commit details
  8. onnxruntime: 1.0.0 -> 1.1.0

    Jonathan Ringer committed Jan 14, 2020
    Copy the full SHA
    e306ee4 View commit details
  9. diffoscope: enable on darwin

    LnL7 committed Jan 14, 2020
    Copy the full SHA
    ef09ceb View commit details
  10. Merge pull request #75539 from Gabriel439/gabriel/renderOptions

    Add `pkgs.lib.encodeGNUCommandLine`
    roberth authored Jan 14, 2020
    Copy the full SHA
    8da8146 View commit details
  11. eksctl: 0.11.1 -> 0.12.0

    amarrella committed Jan 14, 2020
    Copy the full SHA
    7303713 View commit details
  12. vagrant: Unbreak replacing symlinks on macOS

    On a local installation on macOS, "cp -a" creates a write-protected
    directory, which can't be renamed.  Do a "chmod +w" to unbreak.
    
    Fixes #77671.
    mikesperber committed Jan 14, 2020
    Copy the full SHA
    1bea1a3 View commit details
  13. Copy the full SHA
    b2f6aa6 View commit details
  14. Copy the full SHA
    16fc4dd View commit details
  15. doc: Make prompt unselectable

    Weirdly, no-one seems to have noticed this was broken.
    jtojnar committed Jan 14, 2020
    Copy the full SHA
    8334b83 View commit details
  16. doc: Make callout marks in code unselectable

    To make example copying easier.
    jtojnar committed Jan 14, 2020
    Copy the full SHA
    1e6265a View commit details
  17. osmctools: 0.8.5plus1.4.0 -> 0.9 (#76573)

    osmctools: 0.8.5plus1.4.0 -> 0.9
    Mic92 authored Jan 14, 2020
    Copy the full SHA
    65492f7 View commit details
  18. Merge pull request #77047 from NixOS/staging-next

    Staging next
    FRidh authored Jan 14, 2020
    Copy the full SHA
    05a9658 View commit details
  19. glog: remove static flag

    tobim committed Jan 14, 2020
    Copy the full SHA
    d48a993 View commit details
  20. mdcat: 0.14.0 -> 0.15.0

    davidtwco authored and teto committed Jan 14, 2020
    Copy the full SHA
    cfc2ead View commit details
  21. Merge pull request #77674 from mbbx6spp/mbbx6spp/update-copyright-yea…

    …r-2020
    
    nixos/doc+manual: update copyright year range end 2019->2020
    jtojnar authored Jan 14, 2020
    Copy the full SHA
    485a993 View commit details
  22. Merge pull request #76797 from lheckemann/rgl-fix

    rPackages.rgl: fix build
    lheckemann authored Jan 14, 2020
    Copy the full SHA
    a1d8a27 View commit details
  23. Merge pull request #77650 from jonringer/bump-azure-cli

    azure-cli: 2.0.79 -> 2.0.80
    c0bw3b authored Jan 14, 2020
    Copy the full SHA
    f4c645a View commit details
  24. Sylk: 2.1.0 -> 2.5.0 (#77606)

    leenaars authored and zimbatm committed Jan 14, 2020
    Copy the full SHA
    8df2444 View commit details
  25. Copy the full SHA
    4490cfa View commit details
  26. lib/types: prioritise coercedType in coercedTo

    This more intuitively matches `types.either` and allows paths to be
    coerced to submodules again, which was inhibited by #76861
    arcnmx committed Jan 14, 2020
    Copy the full SHA
    92b464d View commit details
  27. Merge pull request #77675 from taku0/flashplayer-32.0.0.314

    flashplayer: 32.0.0.303 -> 32.0.0.314
    7c6f434c authored Jan 14, 2020
    Copy the full SHA
    ad2289a View commit details
  28. Merge #77682: glog: remove static flag

    It was re-introduced by incorrect merge-conflict resolution.
    vcunat committed Jan 14, 2020
    Copy the full SHA
    018e297 View commit details
  29. pythonPackages.pynrrd: init at 0.4.2

    bcdarwin authored and Jon committed Jan 14, 2020
    Copy the full SHA
    8f1994c View commit details
Showing with 1,030 additions and 267 deletions.
  1. +1 −0 doc/languages-frameworks/python.section.md
  2. +14 −1 doc/overrides.css
  3. +56 −0 lib/cli.nix
  4. +2 −0 lib/default.nix
  5. +21 −0 lib/tests/misc.nix
  6. +4 −4 lib/types.nix
  7. +1 −1 nixos/doc/manual/man-pages.xml
  8. +2 −1 nixos/lib/test-driver/test-driver.py
  9. +1 −1 nixos/lib/testing-python.nix
  10. +10 −6 nixos/modules/services/torrent/transmission.nix
  11. +78 −77 nixos/tests/bittorrent.nix
  12. +0 −1 pkgs/applications/graphics/openimageio/default.nix
  13. +105 −0 pkgs/applications/misc/blender/darwin.patch
  14. +50 −10 pkgs/applications/misc/blender/default.nix
  15. +14 −33 pkgs/applications/misc/osmctools/default.nix
  16. +2 −2 pkgs/applications/networking/Sylk/default.nix
  17. +2 −2 pkgs/applications/networking/browsers/chromium/plugins.nix
  18. +5 −5 pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
  19. +3 −3 pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
  20. +0 −21 pkgs/applications/networking/cluster/docker-machine/xhyve-deps.nix
  21. +18 −6 pkgs/applications/networking/cluster/docker-machine/xhyve.nix
  22. +2 −2 pkgs/applications/radio/soapysdr/default.nix
  23. +40 −0 pkgs/applications/science/math/nota/default.nix
  24. +4 −4 pkgs/applications/version-management/gitlab/data.json
  25. +3 −3 pkgs/applications/version-management/gitlab/gitaly/default.nix
  26. +1 −1 pkgs/applications/version-management/gitlab/rubyEnv/Gemfile
  27. +4 −4 pkgs/applications/version-management/gitlab/rubyEnv/Gemfile.lock
  28. +4 −4 pkgs/applications/version-management/gitlab/rubyEnv/gemset.nix
  29. +18 −23 pkgs/development/compilers/bs-platform/{bs-platform-62.nix → build-bs-platform.nix}
  30. +20 −7 pkgs/development/compilers/bs-platform/default.nix
  31. +2 −2 pkgs/development/compilers/bs-platform/ocaml.nix
  32. +12 −0 pkgs/development/interpreters/python/hooks/default.nix
  33. +26 −0 pkgs/development/interpreters/python/hooks/venv-shell-hook.sh
  34. +2 −2 pkgs/development/libraries/glog/default.nix
  35. +4 −3 pkgs/development/libraries/libvterm-neovim/default.nix
  36. +11 −4 pkgs/development/libraries/onnxruntime/default.nix
  37. +1 −1 pkgs/development/libraries/openssl/default.nix
  38. +37 −0 pkgs/development/python-modules/pylint-celery/default.nix
  39. +39 −0 pkgs/development/python-modules/pylint-django/default.nix
  40. +36 −0 pkgs/development/python-modules/pylint-flask/default.nix
  41. +27 −0 pkgs/development/python-modules/pynrrd/default.nix
  42. +7 −2 pkgs/development/python-modules/requirements-detector/default.nix
  43. +2 −1 pkgs/development/python-modules/sentry-sdk/default.nix
  44. +1 −1 pkgs/development/r-modules/default.nix
  45. +74 −0 pkgs/development/tools/prospector/default.nix
  46. +26 −0 pkgs/development/tools/prospector/setoptconf.nix
  47. +2 −0 pkgs/development/tools/vagrant/default.nix
  48. +2 −2 pkgs/servers/ftp/bftpd/default.nix
  49. +172 −0 pkgs/servers/mail/public-inbox/0002-msgtime-drop-Date-Parse-for-RFC2822.patch
  50. +9 −1 pkgs/servers/mail/public-inbox/default.nix
  51. +2 −2 pkgs/tools/admin/azure-cli/default.nix
  52. +2 −2 pkgs/tools/admin/azure-cli/python-packages.nix
  53. +3 −3 pkgs/tools/admin/eksctl/default.nix
  54. +8 −5 pkgs/tools/misc/diffoscope/default.nix
  55. +2 −2 pkgs/tools/misc/snapper/default.nix
  56. +3 −3 pkgs/tools/networking/bandwhich/default.nix
  57. +6 −0 pkgs/tools/security/pass/default.nix
  58. +7 −5 pkgs/tools/text/mdcat/default.nix
  59. +11 −3 pkgs/top-level/all-packages.nix
  60. +9 −1 pkgs/top-level/python-packages.nix
1 change: 1 addition & 0 deletions doc/languages-frameworks/python.section.md
Original file line number Diff line number Diff line change
@@ -833,6 +833,7 @@ used in `buildPythonPackage`.
- `pythonRemoveBinBytecode` to remove bytecode from the `/bin` folder.
- `setuptoolsBuildHook` to build a wheel using `setuptools`.
- `setuptoolsCheckHook` to run tests with `python setup.py test`.
- `venvShellHook` to source a Python 3 `venv` at the `venvDir` location. A `venv` is created if it does not yet exist.
- `wheelUnpackHook` to move a wheel to the correct folder so it can be installed with the `pipInstallHook`.

### Development mode
15 changes: 14 additions & 1 deletion doc/overrides.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
.docbook .xref img[src^=images\/callouts\/],
.screen img,
.programlisting img {
.programlisting img,
.literallayout img,
.synopsis img {
width: 1em;
}

.calloutlist img {
width: 1.5em;
}

.prompt,
.screen img,
.programlisting img,
.literallayout img,
.synopsis img {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
56 changes: 56 additions & 0 deletions lib/cli.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ lib }:

rec {
/* Automatically convert an attribute set to command-line options.
This helps protect against malformed command lines and also to reduce
boilerplate related to command-line construction for simple use cases.
Example:
encodeGNUCommandLine
{ }
{ data = builtins.toJSON { id = 0; };
X = "PUT";
retry = 3;
retry-delay = null;
url = [ "https://example.com/foo" "https://example.com/bar" ];
silent = false;
verbose = true;
};
=> "'-X' 'PUT' '--data' '{\"id\":0}' '--retry' '3' '--url' 'https://example.com/foo' '--url' 'https://example.com/bar' '--verbose'"
*/
encodeGNUCommandLine =
options: attrs: lib.escapeShellArgs (toGNUCommandLine options attrs);

toGNUCommandLine =
{ renderKey ?
key: if builtins.stringLength key == 1 then "-${key}" else "--${key}"

, renderOption ?
key: value:
if value == null
then []
else [ (renderKey key) (builtins.toString value) ]

, renderBool ? key: value: lib.optional value (renderKey key)

, renderList ? key: value: lib.concatMap (renderOption key) value
}:
options:
let
render = key: value:
if builtins.isBool value
then renderBool key value
else if builtins.isList value
then renderList key value
else renderOption key value;

in
builtins.concatLists (lib.mapAttrsToList render options);
}
2 changes: 2 additions & 0 deletions lib/default.nix
Original file line number Diff line number Diff line change
@@ -39,6 +39,7 @@ let

# misc
asserts = callLibs ./asserts.nix;
cli = callLibs ./cli.nix;
debug = callLibs ./debug.nix;
generators = callLibs ./generators.nix;
misc = callLibs ./deprecated.nix;
@@ -120,6 +121,7 @@ let
isOptionType mkOptionType;
inherit (asserts)
assertMsg assertOneOf;
inherit (cli) encodeGNUCommandLine toGNUCommandLine;
inherit (debug) addErrorContextToAttrs traceIf traceVal traceValFn
traceXMLVal traceXMLValMarked traceSeq traceSeqN traceValSeq
traceValSeqFn traceValSeqN traceValSeqNFn traceShowVal
21 changes: 21 additions & 0 deletions lib/tests/misc.nix
Original file line number Diff line number Diff line change
@@ -441,4 +441,25 @@ runTests {
expected = "«foo»";
};

testRenderOptions = {
expr =
encodeGNUCommandLine
{ }
{ data = builtins.toJSON { id = 0; };

X = "PUT";

retry = 3;

retry-delay = null;

url = [ "https://example.com/foo" "https://example.com/bar" ];

silent = false;

verbose = true;
};

expected = "'-X' 'PUT' '--data' '{\"id\":0}' '--retry' '3' '--url' 'https://example.com/foo' '--url' 'https://example.com/bar' '--verbose'";
};
}
8 changes: 4 additions & 4 deletions lib/types.nix
Original file line number Diff line number Diff line change
@@ -590,7 +590,7 @@ rec {
tail' = tail ts;
in foldl' either head' tail';

# Either value of type `finalType` or `coercedType`, the latter is
# Either value of type `coercedType` or `finalType`, the former is
# converted to `finalType` using `coerceFunc`.
coercedTo = coercedType: coerceFunc: finalType:
assert lib.assertMsg (coercedType.getSubModules == null)
@@ -599,12 +599,12 @@ rec {
mkOptionType rec {
name = "coercedTo";
description = "${finalType.description} or ${coercedType.description} convertible to it";
check = x: finalType.check x || (coercedType.check x && finalType.check (coerceFunc x));
check = x: (coercedType.check x && finalType.check (coerceFunc x)) || finalType.check x;
merge = loc: defs:
let
coerceVal = val:
if finalType.check val then val
else coerceFunc val;
if coercedType.check val then coerceFunc val
else val;
in finalType.merge loc (map (def: def // { value = coerceVal def.value; }) defs);
emptyValue = finalType.emptyValue;
getSubOptions = finalType.getSubOptions;
2 changes: 1 addition & 1 deletion nixos/doc/manual/man-pages.xml
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
<author><personname><firstname>Eelco</firstname><surname>Dolstra</surname></personname>
<contrib>Author</contrib>
</author>
<copyright><year>2007-2019</year><holder>Eelco Dolstra</holder>
<copyright><year>2007-2020</year><holder>Eelco Dolstra</holder>
</copyright>
</info>
<xi:include href="man-configuration.xml" />
3 changes: 2 additions & 1 deletion nixos/lib/test-driver/test-driver.py
Original file line number Diff line number Diff line change
@@ -704,7 +704,8 @@ def create_socket(path: str) -> socket.socket:

def process_serial_output() -> None:
for _line in self.process.stdout:
line = _line.decode("unicode_escape").replace("\r", "").rstrip()
# Ignore undecodable bytes that may occur in boot menus
line = _line.decode(errors="ignore").replace("\r", "").rstrip()
eprint("{} # {}".format(self.name, line))
self.logger.enqueue({"msg": line, "machine": self.name})

2 changes: 1 addition & 1 deletion nixos/lib/testing-python.nix
Original file line number Diff line number Diff line change
@@ -155,7 +155,7 @@ in rec {
--add-flags "''${vms[*]}" \
${lib.optionalString enableOCR
"--prefix PATH : '${ocrProg}/bin:${imagemagick_tiff}/bin'"} \
--run "export testScript=\"\$(cat $out/test-script)\"" \
--run "export testScript=\"\$(${coreutils}/bin/cat $out/test-script)\"" \
--set VLANS '${toString vlans}'
ln -s ${testDriver}/bin/nixos-test-driver $out/bin/nixos-run-vms
wrapProgram $out/bin/nixos-run-vms \
16 changes: 10 additions & 6 deletions nixos/modules/services/torrent/transmission.nix
Original file line number Diff line number Diff line change
@@ -129,19 +129,23 @@ in
# It's useful to have transmission in path, e.g. for remote control
environment.systemPackages = [ pkgs.transmission ];

users.users = optionalAttrs (cfg.user == "transmission") (singleton
{ name = "transmission";
users.users = optionalAttrs (cfg.user == "transmission") ({
transmission = {
name = "transmission";
group = cfg.group;
uid = config.ids.uids.transmission;
description = "Transmission BitTorrent user";
home = homeDir;
createHome = true;
});
};
});

users.groups = optionalAttrs (cfg.group == "transmission") (singleton
{ name = "transmission";
users.groups = optionalAttrs (cfg.group == "transmission") ({
transmission = {
name = "transmission";
gid = config.ids.gids.transmission;
});
};
});

# AppArmor profile
security.apparmor.profiles = mkIf apparmor [
155 changes: 78 additions & 77 deletions nixos/tests/bittorrent.nix
Original file line number Diff line number Diff line change
@@ -18,6 +18,17 @@ let
externalRouterAddress = "80.100.100.1";
externalClient2Address = "80.100.100.2";
externalTrackerAddress = "80.100.100.3";

transmissionConfig = { ... }: {
environment.systemPackages = [ pkgs.transmission ];
services.transmission = {
enable = true;
settings = {
dht-enabled = false;
message-level = 3;
};
};
};
in

{
@@ -26,88 +37,79 @@ in
maintainers = [ domenkozar eelco rob bobvanderlinden ];
};

nodes =
{ tracker =
{ pkgs, ... }:
{ environment.systemPackages = [ pkgs.transmission ];

virtualisation.vlans = [ 1 ];
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalTrackerAddress; prefixLength = 24; }
];

# We need Apache on the tracker to serve the torrents.
services.httpd.enable = true;
services.httpd.adminAddr = "foo@example.org";
services.httpd.documentRoot = "/tmp";

networking.firewall.enable = false;

services.opentracker.enable = true;

services.transmission.enable = true;
services.transmission.settings.dht-enabled = false;
services.transmission.settings.port-forwaring-enabled = false;
};

router =
{ pkgs, nodes, ... }:
{ virtualisation.vlans = [ 1 2 ];
networking.nat.enable = true;
networking.nat.internalInterfaces = [ "eth2" ];
networking.nat.externalInterface = "eth1";
networking.firewall.enable = true;
networking.firewall.trustedInterfaces = [ "eth2" ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalRouterAddress; prefixLength = 24; }
];
networking.interfaces.eth2.ipv4.addresses = [
{ address = internalRouterAddress; prefixLength = 24; }
];
services.miniupnpd = {
enable = true;
externalInterface = "eth1";
internalIPs = [ "eth2" ];
appendConfig = ''
ext_ip=${externalRouterAddress}
'';
nodes = {
tracker = { pkgs, ... }: {
imports = [ transmissionConfig ];

virtualisation.vlans = [ 1 ];
networking.firewall.enable = false;
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalTrackerAddress; prefixLength = 24; }
];

# We need Apache on the tracker to serve the torrents.
services.httpd = {
enable = true;
virtualHosts = {
"torrentserver.org" = {
adminAddr = "foo@example.org";
documentRoot = "/tmp";
};
};
};
services.opentracker.enable = true;
};

client1 =
{ pkgs, nodes, ... }:
{ environment.systemPackages = [ pkgs.transmission pkgs.miniupnpc ];
virtualisation.vlans = [ 2 ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = internalClient1Address; prefixLength = 24; }
];
networking.defaultGateway = internalRouterAddress;
networking.firewall.enable = false;
services.transmission.enable = true;
services.transmission.settings.dht-enabled = false;
services.transmission.settings.message-level = 3;
};
router = { pkgs, nodes, ... }: {
virtualisation.vlans = [ 1 2 ];
networking.nat.enable = true;
networking.nat.internalInterfaces = [ "eth2" ];
networking.nat.externalInterface = "eth1";
networking.firewall.enable = true;
networking.firewall.trustedInterfaces = [ "eth2" ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalRouterAddress; prefixLength = 24; }
];
networking.interfaces.eth2.ipv4.addresses = [
{ address = internalRouterAddress; prefixLength = 24; }
];
services.miniupnpd = {
enable = true;
externalInterface = "eth1";
internalIPs = [ "eth2" ];
appendConfig = ''
ext_ip=${externalRouterAddress}
'';
};
};

client2 =
{ pkgs, ... }:
{ environment.systemPackages = [ pkgs.transmission ];
virtualisation.vlans = [ 1 ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalClient2Address; prefixLength = 24; }
];
networking.firewall.enable = false;
services.transmission.enable = true;
services.transmission.settings.dht-enabled = false;
services.transmission.settings.port-forwaring-enabled = false;
};
client1 = { pkgs, nodes, ... }: {
imports = [ transmissionConfig ];
environment.systemPackages = [ pkgs.miniupnpc ];

virtualisation.vlans = [ 2 ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = internalClient1Address; prefixLength = 24; }
];
networking.defaultGateway = internalRouterAddress;
networking.firewall.enable = false;
};

testScript =
{ nodes, ... }:
''
client2 = { pkgs, ... }: {
imports = [ transmissionConfig ];

virtualisation.vlans = [ 1 ];
networking.interfaces.eth0.ipv4.addresses = [];
networking.interfaces.eth1.ipv4.addresses = [
{ address = externalClient2Address; prefixLength = 24; }
];
networking.firewall.enable = false;
};
};

testScript = { nodes, ... }: ''
start_all()
# Wait for network and miniupnpd.
@@ -159,5 +161,4 @@ in
"cmp /tmp/test.tar.bz2 ${file}"
)
'';

})
Loading