Compare commits

..

6 Commits

Author SHA1 Message Date
aszlig
1f89aa6c7f nixos/tests: Remove tests.boot.boot* prefixes
As @bobvanderlinden suggests in #13585:

"Looks like that cleans things up quite a bit! Just one aesthetics note,
the boot tests could now be renamed from boot.bootBiosCdrom to
boot.biosCdrom in nixos/tests/boot.nix:L33.

That makes them more consistent with the other tests."

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-03-01 19:02:36 +01:00
aszlig
e45c211b50 nixos/tests/chromium: Split up into subtests
This makes it easier to test just a specific channel rather than to
force testing all builds down the users/testers throat. Especially this
makes it easier to test NixOS channel upgrades only against the Chromium
stable channel instead of just removing the beta/dev channels from the
tests entirely (as done in 69ec09f38a).

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-03-01 01:04:51 +01:00
aszlig
7eea91fbc0 nixos/release: Use callSubTests for subtests
Should clean up a lot of these redundant lines for various sub-tests.

Note that the tests.boot* are now called tests.boot.boot*, but otherwise
all the test attribute names should stay the same.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
Cc: @wkennington
Cc: @bobvanderlinden
2016-03-01 01:04:42 +01:00
aszlig
2f2536b935 nixos/tests/networking: Expose subtests via attrs
So far the networking test expression only generated a single test
depending on the passed "test" attribute. This makes it difficult to
autodiscover the subtests with our shiny new callSubTests function.

This change essentially doesn't change the behaviour of the subtests but
rather exposes them as an attribute set instead of relying on a
particular input argument.

The useNetworkd argument still exists however.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @wkennington
2016-03-01 01:04:42 +01:00
aszlig
b3337edd0b nixos/release.nix: Add a callSubTests function
This should de-clutter the various redundant lines of callTest's on
subtests so that every main test file should have only one line with a
callSubTests instead.

Overrides work the same way as callTest, except that if the system
attribute is explicitly specified we do not generate attributes for all
available systems.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @edolstra
2016-03-01 01:04:35 +01:00
aszlig
5bab623fb9 nixos/tests/virtualbox: Split up subtests
Now subtests are separate derivations, because the individual tests do
not depend on state from previous test runs.

This has the advantage that it's easier to run individiual tests and
it's also easier to pinpoint individual tests that randomly fail.

I ran all of these tests locally and they still succeed.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
2016-02-29 20:15:31 +01:00
39 changed files with 1329 additions and 1455 deletions

View File

@@ -11,7 +11,7 @@ if [[ $1 == nix ]]; then
# Make sure we can use hydra's binary cache
sudo mkdir /etc/nix
sudo sh -c 'echo "build-max-jobs = 4" > /etc/nix/nix.conf'
sudo echo "build-max-jobs = 4" > /etc/nix/nix.conf
# Verify evaluation
echo "=== Verifying that nixpkgs evaluates..."

View File

@@ -226,27 +226,6 @@ programs.ibus.plugins = with pkgs; [ ibus-anthy mozc ];
was removed. Please review the currently available options.</para>
</listitem>
<listitem>
<para>
The option <option>services.nsd.zones.&lt;name&gt;.data</option> no
longer interpret the dollar sign ($) as a shell variable, as such it
should not be escaped anymore. Thus the following zone data:
</para>
<programlisting>
\$ORIGIN example.com.
\$TTL 1800
@ IN SOA ns1.vpn.nbp.name. admin.example.com. (
</programlisting>
<para>
Should modified to look like the actual file expected by nsd:
</para>
<programlisting>
$ORIGIN example.com.
$TTL 1800
@ IN SOA ns1.vpn.nbp.name. admin.example.com. (
</programlisting>
</listitem>
</itemizedlist>

View File

@@ -0,0 +1,41 @@
{ config, pkgs, lib, ... }:
{
imports = [
];
options = {
gtkPlugins = lib.mkOption {
type = lib.types.listOf lib.types.path;
default = [];
description = ''
Plugin packages for GTK+ such as input methods.
'';
};
};
config = {
environment.variables = if builtins.length config.gtkPlugins > 0
then
let
paths = [ pkgs.gtk2 pkgs.gtk3 ] ++ config.gtkPlugins;
env = pkgs.buildEnv {
name = "gtk-exe-env";
inherit paths;
postBuild = lib.concatStringsSep "\n"
(map (d: d.gtkExeEnvPostBuild or "") paths);
ignoreCollisions = true;
};
in {
GTK_EXE_PREFIX = builtins.toString env;
GTK_PATH = [
"${env}/lib/gtk-2.0"
"${env}/lib/gtk-3.0"
];
}
else {};
};
}

View File

@@ -0,0 +1,37 @@
{ config, pkgs, lib, ... }:
{
imports = [
];
options = {
qtPlugins = lib.mkOption {
type = lib.types.listOf lib.types.path;
default = [];
description = ''
Plugin packages for Qt such as input methods.
'';
};
};
config = {
environment.variables = if builtins.length config.qtPlugins > 0
then
let
paths = [ pkgs.qt48 ] ++ config.qtPlugins;
env = pkgs.buildEnv {
name = "qt-plugin-env";
inherit paths;
postBuild = lib.concatStringsSep "\n"
(map (d: d.qtPluginEnvPostBuild or "") paths);
ignoreCollisions = true;
};
in {
QT_PLUGIN_PATH = [ (builtins.toString env) ];
}
else {};
};
}

View File

@@ -18,14 +18,10 @@ in
type = with types; listOf fcitxEngine;
default = [];
example = literalExample "with pkgs.fcitx-engines; [ mozc hangul ]";
description =
let
engines =
lib.concatStringsSep ", "
(map (name: "<literal>${name}</literal>")
(lib.attrNames pkgs.fcitx-engines));
in
"Enabled Fcitx engines. Available engines are: ${engines}.";
description = ''
Enabled Fcitx engines.
Available engines can be found by running `nix-env "&lt;nixpkgs&gt;" . -qaP -A fcitx-engines`.
'';
};
};
@@ -33,6 +29,8 @@ in
config = mkIf (config.i18n.inputMethod.enabled == "fcitx") {
environment.systemPackages = [ fcitxPackage ];
gtkPlugins = [ fcitxPackage ];
qtPlugins = [ fcitxPackage ];
environment.variables = {
GTK_IM_MODULE = "fcitx";

View File

@@ -4,6 +4,7 @@ with lib;
{
config = mkIf (config.i18n.inputMethod.enabled == "nabi") {
environment.systemPackages = [ pkgs.nabi ];
qtPlugins = [ pkgs.nabi ];
environment.variables = {
GTK_IM_MODULE = "nabi";

View File

@@ -23,6 +23,8 @@ in
config = mkIf (config.i18n.inputMethod.enabled == "uim") {
environment.systemPackages = [ pkgs.uim ];
gtkPlugins = [ pkgs.uim ];
qtPlugins = [ pkgs.uim ];
environment.variables = {
GTK_IM_MODULE = "uim";

View File

@@ -89,7 +89,7 @@ in
defaultChannel = mkOption {
internal = true;
type = types.str;
default = https://nixos.org/channels/nixos-16.03;
default = https://nixos.org/channels/nixos-unstable;
description = "Default NixOS channel to which the root user is subscribed.";
};

View File

@@ -7,6 +7,7 @@
./config/fonts/fonts.nix
./config/fonts/ghostscript.nix
./config/gnu.nix
./config/gtk-exe-env.nix
./config/i18n.nix
./config/krb5.nix
./config/ldap.nix
@@ -15,6 +16,7 @@
./config/nsswitch.nix
./config/power-management.nix
./config/pulseaudio.nix
./config/qt-plugin-env.nix
./config/shells-environment.nix
./config/swap.nix
./config/sysctl.nix
@@ -77,6 +79,7 @@
./programs/shell.nix
./programs/ssh.nix
./programs/ssmtp.nix
./programs/uim.nix
./programs/venus.nix
./programs/wvdial.nix
./programs/xfs_quota.nix

View File

@@ -0,0 +1,31 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.uim;
in
{
options = {
uim = {
enable = mkOption {
type = types.bool;
default = false;
example = true;
description = "Enable UIM input method";
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.uim ];
gtkPlugins = [ pkgs.uim ];
qtPlugins = [ pkgs.uim ];
environment.variables.GTK_IM_MODULE = "uim";
environment.variables.QT_IM_MODULE = "uim";
environment.variables.XMODIFIERS = "@im=uim";
services.xserver.displayManager.sessionCommands = "uim-xim &";
};
}

View File

@@ -100,7 +100,7 @@ in {
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = "${cfg.package}/sbin/collectd -C ${conf} -P ${cfg.pidFile}";
ExecStart = "${pkgs.collectd}/sbin/collectd -C ${conf} -P ${cfg.pidFile}";
Type = "forking";
PIDFile = cfg.pidFile;
User = optional (cfg.user!="root") cfg.user;

File diff suppressed because it is too large Load Diff

View File

@@ -48,7 +48,7 @@ in rec {
(all nixos.ova)
#(all nixos.tests.containers)
(all nixos.tests.chromium)
(all nixos.tests.chromium.stable)
(all nixos.tests.firefox)
(all nixos.tests.firewall)
nixos.tests.gnome3.x86_64-linux # FIXME: i686-linux
@@ -63,7 +63,7 @@ in rec {
(all nixos.tests.installer.btrfsSimple)
(all nixos.tests.installer.btrfsSubvols)
(all nixos.tests.installer.btrfsSubvolDefault)
(all nixos.tests.bootBiosCdrom)
(all nixos.tests.boot.biosCdrom)
(all nixos.tests.ipv6)
(all nixos.tests.kde4)
#(all nixos.tests.lightdm)

View File

@@ -9,11 +9,29 @@ let
version = builtins.readFile ../.version;
versionSuffix =
(if stableBranch then "." else "pre") + "${toString (nixpkgs.revCount - 77900)}.${nixpkgs.shortRev}";
(if stableBranch then "." else "pre") + "${toString nixpkgs.revCount}.${nixpkgs.shortRev}";
forAllSystems = genAttrs supportedSystems;
callTest = fn: args: forAllSystems (system: hydraJob (import fn ({ inherit system; } // args)));
importTest = fn: args: system: import fn ({
inherit system;
} // args);
callTest = fn: args: forAllSystems (system: hydraJob (importTest fn args system));
callSubTests = fn: args: let
discover = attrs: let
subTests = filterAttrs (const (hasAttr "test")) attrs;
in mapAttrs (const (t: hydraJob t.test)) subTests;
discoverForSystem = system: mapAttrs (_: test: {
${system} = test;
}) (discover (importTest fn args system));
# If the test is only for a particular system, use only the specified
# system instead of generating attributes for all available systems.
in if args ? system then discover (import fn args)
else foldAttrs (a: b: a // b) {} (map discoverForSystem supportedSystems);
pkgs = import nixpkgs { system = "x86_64-linux"; };
@@ -215,8 +233,9 @@ in rec {
tests.avahi = callTest tests/avahi.nix {};
tests.bittorrent = callTest tests/bittorrent.nix {};
tests.blivet = callTest tests/blivet.nix {};
tests.boot = callSubTests tests/boot.nix {};
tests.cadvisor = hydraJob (import tests/cadvisor.nix { system = "x86_64-linux"; });
tests.chromium = callTest tests/chromium.nix {};
tests.chromium = callSubTests tests/chromium.nix {};
tests.cjdns = callTest tests/cjdns.nix {};
tests.containers = callTest tests/containers.nix {};
tests.docker = hydraJob (import tests/docker.nix { system = "x86_64-linux"; });
@@ -232,18 +251,7 @@ in rec {
tests.gnome3-gdm = callTest tests/gnome3-gdm.nix {};
tests.grsecurity = callTest tests/grsecurity.nix {};
tests.i3wm = callTest tests/i3wm.nix {};
tests.installer.grub1 = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).grub1.test);
tests.installer.lvm = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).lvm.test);
tests.installer.luksroot = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).luksroot.test);
tests.installer.separateBoot = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).separateBoot.test);
tests.installer.separateBootFat = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).separateBootFat.test);
tests.installer.simple = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).simple.test);
tests.installer.simpleLabels = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).simpleLabels.test);
tests.installer.simpleProvided = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).simpleProvided.test);
tests.installer.swraid = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).swraid.test);
tests.installer.btrfsSimple = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).btrfsSimple.test);
tests.installer.btrfsSubvols = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).btrfsSubvols.test);
tests.installer.btrfsSubvolDefault = forAllSystems (system: hydraJob (import tests/installer.nix { inherit system; }).btrfsSubvolDefault.test);
tests.installer = callSubTests tests/installer.nix {};
tests.influxdb = callTest tests/influxdb.nix {};
tests.ipv6 = callTest tests/ipv6.nix {};
tests.jenkins = callTest tests/jenkins.nix {};
@@ -262,24 +270,8 @@ in rec {
tests.mysqlReplication = callTest tests/mysql-replication.nix {};
tests.nat.firewall = callTest tests/nat.nix { withFirewall = true; };
tests.nat.standalone = callTest tests/nat.nix { withFirewall = false; };
tests.networking.networkd.loopback = callTest tests/networking.nix { networkd = true; test = "loopback"; };
tests.networking.networkd.static = callTest tests/networking.nix { networkd = true; test = "static"; };
tests.networking.networkd.dhcpSimple = callTest tests/networking.nix { networkd = true; test = "dhcpSimple"; };
tests.networking.networkd.dhcpOneIf = callTest tests/networking.nix { networkd = true; test = "dhcpOneIf"; };
tests.networking.networkd.bond = callTest tests/networking.nix { networkd = true; test = "bond"; };
tests.networking.networkd.bridge = callTest tests/networking.nix { networkd = true; test = "bridge"; };
tests.networking.networkd.macvlan = callTest tests/networking.nix { networkd = true; test = "macvlan"; };
tests.networking.networkd.sit = callTest tests/networking.nix { networkd = true; test = "sit"; };
tests.networking.networkd.vlan = callTest tests/networking.nix { networkd = true; test = "vlan"; };
tests.networking.scripted.loopback = callTest tests/networking.nix { networkd = false; test = "loopback"; };
tests.networking.scripted.static = callTest tests/networking.nix { networkd = false; test = "static"; };
tests.networking.scripted.dhcpSimple = callTest tests/networking.nix { networkd = false; test = "dhcpSimple"; };
tests.networking.scripted.dhcpOneIf = callTest tests/networking.nix { networkd = false; test = "dhcpOneIf"; };
tests.networking.scripted.bond = callTest tests/networking.nix { networkd = false; test = "bond"; };
tests.networking.scripted.bridge = callTest tests/networking.nix { networkd = false; test = "bridge"; };
tests.networking.scripted.macvlan = callTest tests/networking.nix { networkd = false; test = "macvlan"; };
tests.networking.scripted.sit = callTest tests/networking.nix { networkd = false; test = "sit"; };
tests.networking.scripted.vlan = callTest tests/networking.nix { networkd = false; test = "vlan"; };
tests.networking.networkd = callSubTests tests/networking.nix { networkd = true; };
tests.networking.scripted = callSubTests tests/networking.nix { networkd = false; };
# TODO: put in networking.nix after the test becomes more complete
tests.networkingProxy = callTest tests/networking-proxy.nix {};
tests.nfs3 = callTest tests/nfs.nix { version = 3; };
@@ -299,12 +291,8 @@ in rec {
tests.simple = callTest tests/simple.nix {};
tests.tomcat = callTest tests/tomcat.nix {};
tests.udisks2 = callTest tests/udisks2.nix {};
tests.virtualbox = hydraJob (import tests/virtualbox.nix { system = "x86_64-linux"; });
tests.virtualbox = callSubTests tests/virtualbox.nix { system = "x86_64-linux"; };
tests.xfce = callTest tests/xfce.nix {};
tests.bootBiosCdrom = forAllSystems (system: hydraJob (import tests/boot.nix { inherit system; }).bootBiosCdrom);
tests.bootBiosUsb = forAllSystems (system: hydraJob (import tests/boot.nix { inherit system; }).bootBiosUsb);
tests.bootUefiCdrom = forAllSystems (system: hydraJob (import tests/boot.nix { inherit system; }).bootUefiCdrom);
tests.bootUefiUsb = forAllSystems (system: hydraJob (import tests/boot.nix { inherit system; }).bootUefiUsb);
/* Build a bunch of typical closures so that Hydra can keep track of

View File

@@ -30,17 +30,17 @@ let
'';
};
in {
bootBiosCdrom = makeBootTest "bios-cdrom" ''
biosCdrom = makeBootTest "bios-cdrom" ''
cdrom => glob("${iso}/iso/*.iso")
'';
bootBiosUsb = makeBootTest "bios-usb" ''
biosUsb = makeBootTest "bios-usb" ''
usb => glob("${iso}/iso/*.iso")
'';
bootUefiCdrom = makeBootTest "uefi-cdrom" ''
uefiCdrom = makeBootTest "uefi-cdrom" ''
cdrom => glob("${iso}/iso/*.iso"),
bios => '${pkgs.OVMF}/FV/OVMF.fd'
'';
bootUefiUsb = makeBootTest "uefi-usb" ''
uefiUsb = makeBootTest "uefi-usb" ''
usb => glob("${iso}/iso/*.iso"),
bios => '${pkgs.OVMF}/FV/OVMF.fd'
'';

View File

@@ -1,13 +1,10 @@
import ./make-test.nix (
{ pkgs
, channelMap ? {
stable = pkgs.chromium;
#beta = pkgs.chromiumBeta;
#dev = pkgs.chromiumDev;
}
, ...
}: rec {
name = "chromium";
{ system ? builtins.currentSystem }:
with import ../lib/testing.nix { inherit system; };
with pkgs.lib;
mapAttrs (channel: chromiumPkg: makeTest rec {
name = "chromium-${channel}";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ aszlig ];
};
@@ -16,6 +13,7 @@ import ./make-test.nix (
machine.imports = [ ./common/x11.nix ];
machine.virtualisation.memorySize = 2047;
machine.environment.systemPackages = [ chromiumPkg ];
startupHTML = pkgs.writeText "chromium-startup.html" ''
<!DOCTYPE html>
@@ -105,74 +103,65 @@ import ./make-test.nix (
closeWin;
}
sub chromiumTest {
my ($channel, $pkg, $code) = @_;
$machine->waitForX;
$machine->waitForX;
my $url = "file://${startupHTML}";
my $args = "--user-data-dir=/tmp/chromium-$channel";
$machine->execute(
"ulimit -c unlimited; ".
"$pkg/bin/chromium $args \"$url\" & disown"
);
$machine->waitForText(qr/Type to search or enter a URL to navigate/);
$machine->waitUntilSucceeds("${xdo "check-startup" ''
search --sync --onlyvisible --name "startup done"
# close first start help popup
key -delay 1000 Escape
my $url = "file://${startupHTML}";
my $args = "--user-data-dir=/tmp/chromium-${channel}";
$machine->execute(
"ulimit -c unlimited; ".
"chromium $args \"$url\" & disown"
);
$machine->waitForText(qr/Type to search or enter a URL to navigate/);
$machine->waitUntilSucceeds("${xdo "check-startup" ''
search --sync --onlyvisible --name "startup done"
# close first start help popup
key -delay 1000 Escape
windowfocus --sync
windowactivate --sync
''}");
createAndWaitForNewWin;
$machine->screenshot("empty_windows");
closeWin;
$machine->screenshot("startup_done");
testNewWin "check sandbox", sub {
$machine->succeed("${xdo "type-url" ''
search --sync --onlyvisible --name "new tab"
windowfocus --sync
windowactivate --sync
type --delay 1000 "chrome://sandbox"
''}");
createAndWaitForNewWin;
$machine->screenshot($channel."_emptywin");
closeWin;
$machine->succeed("${xdo "submit-url" ''
search --sync --onlyvisible --name "new tab"
windowfocus --sync
key --delay 1000 Return
''}");
$machine->screenshot($channel."_startup_done");
$machine->screenshot("sandbox_info");
subtest("Chromium $channel", $code);
$machine->succeed("${xdo "submit-url" ''
search --sync --onlyvisible --name "sandbox status"
windowfocus --sync
''}");
$machine->succeed("${xdo "submit-url" ''
key --delay 1000 Ctrl+a Ctrl+c
''}");
$machine->shutdown;
}
my $clipboard = $machine->succeed("${pkgs.xclip}/bin/xclip -o");
die "sandbox not working properly: $clipboard"
unless $clipboard =~ /namespace sandbox.*yes/mi
&& $clipboard =~ /pid namespaces.*yes/mi
&& $clipboard =~ /network namespaces.*yes/mi
&& $clipboard =~ /seccomp.*sandbox.*yes/mi
&& $clipboard =~ /you are adequately sandboxed/mi;
};
for (${let
mkArray = name: pkg: "[\"${name}\", \"${pkg}\"]";
chanArrays = pkgs.lib.mapAttrsToList mkArray channelMap;
in pkgs.lib.concatStringsSep ", " chanArrays}) {
my ($channel, $pkg) = @$_;
chromiumTest $channel, $pkg, sub {
testNewWin "check sandbox", sub {
$machine->succeed("${xdo "type-url" ''
search --sync --onlyvisible --name "new tab"
windowfocus --sync
type --delay 1000 "chrome://sandbox"
''}");
$machine->succeed("${xdo "submit-url" ''
search --sync --onlyvisible --name "new tab"
windowfocus --sync
key --delay 1000 Return
''}");
$machine->screenshot($channel."_sandbox");
$machine->succeed("${xdo "submit-url" ''
search --sync --onlyvisible --name "sandbox status"
windowfocus --sync
''}");
$machine->succeed("${xdo "submit-url" ''
key --delay 1000 Ctrl+a Ctrl+c
''}");
my $clipboard = $machine->succeed("${pkgs.xclip}/bin/xclip -o");
die "sandbox not working properly: $clipboard"
unless $clipboard =~ /namespace sandbox.*yes/mi
&& $clipboard =~ /pid namespaces.*yes/mi
&& $clipboard =~ /network namespaces.*yes/mi
&& $clipboard =~ /seccomp.*sandbox.*yes/mi
&& $clipboard =~ /you are adequately sandboxed/mi;
};
};
}
$machine->shutdown;
'';
})
}) {
stable = pkgs.chromium;
beta = pkgs.chromiumBeta;
dev = pkgs.chromiumDev;
}

View File

@@ -1,406 +1,411 @@
import ./make-test.nix ({ pkgs, networkd, test, ... }:
let
router = { config, pkgs, ... }:
with pkgs.lib;
let
vlanIfs = range 1 (length config.virtualisation.vlans);
in {
virtualisation.vlans = [ 1 2 3 ];
{ system ? builtins.currentSystem, networkd }:
with import ../lib/testing.nix { inherit system; };
with pkgs.lib;
let
router = { config, pkgs, ... }:
with pkgs.lib;
let
vlanIfs = range 1 (length config.virtualisation.vlans);
in {
virtualisation.vlans = [ 1 2 3 ];
networking = {
useDHCP = false;
useNetworkd = networkd;
firewall.allowPing = true;
interfaces = mkOverride 0 (listToAttrs (flip map vlanIfs (n:
nameValuePair "eth${toString n}" {
ipAddress = "192.168.${toString n}.1";
prefixLength = 24;
})));
};
services.dhcpd = {
enable = true;
interfaces = map (n: "eth${toString n}") vlanIfs;
extraConfig = ''
option subnet-mask 255.255.255.0;
'' + flip concatMapStrings vlanIfs (n: ''
subnet 192.168.${toString n}.0 netmask 255.255.255.0 {
option broadcast-address 192.168.${toString n}.255;
option routers 192.168.${toString n}.1;
range 192.168.${toString n}.2 192.168.${toString n}.254;
}
'');
};
};
testCases = {
loopback = {
name = "Loopback";
machine.networking.useNetworkd = networkd;
testScript = ''
startAll;
$machine->waitForUnit("network-interfaces.target");
$machine->waitForUnit("network.target");
$machine->succeed("ip addr show lo | grep -q 'inet 127.0.0.1/8 '");
$machine->succeed("ip addr show lo | grep -q 'inet6 ::1/128 '");
'';
};
static = {
name = "Static";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useDHCP = false;
useNetworkd = networkd;
firewall.allowPing = true;
interfaces = mkOverride 0 (listToAttrs (flip map vlanIfs (n:
nameValuePair "eth${toString n}" {
ipAddress = "192.168.${toString n}.1";
prefixLength = 24;
})));
};
services.dhcpd = {
enable = true;
interfaces = map (n: "eth${toString n}") vlanIfs;
extraConfig = ''
option subnet-mask 255.255.255.0;
'' + flip concatMapStrings vlanIfs (n: ''
subnet 192.168.${toString n}.0 netmask 255.255.255.0 {
option broadcast-address 192.168.${toString n}.255;
option routers 192.168.${toString n}.1;
range 192.168.${toString n}.2 192.168.${toString n}.254;
}
'');
useDHCP = false;
defaultGateway = "192.168.1.1";
interfaces.eth1.ip4 = mkOverride 0 [
{ address = "192.168.1.2"; prefixLength = 24; }
{ address = "192.168.1.3"; prefixLength = 32; }
{ address = "192.168.1.10"; prefixLength = 32; }
];
interfaces.eth2.ip4 = mkOverride 0 [
{ address = "192.168.2.2"; prefixLength = 24; }
];
};
};
testCases = {
loopback = {
name = "Loopback";
machine.networking.useNetworkd = networkd;
testScript = ''
testScript = { nodes, ... }:
''
startAll;
$machine->waitForUnit("network-interfaces.target");
$machine->waitForUnit("network.target");
$machine->succeed("ip addr show lo | grep -q 'inet 127.0.0.1/8 '");
$machine->succeed("ip addr show lo | grep -q 'inet6 ::1/128 '");
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Make sure dhcpcd is not started
$client->fail("systemctl status dhcpcd.service");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client->waitUntilSucceeds("ping -c 1 192.168.1.3");
$client->waitUntilSucceeds("ping -c 1 192.168.1.10");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.10");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->waitUntilSucceeds("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->waitUntilSucceeds("ping -c 1 192.168.2.2");
# Test default gateway
$router->waitUntilSucceeds("ping -c 1 192.168.3.1");
$client->waitUntilSucceeds("ping -c 1 192.168.3.1");
'';
};
static = {
name = "Static";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
defaultGateway = "192.168.1.1";
interfaces.eth1.ip4 = mkOverride 0 [
{ address = "192.168.1.2"; prefixLength = 24; }
{ address = "192.168.1.3"; prefixLength = 32; }
{ address = "192.168.1.10"; prefixLength = 32; }
];
interfaces.eth2.ip4 = mkOverride 0 [
{ address = "192.168.2.2"; prefixLength = 24; }
];
};
};
testScript = { nodes, ... }:
''
startAll;
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Make sure dhcpcd is not started
$client->fail("systemctl status dhcpcd.service");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client->waitUntilSucceeds("ping -c 1 192.168.1.3");
$client->waitUntilSucceeds("ping -c 1 192.168.1.10");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.10");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->waitUntilSucceeds("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->waitUntilSucceeds("ping -c 1 192.168.2.2");
# Test default gateway
$router->waitUntilSucceeds("ping -c 1 192.168.3.1");
$client->waitUntilSucceeds("ping -c 1 192.168.3.1");
'';
};
dhcpSimple = {
name = "SimpleDHCP";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = true;
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
$client->waitUntilSucceeds("ip addr show dev eth2 | grep -q '192.168.2'");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->waitUntilSucceeds("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->waitUntilSucceeds("ping -c 1 192.168.2.2");
'';
};
dhcpOneIf = {
name = "OneInterfaceDHCP";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
interfaces.eth1 = {
ip4 = mkOverride 0 [ ];
useDHCP = true;
};
interfaces.eth2.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->fail("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->fail("ping -c 1 192.168.2.2");
'';
};
bond = let
node = address: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
bonds.bond = {
mode = "balance-rr";
interfaces = [ "eth1" "eth2" ];
};
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
interfaces.bond.ip4 = mkOverride 0
[ { inherit address; prefixLength = 30; } ];
};
};
in {
name = "Bond";
nodes.client1 = node "192.168.1.1";
nodes.client2 = node "192.168.1.2";
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Test bonding
$client1->waitUntilSucceeds("ping -c 2 192.168.1.1");
$client1->waitUntilSucceeds("ping -c 2 192.168.1.2");
$client2->waitUntilSucceeds("ping -c 2 192.168.1.1");
$client2->waitUntilSucceeds("ping -c 2 192.168.1.2");
'';
};
bridge = let
node = { address, vlan }: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ vlan ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
interfaces.eth1.ip4 = mkOverride 0
[ { inherit address; prefixLength = 24; } ];
};
};
in {
name = "Bridge";
nodes.client1 = node { address = "192.168.1.2"; vlan = 1; };
nodes.client2 = node { address = "192.168.1.3"; vlan = 2; };
nodes.router = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
bridges.bridge.interfaces = [ "eth1" "eth2" ];
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
interfaces.bridge.ip4 = mkOverride 0
[ { address = "192.168.1.1"; prefixLength = 24; } ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Test bridging
$client1->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client1->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client1->waitUntilSucceeds("ping -c 1 192.168.1.3");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
'';
};
macvlan = {
name = "MACVLAN";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = true;
macvlans.macvlan.interface = "eth1";
interfaces.eth1.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
$client->waitUntilSucceeds("ip addr show dev macvlan | grep -q '192.168.1'");
# Print diagnosting information
$router->succeed("ip addr >&2");
$client->succeed("ip addr >&2");
# Test macvlan creates routable ips
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
'';
};
sit = let
node = { address4, remote, address6 }: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.enable = false;
useDHCP = false;
sits.sit = {
inherit remote;
local = address4;
dev = "eth1";
};
interfaces.eth1.ip4 = mkOverride 0
[ { address = address4; prefixLength = 24; } ];
interfaces.sit.ip6 = mkOverride 0
[ { address = address6; prefixLength = 64; } ];
};
};
in {
name = "Sit";
nodes.client1 = node { address4 = "192.168.1.1"; remote = "192.168.1.2"; address6 = "fc00::1"; };
nodes.client2 = node { address4 = "192.168.1.2"; remote = "192.168.1.1"; address6 = "fc00::2"; };
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to be configured
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Print diagnostic information
$client1->succeed("ip addr >&2");
$client2->succeed("ip addr >&2");
# Test ipv6
$client1->waitUntilSucceeds("ping6 -c 1 fc00::1");
$client1->waitUntilSucceeds("ping6 -c 1 fc00::2");
$client2->waitUntilSucceeds("ping6 -c 1 fc00::1");
$client2->waitUntilSucceeds("ping6 -c 1 fc00::2");
'';
};
vlan = let
node = address: { config, pkgs, ... }: with pkgs.lib; {
#virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
vlans.vlan = {
id = 1;
interface = "eth0";
};
interfaces.eth0.ip4 = mkOverride 0 [ ];
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.vlan.ip4 = mkOverride 0
[ { inherit address; prefixLength = 24; } ];
};
};
in {
name = "vlan";
nodes.client1 = node "192.168.1.1";
nodes.client2 = node "192.168.1.2";
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to be configured
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Test vlan is setup
$client1->succeed("ip addr show dev vlan >&2");
$client2->succeed("ip addr show dev vlan >&2");
'';
};
};
case = testCases.${test};
in case // {
name = "${case.name}-Networking-${if networkd then "Networkd" else "Scripted"}";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ wkennington ];
dhcpSimple = {
name = "SimpleDHCP";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = true;
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
$client->waitUntilSucceeds("ip addr show dev eth2 | grep -q '192.168.2'");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->waitUntilSucceeds("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->waitUntilSucceeds("ping -c 1 192.168.2.2");
'';
};
})
dhcpOneIf = {
name = "OneInterfaceDHCP";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
interfaces.eth1 = {
ip4 = mkOverride 0 [ ];
useDHCP = true;
};
interfaces.eth2.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
# Test vlan 1
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
# Test vlan 2
$client->waitUntilSucceeds("ping -c 1 192.168.2.1");
$client->fail("ping -c 1 192.168.2.2");
$router->waitUntilSucceeds("ping -c 1 192.168.2.1");
$router->fail("ping -c 1 192.168.2.2");
'';
};
bond = let
node = address: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
bonds.bond = {
mode = "balance-rr";
interfaces = [ "eth1" "eth2" ];
};
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
interfaces.bond.ip4 = mkOverride 0
[ { inherit address; prefixLength = 30; } ];
};
};
in {
name = "Bond";
nodes.client1 = node "192.168.1.1";
nodes.client2 = node "192.168.1.2";
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Test bonding
$client1->waitUntilSucceeds("ping -c 2 192.168.1.1");
$client1->waitUntilSucceeds("ping -c 2 192.168.1.2");
$client2->waitUntilSucceeds("ping -c 2 192.168.1.1");
$client2->waitUntilSucceeds("ping -c 2 192.168.1.2");
'';
};
bridge = let
node = { address, vlan }: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ vlan ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
interfaces.eth1.ip4 = mkOverride 0
[ { inherit address; prefixLength = 24; } ];
};
};
in {
name = "Bridge";
nodes.client1 = node { address = "192.168.1.2"; vlan = 1; };
nodes.client2 = node { address = "192.168.1.3"; vlan = 2; };
nodes.router = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 2 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
bridges.bridge.interfaces = [ "eth1" "eth2" ];
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.eth2.ip4 = mkOverride 0 [ ];
interfaces.bridge.ip4 = mkOverride 0
[ { address = "192.168.1.1"; prefixLength = 24; } ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Test bridging
$client1->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client1->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client1->waitUntilSucceeds("ping -c 1 192.168.1.3");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client2->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
'';
};
macvlan = {
name = "MACVLAN";
nodes.router = router;
nodes.client = { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = true;
macvlans.macvlan.interface = "eth1";
interfaces.eth1.ip4 = mkOverride 0 [ ];
};
};
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to come up
$client->waitForUnit("network-interfaces.target");
$client->waitForUnit("network.target");
$router->waitForUnit("network-interfaces.target");
$router->waitForUnit("network.target");
# Wait until we have an ip address on each interface
$client->waitUntilSucceeds("ip addr show dev eth1 | grep -q '192.168.1'");
$client->waitUntilSucceeds("ip addr show dev macvlan | grep -q '192.168.1'");
# Print diagnosting information
$router->succeed("ip addr >&2");
$client->succeed("ip addr >&2");
# Test macvlan creates routable ips
$client->waitUntilSucceeds("ping -c 1 192.168.1.1");
$client->waitUntilSucceeds("ping -c 1 192.168.1.2");
$client->waitUntilSucceeds("ping -c 1 192.168.1.3");
$router->waitUntilSucceeds("ping -c 1 192.168.1.1");
$router->waitUntilSucceeds("ping -c 1 192.168.1.2");
$router->waitUntilSucceeds("ping -c 1 192.168.1.3");
'';
};
sit = let
node = { address4, remote, address6 }: { config, pkgs, ... }: with pkgs.lib; {
virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.enable = false;
useDHCP = false;
sits.sit = {
inherit remote;
local = address4;
dev = "eth1";
};
interfaces.eth1.ip4 = mkOverride 0
[ { address = address4; prefixLength = 24; } ];
interfaces.sit.ip6 = mkOverride 0
[ { address = address6; prefixLength = 64; } ];
};
};
in {
name = "Sit";
nodes.client1 = node { address4 = "192.168.1.1"; remote = "192.168.1.2"; address6 = "fc00::1"; };
nodes.client2 = node { address4 = "192.168.1.2"; remote = "192.168.1.1"; address6 = "fc00::2"; };
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to be configured
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Print diagnostic information
$client1->succeed("ip addr >&2");
$client2->succeed("ip addr >&2");
# Test ipv6
$client1->waitUntilSucceeds("ping6 -c 1 fc00::1");
$client1->waitUntilSucceeds("ping6 -c 1 fc00::2");
$client2->waitUntilSucceeds("ping6 -c 1 fc00::1");
$client2->waitUntilSucceeds("ping6 -c 1 fc00::2");
'';
};
vlan = let
node = address: { config, pkgs, ... }: with pkgs.lib; {
#virtualisation.vlans = [ 1 ];
networking = {
useNetworkd = networkd;
firewall.allowPing = true;
useDHCP = false;
vlans.vlan = {
id = 1;
interface = "eth0";
};
interfaces.eth0.ip4 = mkOverride 0 [ ];
interfaces.eth1.ip4 = mkOverride 0 [ ];
interfaces.vlan.ip4 = mkOverride 0
[ { inherit address; prefixLength = 24; } ];
};
};
in {
name = "vlan";
nodes.client1 = node "192.168.1.1";
nodes.client2 = node "192.168.1.2";
testScript = { nodes, ... }:
''
startAll;
# Wait for networking to be configured
$client1->waitForUnit("network-interfaces.target");
$client1->waitForUnit("network.target");
$client2->waitForUnit("network-interfaces.target");
$client2->waitForUnit("network.target");
# Test vlan is setup
$client1->succeed("ip addr show dev vlan >&2");
$client2->succeed("ip addr show dev vlan >&2");
'';
};
};
in mapAttrs (const (attrs: makeTest (attrs // {
name = "${attrs.name}-Networking-${if networkd then "Networkd" else "Scripted"}";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ wkennington ];
};
}))) testCases

View File

@@ -1,7 +1,9 @@
{ debug ? false, ... } @ args:
{ system ? builtins.currentSystem, debug ? false }:
import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
with import ../lib/testing.nix { inherit system; };
with pkgs.lib;
let
testVMConfig = vmName: attrs: { config, pkgs, ... }: let
guestAdditions = pkgs.linuxPackages.virtualboxGuestAdditions;
@@ -314,138 +316,140 @@ import ./make-test.nix ({ pkgs, ... }: with pkgs.lib; let
test2.vmScript = dhcpScript;
};
in {
name = "virtualbox";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ aszlig wkennington ];
};
mkVBoxTest = name: testScript: makeTest {
name = "virtualbox-${name}";
machine = { pkgs, lib, config, ... }: {
imports = let
mkVMConf = name: val: val.machine // { key = "${name}-config"; };
vmConfigs = mapAttrsToList mkVMConf vboxVMs;
in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs;
virtualisation.memorySize = 2048;
virtualisation.virtualbox.host.enable = true;
users.extraUsers.alice.extraGroups = let
inherit (config.virtualisation.virtualbox.host) enableHardening;
in lib.mkIf enableHardening (lib.singleton "vboxusers");
};
testScript = ''
sub ru ($) {
my $esc = $_[0] =~ s/'/'\\${"'"}'/gr;
return "su - alice -c '$esc'";
}
sub vbm {
$machine->succeed(ru("VBoxManage ".$_[0]));
machine = { lib, config, ... }: {
imports = let
mkVMConf = name: val: val.machine // { key = "${name}-config"; };
vmConfigs = mapAttrsToList mkVMConf vboxVMs;
in [ ./common/user-account.nix ./common/x11.nix ] ++ vmConfigs;
virtualisation.memorySize = 2048;
virtualisation.virtualbox.host.enable = true;
users.extraUsers.alice.extraGroups = let
inherit (config.virtualisation.virtualbox.host) enableHardening;
in lib.mkIf enableHardening (lib.singleton "vboxusers");
};
${concatStrings (mapAttrsToList (_: getAttr "testSubs") vboxVMs)}
testScript = ''
sub ru ($) {
my $esc = $_[0] =~ s/'/'\\${"'"}'/gr;
return "su - alice -c '$esc'";
}
$machine->waitForX;
sub vbm {
$machine->succeed(ru("VBoxManage ".$_[0]));
};
${mkLog "$HOME/.config/VirtualBox/VBoxSVC.log" "HOST-SVC"}
sub removeUUIDs {
return join("\n", grep { $_ !~ /^UUID:/ } split(/\n/, $_[0]))."\n";
}
${concatStrings (mapAttrsToList (_: getAttr "testSubs") vboxVMs)}
$machine->waitForX;
${mkLog "$HOME/.config/VirtualBox/VBoxSVC.log" "HOST-SVC"}
${testScript}
'';
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ aszlig wkennington ];
};
};
in mapAttrs mkVBoxTest {
simple-gui = ''
createVM_simple;
subtest "simple-gui", sub {
$machine->succeed(ru "VirtualBox &");
$machine->waitForWindow(qr/Oracle VM VirtualBox Manager/);
$machine->sleep(5);
$machine->screenshot("gui_manager_started");
$machine->succeed(ru "VirtualBox &");
$machine->waitForWindow(qr/Oracle VM VirtualBox Manager/);
$machine->sleep(5);
$machine->screenshot("gui_manager_started");
$machine->sendKeys("ret");
$machine->screenshot("gui_manager_sent_startup");
waitForStartup_simple (sub {
$machine->sendKeys("ret");
$machine->screenshot("gui_manager_sent_startup");
waitForStartup_simple (sub {
$machine->sendKeys("ret");
});
$machine->screenshot("gui_started");
waitForVMBoot_simple;
$machine->screenshot("gui_booted");
shutdownVM_simple;
$machine->sleep(5);
$machine->screenshot("gui_stopped");
$machine->sendKeys("ctrl-q");
$machine->sleep(5);
$machine->screenshot("gui_manager_stopped");
};
});
$machine->screenshot("gui_started");
waitForVMBoot_simple;
$machine->screenshot("gui_booted");
shutdownVM_simple;
$machine->sleep(5);
$machine->screenshot("gui_stopped");
$machine->sendKeys("ctrl-q");
$machine->sleep(5);
$machine->screenshot("gui_manager_stopped");
'';
cleanup_simple;
simple-cli = ''
createVM_simple;
vbm("startvm simple");
waitForStartup_simple;
$machine->screenshot("cli_started");
waitForVMBoot_simple;
$machine->screenshot("cli_booted");
subtest "simple-cli", sub {
vbm("startvm simple");
waitForStartup_simple;
$machine->screenshot("cli_started");
waitForVMBoot_simple;
$machine->screenshot("cli_booted");
shutdownVM_simple;
};
subtest "privilege-escalation", sub {
$machine->nest("Checking for privilege escalation", sub {
$machine->fail("test -e '/root/VirtualBox VMs'");
$machine->fail("test -e '/root/.config/VirtualBox'");
$machine->succeed("test -e '/home/alice/VirtualBox VMs'");
};
});
destroyVM_simple;
sub removeUUIDs {
return join("\n", grep { $_ !~ /^UUID:/ } split(/\n/, $_[0]))."\n";
}
subtest "host-usb-permissions", sub {
my $userUSB = removeUUIDs vbm("list usbhost");
print STDERR $userUSB;
my $rootUSB = removeUUIDs $machine->succeed("VBoxManage list usbhost");
print STDERR $rootUSB;
die "USB host devices differ for root and normal user"
if $userUSB ne $rootUSB;
die "No USB host devices found" if $userUSB =~ /<none>/;
};
subtest "systemd-detect-virt", sub {
createVM_detectvirt;
vbm("startvm detectvirt");
waitForStartup_detectvirt;
waitForVMBoot_detectvirt;
shutdownVM_detectvirt;
my $result = $machine->succeed("cat '$detectvirt_sharepath/result'");
chomp $result;
destroyVM_detectvirt;
die "systemd-detect-virt returned \"$result\" instead of \"oracle\""
if $result ne "oracle";
};
subtest "net-hostonlyif", sub {
createVM_test1;
createVM_test2;
vbm("startvm test1");
waitForStartup_test1;
waitForVMBoot_test1;
vbm("startvm test2");
waitForStartup_test2;
waitForVMBoot_test2;
$machine->screenshot("net_booted");
my $test1IP = waitForIP_test1 1;
my $test2IP = waitForIP_test2 1;
$machine->succeed("echo '$test2IP' | netcat -c '$test1IP' 1234");
$machine->succeed("echo '$test1IP' | netcat -c '$test2IP' 1234");
$machine->waitUntilSucceeds("netcat -c '$test1IP' 5678 >&2");
$machine->waitUntilSucceeds("netcat -c '$test2IP' 5678 >&2");
shutdownVM_test1;
shutdownVM_test2;
destroyVM_test1;
destroyVM_test2;
};
shutdownVM_simple;
'';
}) args
host-usb-permissions = ''
my $userUSB = removeUUIDs vbm("list usbhost");
print STDERR $userUSB;
my $rootUSB = removeUUIDs $machine->succeed("VBoxManage list usbhost");
print STDERR $rootUSB;
die "USB host devices differ for root and normal user"
if $userUSB ne $rootUSB;
die "No USB host devices found" if $userUSB =~ /<none>/;
'';
systemd-detect-virt = ''
createVM_detectvirt;
vbm("startvm detectvirt");
waitForStartup_detectvirt;
waitForVMBoot_detectvirt;
shutdownVM_detectvirt;
my $result = $machine->succeed("cat '$detectvirt_sharepath/result'");
chomp $result;
destroyVM_detectvirt;
die "systemd-detect-virt returned \"$result\" instead of \"oracle\""
if $result ne "oracle";
'';
net-hostonlyif = ''
createVM_test1;
createVM_test2;
vbm("startvm test1");
waitForStartup_test1;
waitForVMBoot_test1;
vbm("startvm test2");
waitForStartup_test2;
waitForVMBoot_test2;
$machine->screenshot("net_booted");
my $test1IP = waitForIP_test1 1;
my $test2IP = waitForIP_test2 1;
$machine->succeed("echo '$test2IP' | netcat -c '$test1IP' 1234");
$machine->succeed("echo '$test1IP' | netcat -c '$test2IP' 1234");
$machine->waitUntilSucceeds("netcat -c '$test1IP' 5678 >&2");
$machine->waitUntilSucceeds("netcat -c '$test2IP' 5678 >&2");
shutdownVM_test1;
shutdownVM_test2;
destroyVM_test1;
destroyVM_test2;
'';
}

View File

@@ -1,6 +1,5 @@
{ stdenv, fetchurl
, ncurses
, texinfo
, gettext ? null
, enableNls ? true
, enableTiny ? false
@@ -17,8 +16,7 @@ stdenv.mkDerivation rec {
url = "mirror://gnu/nano/${name}.tar.gz";
sha256 = "1vl9bim56k1b4zwc3icxp46w6pn6gb042j1h4jlz1jklxxpkwcpz";
};
buildInputs = [ ncurses texinfo ] ++ optional enableNls gettext;
outputs = [ "out" "info" ];
buildInputs = [ ncurses ] ++ optional enableNls gettext;
configureFlags = ''
--sysconfdir=/etc
${optionalString (!enableNls) "--disable-nls"}

View File

@@ -1,4 +1,4 @@
{ stdenv, fetchFromGitHub, cmake, libX11, procps, python, libdwarf, qtbase, qtwebkit }:
{ stdenv, fetchFromGitHub, cmake, libX11, procps, python, qtbase }:
stdenv.mkDerivation rec {
name = "apitrace-${version}";
@@ -11,12 +11,14 @@ stdenv.mkDerivation rec {
owner = "apitrace";
};
# LD_PRELOAD wrappers need to be statically linked to work against all kinds
# of games -- so it's fine to use e.g. bundled snappy.
buildInputs = [ libX11 procps python libdwarf qtbase qtwebkit ];
buildInputs = [ libX11 procps python qtbase ];
nativeBuildInputs = [ cmake ];
buildPhase = ''
cmake
make
'';
meta = with stdenv.lib; {
homepage = https://apitrace.github.io;
description = "Tools to trace OpenGL, OpenGL ES, Direct3D, and DirectDraw APIs";

View File

@@ -1,47 +1,55 @@
{ fetchurl, fetchhg, stdenv, xorg, makeWrapper }:
{ fetchurl, fetchhg, stdenv, xorg, gcc46, makeWrapper }:
stdenv.mkDerivation rec {
# Inferno is a rolling release from a mercurial repository. For the verison number
# of the package I'm using the mercurial commit number.
rev = "785";
name = "inferno-${rev}";
host = "Linux";
objtype = "386";
version = "645";
name = "inferno-${version}";
src = fetchhg {
url = "https://bitbucket.org/inferno-os/inferno-os";
sha256 = "1b428ma9fi5skvfrxp91dr43a62kax89wmx7950ahc1cxyx90k7x";
# The mercurial repository does not contain all the components needed for the
# runtime system. The 'base' package contains these. For this package I download
# the base, extract the elements required from that, and add them to the source
# pulled from the mercurial repository.
srcBase = fetchurl {
url = "http://www.vitanuova.com/dist/4e/inferno-20100120.tgz";
sha256 = "0msvy3iwl4n5k0ry0xiyysjkq0qsawmwn3hvg67hbi5y8g7f7l88";
};
buildInputs = [ makeWrapper ] ++ (with xorg; [ libX11 libXpm libXext xextproto ]);
src = fetchhg {
url = "https://inferno-os.googlecode.com/hg";
rev = "7ab390b860ca";
sha256 = "09y0iclb3yy10gw1p0182sddg64xh60q2fx4ai7lxyfb65i76qbh";
};
# Fails with gcc48 due to inferno triggering an optimisation issue with floating point.
buildInputs = [ gcc46 xorg.libX11 xorg.libXpm xorg.libXext xorg.xextproto makeWrapper ];
infernoWrapper = ./inferno;
configurePhase = ''
sed -e 's@^ROOT=.*$@ROOT='"$out"'/share/inferno@g' \
-e 's@^OBJTYPE=.*$@OBJTYPE=${objtype}@g' \
-e 's@^SYSHOST=.*$@SYSHOST=${host}@g' \
-i mkconfig
# Get rid of an annoying warning
sed -e 's/_BSD_SOURCE/_DEFAULT_SOURCE/g' \
-i ${host}/${objtype}/include/lib9.h
tar --strip-components=1 -xvf $srcBase inferno/fonts inferno/Mkdirs inferno/empties
sed -e 's@^ROOT=.*$@ROOT='"$out"'/share/inferno@g' -e 's@^OBJTYPE=.*$@OBJTYPE=386@g' -e 's@^SYSHOST=.*$@SYSHOST=Linux@g' -i mkconfig
mkdir prof
sh Mkdirs
'';
buildPhase = ''
export PATH=$PATH:$out/share/inferno/Linux/386/bin
mkdir -p $out/share/inferno
cp -r . $out/share/inferno
./makemk.sh
export PATH=$PATH:$out/share/inferno/Linux/386/bin
mk nuke
mk
'';
installPhase = ''
# Installs executables in $out/share/inferno/${host}/${objtype}/bin
mk install
mkdir -p $out/bin
# Install start-up script
makeWrapper $out/share/inferno/Linux/386/bin/emu $out/bin/emu \
--suffix LD_LIBRARY_PATH ':' "${gcc46.cc}/lib" \
--suffix PATH ':' "$out/share/inferno/Linux/386/bin"
makeWrapper $infernoWrapper $out/bin/inferno \
--suffix LD_LIBRARY_PATH ':' "${gcc46.cc}/lib" \
--suffix PATH ':' "$out/share/inferno/Linux/386/bin" \
--set INFERNO_ROOT "$out/share/inferno"
'';
@@ -50,7 +58,7 @@ stdenv.mkDerivation rec {
description = "A compact distributed operating system for building cross-platform distributed systems";
homepage = "http://inferno-os.org/";
license = stdenv.lib.licenses.gpl2;
maintainers = with stdenv.lib.maintainers; [ doublec kovirobi ];
maintainers = [ "Chris Double <chris.double@double.co.nz>" ];
platforms = with stdenv.lib.platforms; linux;
};
}

View File

@@ -1,39 +0,0 @@
{ stdenv, fetchzip, perl, python, gnuplot, coreutils, gnugrep }:
stdenv.mkDerivation rec {
name = "gitstats-${version}";
version = "2016-01-08";
# upstream does not make releases
src = fetchzip {
url = "https://github.com/hoxu/gitstats/archive/55c5c285558c410bb35ebf421245d320ab9ee9fa.zip";
sha256 = "1bfcwhksylrpm88vyp33qjby4js31zcxy7w368dzjv4il3fh2i59";
name = name + "-src";
};
buildInputs = [ perl python ];
postPatch = ''
sed -e "s|gnuplot_cmd = .*|gnuplot_cmd = '${gnuplot}/bin/gnuplot'|" \
-e "s|\<wc\>|${coreutils}/bin/wc|g" \
-e "s|\<grep\>|${gnugrep}/bin/grep|g" \
-i gitstats
'';
buildPhase = ''
make man VERSION="${version}"
'';
installPhase = ''
make install PREFIX="$out" VERSION="${version}"
install -Dm644 doc/gitstats.1 "$out"/share/man/man1/gitstats.1
'';
meta = with stdenv.lib; {
homepage = http://gitstats.sourceforge.net/;
description = "Git history statistics generator";
license = licenses.gpl2Plus;
platforms = platforms.all;
maintainers = [ maintainers.bjornfor ];
};
}

View File

@@ -11,7 +11,7 @@ GEM
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
cide (0.9.0)
cide (0.8.1)
thor (~> 0.19)
virtus (~> 1.0)
coercible (1.0.0)

View File

@@ -1,8 +1,8 @@
{ stdenv, lib, bundlerEnv, makeWrapper, docker, git, gnutar, gzip }:
{ stdenv, lib, bundlerEnv, makeWrapper, docker, git }:
stdenv.mkDerivation rec {
name = "cide-${version}";
version = "0.9.0";
version = "0.8.1";
env = bundlerEnv {
name = "${name}-gems";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out/bin
makeWrapper ${env}/bin/cide $out/bin/cide \
--set PATH ${docker}/bin:${git}/bin:${gnutar}/bin:${gzip}/bin
--set PATH ${docker}/bin:${git}/bin
'';
meta = with lib; {

View File

@@ -22,20 +22,20 @@
version = "0.19.1";
};
jmespath = {
version = "1.1.3";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "0vpvd61kc60f98jn28kw7x7vi82qrwgglam42nvzh98i43yxwsfb";
type = "gem";
};
version = "1.1.3";
};
ice_nine = {
version = "0.11.2";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "1nv35qg1rps9fsis28hz2cq2fx1i96795f91q4nmkm934xynll2x";
type = "gem";
};
version = "0.11.2";
};
equalizer = {
source = {
@@ -61,11 +61,11 @@
version = "1.0.0";
};
cide = {
version = "0.9.0";
version = "0.8.1";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "1wykwv0jnrh49jm9zsy1cb5wddv65iw4ixh072hr242wb83dcyl0";
sha256 = "1vsa7smab5dj6mcf0csl9wm18x95h6yphm7x18is53bv5hrzgill";
};
};
axiom-types = {
@@ -77,27 +77,27 @@
version = "0.1.1";
};
aws-sdk-resources = {
version = "2.2.17";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "0vdnpjmil99n9d1fpk1w6ssgvmzx4wfmrqcij8nyd0iqdaacx3fj";
type = "gem";
};
version = "2.2.17";
};
aws-sdk-core = {
version = "2.2.17";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "1vq7ny5n3rdfzkdqdm76r48slmp2a5v7565llrl4bw5hb5k4p75z";
type = "gem";
};
version = "2.2.17";
};
aws-sdk = {
version = "2.2.17";
source = {
type = "gem";
remotes = ["https://rubygems.org"];
sha256 = "1cwycrdk21blzjzf8fj1wlmdix94rj9aixj6phx6lwbqykn2dzx9";
type = "gem";
};
version = "2.2.17";
};
}

View File

@@ -1,59 +0,0 @@
{ stdenv, fetchurl, unzip, love, lua, makeWrapper, makeDesktopItem }:
let
pname = "duckmarines";
version = "1.0b";
icon = fetchurl {
url = "http://tangramgames.dk/img/thumb/duckmarines.png";
sha256 = "07ypbwqcgqc5f117yxy9icix76wlybp1cmykc8f3ivdps66hl0k5";
};
desktopItem = makeDesktopItem {
name = "duckmarines";
exec = "${pname}";
icon = "${icon}";
comment = "Duck-themed action puzzle video game";
desktopName = "Duck Marines";
genericName = "duckmarines";
categories = "Game;";
};
in
stdenv.mkDerivation rec {
name = "${pname}-${version}";
src = fetchurl {
url = "https://github.com/SimonLarsen/${pname}/releases/download/v${version}/${pname}-1.0-love.zip";
sha256 = "0fpzbsgrhbwm1lff9gyzh6c9jigw328ngddvrj5w7qmjcm2lv6lv";
};
nativeBuildInputs = [ makeWrapper unzip ];
buildInputs = [ lua love ];
phases = [ "unpackPhase" "installPhase" ];
installPhase =
''
mkdir -p $out/bin
mkdir -p $out/share/games/lovegames
cp -v ./${pname}-1.0.love $out/share/games/lovegames/${pname}.love
makeWrapper ${love}/bin/love $out/bin/${pname} --add-flags $out/share/games/lovegames/${pname}.love
chmod +x $out/bin/${pname}
mkdir -p $out/share/applications
ln -s ${desktopItem}/share/applications/* $out/share/applications/
'';
meta = with stdenv.lib; {
description = "Duck-themed action puzzle video game";
maintainers = with maintainers; [ leenaars ];
platforms = platforms.linux;
license = licenses.free;
downloadPage = http://tangramgames.dk/games/duckmarines;
};
}

View File

@@ -13,11 +13,11 @@
}:
stdenv.mkDerivation rec {
name = "nsd-4.1.7";
name = "nsd-4.1.6";
src = fetchurl {
url = "http://www.nlnetlabs.nl/downloads/nsd/${name}.tar.gz";
sha256 = "12hskfgfbkvcgpa1xxkqd8lnc6xvln1amn97x6avfnj9kfrbxa3v";
sha256 = "0pvpsxhil60m21h3pqlzs0l5m8qd3l6j8fkjyfg8plwmbh2j5xl8";
};
buildInputs = [ libevent openssl ];
@@ -41,6 +41,7 @@ stdenv.mkDerivation rec {
homepage = http://www.nlnetlabs.nl;
description = "Authoritative only, high performance, simple and open source name server";
license = licenses.bsd3;
platforms = platforms.unix;
maintainers = [ maintainers.hrdinka ];
};

View File

@@ -5,6 +5,7 @@
, gnutls, libgcrypt, libgpgerror
, ncurses, libunwind, libibverbs, librdmacm, systemd
, enableKerberos ? false
, enableInfiniband ? false
, enableLDAP ? false
, enablePrinting ? false
@@ -33,9 +34,10 @@ stdenv.mkDerivation rec {
buildInputs =
[ python pkgconfig perl libxslt docbook_xsl docbook_xml_dtd_42 /*
docbook_xml_dtd_45 */ readline talloc ntdb tdb tevent ldb popt iniparser
libbsd libarchive zlib acl fam libiconv gettext libunwind kerberos
libbsd libarchive zlib acl fam libiconv gettext libunwind
]
++ optionals stdenv.isLinux [ libaio pam systemd ]
++ optional enableKerberos kerberos
++ optionals (enableInfiniband && stdenv.isLinux) [ libibverbs librdmacm ]
++ optional enableLDAP openldap
++ optional (enablePrinting && stdenv.isLinux) cups
@@ -56,22 +58,23 @@ stdenv.mkDerivation rec {
configureFlags =
[ "--with-static-modules=NONE"
"--with-shared-modules=ALL"
"--with-system-mitkrb5"
"--enable-fhs"
"--sysconfdir=/etc"
"--localstatedir=/var"
"--bundled-libraries=NONE"
"--bundled-libraries=${if enableKerberos && kerberos != null &&
kerberos.implementation == "heimdal" then "NONE" else "com_err"}"
"--private-libraries=NONE"
"--builtin-libraries=NONE"
"--builtin-libraries=replace"
]
++ optional (enableKerberos && kerberos != null &&
kerberos.implementation == "krb5") "--with-system-mitkrb5"
++ optional (!enableDomainController) "--without-ad-dc"
++ optionals (!enableLDAP) [ "--without-ldap" "--without-ads" ];
enableParallelBuilding = true;
# Some libraries don't have /lib/samba in RPATH but need it.
# Use find -type f -executable -exec echo {} \; -exec sh -c 'ldd {} | grep "not found"' \;
# Looks like a bug in installer scripts.
stripAllList = [ "bin" "sbin" ];
postFixup = ''
export SAMBA_LIBS="$(find $out -type f -name \*.so -exec dirname {} \; | sort | uniq)"
read -r -d "" SCRIPT << EOF || true
@@ -82,7 +85,7 @@ stdenv.mkDerivation rec {
patchelf --set-rpath "\$ALL_LIBS" "\$BIN" 2>/dev/null || exit $?;
patchelf --shrink-rpath "\$BIN";
EOF
find $out -type f -name \*.so -exec $SHELL -c "$SCRIPT" \;
find $out -type f -exec $SHELL -c "$SCRIPT" \;
'';
meta = with stdenv.lib; {

View File

@@ -1,5 +1,5 @@
{ stdenv, fetchurl, ncurses, nettools, python, which, groff, gettext, man_db,
bc, libiconv, coreutils, gnused, kbd, utillinux, glibc }:
bc, libiconv, coreutils, gnused, kbd }:
stdenv.mkDerivation rec {
name = "fish-${version}";
@@ -22,10 +22,8 @@ stdenv.mkDerivation rec {
postInstall = ''
sed -e "s|expr|${coreutils}/bin/expr|" \
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
-e "s|if which unicode_start|if true|" \
-e "s|unicode_start|${kbd}/bin/unicode_start|" \
'' + ''
-i "$out/etc/fish/config.fish"
sed -e "s|bc|${bc}/bin/bc|" \
-e "s|/usr/bin/seq|${coreutils}/bin/seq|" \
@@ -45,13 +43,6 @@ stdenv.mkDerivation rec {
"$out/share/fish/functions/prompt_pwd.fish"
substituteInPlace "$out/share/fish/functions/fish_default_key_bindings.fish" \
--replace "clear;" "${ncurses}/bin/clear;"
'' + stdenv.lib.optionalString stdenv.isLinux ''
substituteInPlace "$out/share/fish/functions/__fish_print_help.fish" \
--replace "| ul" "| ${utillinux}/bin/ul"
for cur in $out/share/fish/functions/*.fish; do
substituteInPlace "$cur" --replace "/usr/bin/getent" "${glibc}/bin/getent"
done
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
sed -i "s|(hostname\||(${nettools}/bin/hostname\||" "$out/share/fish/functions/fish_prompt.fish"
sed -i "s|Popen(\['manpath'|Popen(\['${man_db}/bin/manpath'|" "$out/share/fish/tools/create_manpage_completions.py"

View File

@@ -18,9 +18,10 @@ import ../generic rec {
nativePrefix = stdenv.lib.optionalString stdenv.isSunOS "/usr";
nativeLibc = true;
inherit stdenv;
inherit (pkgs) binutils coreutils gnugrep;
binutils = pkgs.binutils;
cc = pkgs.gcc.cc;
isGNU = true;
coreutils = pkgs.coreutils;
shell = pkgs.bash + "/bin/sh";
};

View File

@@ -1,5 +1,6 @@
{ stdenv, fetchurl, intltool, pkgconfig
, anthy, ibus, glib, gobjectIntrospection, gtk3, python3, pygobject3
{ stdenv, fetchFromGitHub, makeWrapper, ibus, anthy, intltool
, pkgconfig, glib, gobjectIntrospection
, python3, pygobject3, gtk3, libtool, automake, autoconf
}:
stdenv.mkDerivation rec {
@@ -15,20 +16,28 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ gebner ericsagnes ];
};
preConfigure = "./autogen.sh --prefix=$out";
configureFlags = "--with-anthy-zipcode=${anthy}/share/anthy/zipcode.t";
buildInputs = [
anthy glib gobjectIntrospection gtk3 ibus python3 pygobject3
makeWrapper ibus anthy intltool pkgconfig glib gobjectIntrospection
python3 pygobject3 gtk3 libtool automake autoconf
];
nativeBuildInputs = [ intltool pkgconfig ];
postFixup = ''
substituteInPlace $out/share/ibus/component/anthy.xml --replace \$\{exec_prefix\} $out
for file in "$out"/libexec/*; do # */
wrapProgram "$file" \
--prefix PYTHONPATH : $PYTHONPATH \
--prefix GI_TYPELIB_PATH : $GI_TYPELIB_PATH:$out/lib/girepository-1.0
done
'';
src = fetchurl {
url = "https://github.com/ibus/ibus-anthy/releases/download/${version}/${name}.tar.gz";
sha256 = "1aj7vnfky7izl23xyjky78z3qas3q72l3kr8dnql2lnivsrb8q1y";
src = fetchFromGitHub {
owner = "ibus";
repo = "ibus-anthy";
rev = version;
sha256 = "1laxwpnhgihv4dz5cgcz6d0a0880r93n7039ciz1m53hdzapwi4a";
};
}

View File

@@ -1,4 +1,5 @@
{ stdenv, fetchurl, intltool, pkgconfig
{ stdenv, fetchurl, makeWrapper
, intltool, pkgconfig
, gtk3, ibus, libhangul, librsvg, python3, pygobject3
}:
@@ -8,12 +9,20 @@ stdenv.mkDerivation rec {
src = fetchurl {
url = "https://github.com/choehwanjin/ibus-hangul/releases/download/${version}/${name}.tar.gz";
sha256 = "120p9w7za6hi521hz8q235fkl4i3p1qqr8nqm4a3kxr0pcq40bd2";
sha256 = null;
};
buildInputs = [ gtk3 ibus libhangul python3 pygobject3 ];
nativeBuildInputs = [ intltool pkgconfig ];
nativeBuildInputs = [ intltool makeWrapper pkgconfig ];
postInstall = ''
wrapProgram $out/bin/ibus-setup-hangul \
--prefix PYTHONPATH : $PYTHONPATH \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
--prefix GDK_PIXBUF_MODULE_FILE : ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache \
--prefix LD_LIBRARY_PATH : ${libhangul}/lib
'';
meta = with stdenv.lib; {
isIbusEngine = true;

View File

@@ -1,7 +1,5 @@
{ stdenv, fetchFromGitHub
, automake, autoconf, libtool, pkgconfig
, ibus, m17n_lib, m17n_db, gettext, python3, pygobject3
}:
{ stdenv, fetchFromGitHub, ibus, m17n_lib, m17n_db, automake, autoconf,
gettext, libtool, pkgconfig, python, pythonPackages }:
stdenv.mkDerivation rec {
name = "ibus-m17n-${version}";
@@ -14,13 +12,11 @@ stdenv.mkDerivation rec {
sha256 = "1n0bvgc4jyksgvzrw5zs2pxcpxcn3gcc0j2kasbznm34fpv3frsr";
};
buildInputs = [
ibus m17n_lib m17n_db gettext
python3 pygobject3
buildInputs = [
ibus m17n_lib m17n_db automake autoconf gettext
libtool pkgconfig python pythonPackages.pygobject3
];
nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
preConfigure = ''
autoreconf --verbose --force --install
'';

View File

@@ -1,5 +1,5 @@
{ stdenv, fetchurl, pkgconfig
, gtk3, dconf, gobjectIntrospection, ibus, python3, pygobject3 }:
{ stdenv, fetchurl, makeWrapper, ibus, pkgconfig, python3, pygobject3
, gtk3, atk, dconf, gobjectIntrospection }:
stdenv.mkDerivation rec {
name = "ibus-table-${version}";
@@ -25,10 +25,29 @@ stdenv.mkDerivation rec {
'';
buildInputs = [
dconf gtk3 gobjectIntrospection ibus python3 pygobject3
gtk3 dconf gobjectIntrospection
ibus
pkgconfig
python3 pygobject3
];
nativeBuildInputs = [ pkgconfig ];
nativeBuildInputs = [ makeWrapper ];
preFixup = ''
for prog in "$out/bin"/*; do #*/
wrapProgram "$prog" \
--prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
--prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules"
done
for prog in "$out/libexec"/*; do #*/
wrapProgram "$prog" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0"
done
'';
meta = with stdenv.lib; {
isIbusEngine = true;

View File

@@ -1,15 +1,11 @@
{ stdenv, runCommand, makeWrapper, lndir
, dconf, hicolor_icon_theme, ibus, librsvg, plugins
}:
{ stdenv, runCommand, ibus, lndir, makeWrapper, plugins, hicolor_icon_theme }:
let
name = "ibus-with-plugins-" + (builtins.parseDrvName ibus.name).version;
env = {
buildInputs = [ ibus ] ++ plugins;
nativeBuildInputs = [ lndir makeWrapper ];
propagatedUserEnvPackages = [ hicolor_icon_theme ];
paths = [ ibus ] ++ plugins;
inherit (ibus) meta;
};
command = ''
for dir in bin etc lib libexec share; do
@@ -23,9 +19,7 @@ let
for prog in ibus ibus-daemon ibus-setup; do
wrapProgram "$out/bin/$prog" \
--prefix GDK_PIXBUF_MODULE_FILE : ${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache \
--prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH:$out/lib/girepository-1.0" \
--prefix GIO_EXTRA_MODULES : "${dconf}/lib/gio/modules" \
--suffix XDG_DATA_DIRS : "${hicolor_icon_theme}/share" \
--set IBUS_COMPONENT_PATH "$out/share/ibus/component/" \
--set IBUS_DATAROOTDIR "$out/share" \
--set IBUS_LIBEXECDIR "$out/libexec" \
@@ -35,9 +29,7 @@ let
--set IBUS_TABLE_DATA_DIR "$out/share" \
--set IBUS_TABLE_LIB_LOCATION "$out/libexec" \
--set IBUS_TABLE_LOCATION "$out/share/ibus-table" \
--prefix PYTHONPATH : "$PYTHONPATH" \
--prefix XDG_DATA_DIRS : "$out/share:$GSETTINGS_SCHEMAS_PATH" \
--suffix XDG_DATA_DIRS : "${hicolor_icon_theme}/share"
--set IBUS_TABLE_DEBUG_LEVEL 1
done
'';
in

View File

@@ -1,26 +0,0 @@
{ stdenv, callPackage, makeWrapper, nodejs, phantomjs2 }:
let
self = (
callPackage ../../../top-level/node-packages.nix {
generated = callPackage ./node-packages.nix { inherit self; };
overrides = {
"wring" = {
buildInputs = [ makeWrapper phantomjs2 ];
postInstall = ''
wrapProgram "$out/bin/wring" \
--prefix PATH : ${phantomjs2}/bin
'';
meta = with stdenv.lib; {
description = "Command-line tool for extracting content from webpages using CSS Selectors, XPath, and JS expressions";
homepage = https://github.com/osener/wring;
license = licenses.mit;
platforms = platforms.darwin ++ platforms.linux;
maintainers = [ maintainers.osener ];
};
};
};
});
in self.wring

View File

@@ -1 +0,0 @@
[ "wring" ]

View File

@@ -1,24 +0,0 @@
{ self, fetchurl, fetchgit ? null, lib }:
{
by-spec."wring"."*" =
self.by-version."wring"."1.0.0";
by-version."wring"."1.0.0" = self.buildNodePackage {
name = "wring-1.0.0";
version = "1.0.0";
bin = true;
src = fetchurl {
url = "http://registry.npmjs.org/wring/-/wring-1.0.0.tgz";
name = "wring-1.0.0.tgz";
sha1 = "3d8ebe894545bf0b42946fdc84c61e37ae657ce1";
};
deps = {
};
optionalDependencies = {
};
peerDependencies = [];
os = [ ];
cpu = [ ];
};
"wring" = self.by-version."wring"."1.0.0";
}

View File

@@ -1180,9 +1180,7 @@ let
inherit (python3Packages) pygobject3;
};
m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n {
inherit (python3Packages) pygobject3;
};
m17n = callPackage ../tools/inputmethods/ibus-engines/ibus-m17n { };
mozc = callPackage ../tools/inputmethods/ibus-engines/ibus-mozc {
inherit (pythonPackages) gyp;
@@ -1200,7 +1198,6 @@ let
};
ibus-with-plugins = callPackage ../tools/inputmethods/ibus/wrapper.nix {
inherit (gnome3) dconf;
plugins = [ ];
};
@@ -1730,8 +1727,6 @@ let
gitlab-workhorse = callPackage ../applications/version-management/gitlab-workhorse { };
gitstats = callPackage ../applications/version-management/gitstats { };
git-latexdiff = callPackage ../tools/typesetting/git-latexdiff { };
glusterfs = callPackage ../tools/filesystems/glusterfs { };
@@ -3774,8 +3769,6 @@ let
wml = callPackage ../development/web/wml { };
wring = callPackage ../tools/text/wring { };
wrk = callPackage ../tools/networking/wrk { };
wv = callPackage ../tools/misc/wv { };
@@ -9829,6 +9822,7 @@ let
samba4 = callPackage ../servers/samba/4.x.nix {
python = python2;
kerberos = null; # Bundle kerberos because samba uses internal, non-stable functions
# enableLDAP
};
@@ -9848,6 +9842,7 @@ let
});
samba4Full = lowPrio (samba4.override {
enableKerberos = true;
enableInfiniband = true;
enableLDAP = true;
enablePrinting = true;
@@ -14404,8 +14399,6 @@ let
drumkv1 = callPackage ../applications/audio/drumkv1 { };
duckmarines = callPackage ../games/duckmarines { love = love_0_9; };
dwarf-fortress-packages = callPackage ../games/dwarf-fortress { };
dwarf-fortress = dwarf-fortress-packages.dwarf-fortress.override { };