Skip to content

Commit

Permalink
Merge branch 'master' into staging
Browse files Browse the repository at this point in the history
* master: (23 commits)
  silver-searcher: patch bash completions location
  shairplay: init at 2016-01-01
  ocamlPackages.rope: 0.5 -> 0.6
  ocamlPackages.ocaml_gettext: 0.8.7 -> 0.8.8
  mupdf: Patch openjpeg version
  nextcloud-client: fix build after qt updates
  gstreamer.gst-plugins-bad: Patch openjpeg version
  silver-searcher: move bash completion to etc/bash-completion.d/
  neomutt: use mime.types from dedicated mime-types derivation
  mime_types: rename to mime-types
  XMLLibXML: 2.0129 -> 2.0132 fixes failing tests & CVE-2017-10672
  nixos/matrix-synapse: remove unused log_file config
  nixos: run parted with --script option (3rd)
  nixos: run parted with --script option (2nd)
  nixos/release: add nixos/tests/switch-test.nix to tested job
  nixos/system: make switch-to-configuration script pure.
  nixos/release: include mutableUsers test to release tests.
  nixos/tests: Add a test for config.users.mutableUsers.
  corebird: 1.7.2 -> 1.7.3
  nixos/matrix-synapse: make home directory configurable
  ...
  • Loading branch information
orivej committed Nov 20, 2017
2 parents eb3d207 + 36e67d2 commit ab0d141
Show file tree
Hide file tree
Showing 24 changed files with 296 additions and 51 deletions.
25 changes: 16 additions & 9 deletions nixos/modules/services/misc/matrix-synapse.nix
Expand Up @@ -44,7 +44,6 @@ database: {
}
event_cache_size: "${cfg.event_cache_size}"
verbose: ${cfg.verbose}
log_file: "/var/log/matrix-synapse/homeserver.log"
log_config: "${logConfigFile}"
rc_messages_per_second: ${cfg.rc_messages_per_second}
rc_message_burst_count: ${cfg.rc_message_burst_count}
Expand All @@ -53,8 +52,8 @@ federation_rc_sleep_limit: ${cfg.federation_rc_sleep_limit}
federation_rc_sleep_delay: ${cfg.federation_rc_sleep_delay}
federation_rc_reject_limit: ${cfg.federation_rc_reject_limit}
federation_rc_concurrent: ${cfg.federation_rc_concurrent}
media_store_path: "/var/lib/matrix-synapse/media"
uploads_path: "/var/lib/matrix-synapse/uploads"
media_store_path: "${cfg.dataDir}/media"
uploads_path: "${cfg.dataDir}/uploads"
max_upload_size: "${cfg.max_upload_size}"
max_image_pixels: "${cfg.max_image_pixels}"
dynamic_thumbnails: ${boolToString cfg.dynamic_thumbnails}
Expand Down Expand Up @@ -86,7 +85,7 @@ ${optionalString (cfg.macaroon_secret_key != null) ''
expire_access_token: ${boolToString cfg.expire_access_token}
enable_metrics: ${boolToString cfg.enable_metrics}
report_stats: ${boolToString cfg.report_stats}
signing_key_path: "/var/lib/matrix-synapse/homeserver.signing.key"
signing_key_path: "${cfg.dataDir}/homeserver.signing.key"
key_refresh_interval: "${cfg.key_refresh_interval}"
perspectives:
servers: {
Expand Down Expand Up @@ -348,7 +347,7 @@ in {
database_args = mkOption {
type = types.attrs;
default = {
database = "/var/lib/matrix-synapse/homeserver.db";
database = "${cfg.dataDir}/homeserver.db";
};
description = ''
Arguments to pass to the engine.
Expand Down Expand Up @@ -586,14 +585,22 @@ in {
A yaml python logging config file
'';
};
dataDir = mkOption {
type = types.str;
default = "/var/lib/matrix-synapse";
description = ''
The directory where matrix-synapse stores its stateful data such as
certificates, media and uploads.
'';
};
};
};

config = mkIf cfg.enable {
users.extraUsers = [
{ name = "matrix-synapse";
group = "matrix-synapse";
home = "/var/lib/matrix-synapse";
home = cfg.dataDir;
createHome = true;
shell = "${pkgs.bash}/bin/bash";
uid = config.ids.uids.matrix-synapse;
Expand All @@ -611,16 +618,16 @@ in {
preStart = ''
${cfg.package}/bin/homeserver \
--config-path ${configFile} \
--keys-directory /var/lib/matrix-synapse \
--keys-directory ${cfg.dataDir} \
--generate-keys
'';
serviceConfig = {
Type = "simple";
User = "matrix-synapse";
Group = "matrix-synapse";
WorkingDirectory = "/var/lib/matrix-synapse";
WorkingDirectory = cfg.dataDir;
PermissionsStartOnly = true;
ExecStart = "${cfg.package}/bin/homeserver --config-path ${configFile} --keys-directory /var/lib/matrix-synapse";
ExecStart = "${cfg.package}/bin/homeserver --config-path ${configFile} --keys-directory ${cfg.dataDir}";
Restart = "on-failure";
};
};
Expand Down
13 changes: 10 additions & 3 deletions nixos/modules/system/activation/switch-to-configuration.pl
Expand Up @@ -16,6 +16,10 @@

my $action = shift @ARGV;

if ("@localeArchive@" ne "") {
$ENV{LOCALE_ARCHIVE} = "@localeArchive@";
}

if (!defined $action || ($action ne "switch" && $action ne "boot" && $action ne "test" && $action ne "dry-activate")) {
print STDERR <<EOF;
Usage: $0 [switch|boot|test]
Expand Down Expand Up @@ -65,7 +69,8 @@
sub getActiveUnits {
# FIXME: use D-Bus or whatever to query this, since parsing the
# output of list-units is likely to break.
my $lines = `LANG= systemctl list-units --full --no-legend`;
# Use current version of systemctl binary before daemon is reexeced.
my $lines = `LANG= /run/current-system/sw/bin/systemctl list-units --full --no-legend`;
my $res = {};
foreach my $line (split '\n', $lines) {
chomp $line;
Expand Down Expand Up @@ -262,7 +267,8 @@ sub fingerprintUnit {

sub pathToUnitName {
my ($path) = @_;
open my $cmd, "-|", "@systemd@/bin/systemd-escape", "--suffix=mount", "-p", $path
# Use current version of systemctl binary before daemon is reexeced.
open my $cmd, "-|", "/run/current-system/sw/bin/systemd-escape", "--suffix=mount", "-p", $path
or die "Unable to escape $path!\n";
my $escaped = join "", <$cmd>;
chomp $escaped;
Expand Down Expand Up @@ -364,7 +370,8 @@ sub filterUnits {
if (scalar (keys %unitsToStop) > 0) {
print STDERR "stopping the following units: ", join(", ", @unitsToStopFiltered), "\n"
if scalar @unitsToStopFiltered;
system("systemctl", "stop", "--", sort(keys %unitsToStop)); # FIXME: ignore errors?
# Use current version of systemctl binary before daemon is reexeced.
system("/run/current-system/sw/bin/systemctl", "stop", "--", sort(keys %unitsToStop)); # FIXME: ignore errors?
}

print STDERR "NOT restarting the following changed units: ", join(", ", sort(keys %unitsToSkip)), "\n"
Expand Down
2 changes: 1 addition & 1 deletion nixos/modules/system/activation/top-level.nix
Expand Up @@ -26,7 +26,6 @@ let
cloner false config.nesting.children
++ cloner true config.nesting.clone;


systemBuilder =
let
kernelPath = "${config.boot.kernelPackages.kernel}/" +
Expand Down Expand Up @@ -83,6 +82,7 @@ let
done
mkdir $out/bin
export localeArchive="${config.i18n.glibcLocales}/lib/locale/locale-archive"
substituteAll ${./switch-to-configuration.pl} $out/bin/switch-to-configuration
chmod +x $out/bin/switch-to-configuration
Expand Down
2 changes: 2 additions & 0 deletions nixos/release-combined.nix
Expand Up @@ -95,6 +95,7 @@ in rec {
#(all nixos.tests.lightdm)
(all nixos.tests.login)
(all nixos.tests.misc)
(all nixos.tests.mutableUsers)
(all nixos.tests.nat.firewall)
(all nixos.tests.nat.standalone)
(all nixos.tests.networking.scripted.loopback)
Expand All @@ -115,6 +116,7 @@ in rec {
(all nixos.tests.sddm.default)
(all nixos.tests.simple)
(all nixos.tests.slim)
(all nixos.tests.switchTest)
(all nixos.tests.udisks2)
(all nixos.tests.xfce)

Expand Down
2 changes: 2 additions & 0 deletions nixos/release.nix
Expand Up @@ -291,6 +291,7 @@ in rec {
tests.mongodb = callTest tests/mongodb.nix {};
tests.mumble = callTest tests/mumble.nix {};
tests.munin = callTest tests/munin.nix {};
tests.mutableUsers = callTest tests/mutable-users.nix {};
tests.mysql = callTest tests/mysql.nix {};
tests.mysqlBackup = callTest tests/mysql-backup.nix {};
tests.mysqlReplication = callTest tests/mysql-replication.nix {};
Expand Down Expand Up @@ -330,6 +331,7 @@ in rec {
tests.slim = callTest tests/slim.nix {};
tests.smokeping = callTest tests/smokeping.nix {};
tests.snapper = callTest tests/snapper.nix {};
tests.switchTest = callTest tests/switch-test.nix {};
tests.taskserver = callTest tests/taskserver.nix {};
tests.tomcat = callTest tests/tomcat.nix {};
tests.udisks2 = callTest tests/udisks2.nix {};
Expand Down
51 changes: 46 additions & 5 deletions nixos/tests/installer.nix
Expand Up @@ -307,11 +307,11 @@ in {
{ createPartitions =
''
$machine->succeed(
"parted /dev/vda mklabel gpt",
"parted -s /dev/vda -- mkpart ESP fat32 1M 50MiB", # /boot
"parted -s /dev/vda -- set 1 boot on",
"parted -s /dev/vda -- mkpart primary linux-swap 50MiB 1024MiB",
"parted -s /dev/vda -- mkpart primary ext2 1024MiB -1MiB", # /
"parted --script /dev/vda mklabel gpt",
"parted --script /dev/vda -- mkpart ESP fat32 1M 50MiB", # /boot
"parted --script /dev/vda -- set 1 boot on",
"parted --script /dev/vda -- mkpart primary linux-swap 50MiB 1024MiB",
"parted --script /dev/vda -- mkpart primary ext2 1024MiB -1MiB", # /
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
Expand Down Expand Up @@ -461,6 +461,47 @@ in {
'';
};

# Test whether opening encrypted filesystem with keyfile
# Checks for regression of missing cryptsetup, when no luks device without
# keyfile is configured
filesystemEncryptedWithKeyfile = makeInstallerTest "filesystemEncryptedWithKeyfile"
{ createPartitions = ''
$machine->succeed(
"parted --script /dev/vda mklabel msdos",
"parted --script /dev/vda -- mkpart primary ext2 1M 50MB", # /boot
"parted --script /dev/vda -- mkpart primary linux-swap 50M 1024M",
"parted --script /dev/vda -- mkpart primary 1024M 1280M", # LUKS with keyfile
"parted --script /dev/vda -- mkpart primary 1280M -1s",
"udevadm settle",
"mkswap /dev/vda2 -L swap",
"swapon -L swap",
"mkfs.ext3 -L nixos /dev/vda4",
"mount LABEL=nixos /mnt",
"mkfs.ext3 -L boot /dev/vda1",
"mkdir -p /mnt/boot",
"mount LABEL=boot /mnt/boot",
"modprobe dm_mod dm_crypt",
"echo -n supersecret > /mnt/keyfile",
"cryptsetup luksFormat -q /dev/vda3 --key-file /mnt/keyfile",
"cryptsetup luksOpen --key-file /mnt/keyfile /dev/vda3 crypt",
"mkfs.ext3 -L test /dev/mapper/crypt",
"cryptsetup luksClose crypt",
"mkdir -p /mnt/test"
);
'';
extraConfig = ''
fileSystems."/test" =
{ device = "/dev/disk/by-label/test";
fsType = "ext3";
encrypted.enable = true;
encrypted.blkDev = "/dev/vda3";
encrypted.label = "crypt";
encrypted.keyFile = "/mnt-root/keyfile";
};
'';
};


swraid = makeInstallerTest "swraid"
{ createPartitions =
''
Expand Down
39 changes: 39 additions & 0 deletions nixos/tests/mutable-users.nix
@@ -0,0 +1,39 @@
# Mutable users tests.

import ./make-test.nix ({ pkgs, ...} : {
name = "mutable-users";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ gleber ];
};

nodes = {
machine = { config, lib, pkgs, ... }: {
users.mutableUsers = false;
};
mutable = { config, lib, pkgs, ... }: {
users.mutableUsers = true;
};
};

testScript = {nodes, ...}: let
immutableSystem = nodes.machine.config.system.build.toplevel;
mutableSystem = nodes.mutable.config.system.build.toplevel;
in ''
$machine->start();
$machine->waitForUnit("default.target");
# Machine starts in immutable mode. Add a user and test if reactivating
# configuration removes the user.
$machine->fail("cat /etc/passwd | grep ^foobar:");
$machine->succeed("sudo useradd foobar");
$machine->succeed("cat /etc/passwd | grep ^foobar:");
$machine->succeed("${immutableSystem}/bin/switch-to-configuration test");
$machine->fail("cat /etc/passwd | grep ^foobar:");
# In immutable mode passwd is not wrapped, while in mutable mode it is
# wrapped.
$machine->succeed('which passwd | grep /run/current-system/');
$machine->succeed("${mutableSystem}/bin/switch-to-configuration test");
$machine->succeed('which passwd | grep /run/wrappers/');
'';
})
25 changes: 25 additions & 0 deletions nixos/tests/switch-test.nix
@@ -0,0 +1,25 @@
# Test configuration switching.

import ./make-test.nix ({ pkgs, ...} : {
name = "switch-test";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ gleber ];
};

nodes = {
machine = { config, lib, pkgs, ... }: {
users.mutableUsers = false;
};
other = { config, lib, pkgs, ... }: {
users.mutableUsers = true;
};
};

testScript = {nodes, ...}: let
originalSystem = nodes.machine.config.system.build.toplevel;
otherSystem = nodes.other.config.system.build.toplevel;
in ''
$machine->succeed("env -i ${originalSystem}/bin/switch-to-configuration test | tee /dev/stderr");
$machine->succeed("env -i ${otherSystem}/bin/switch-to-configuration test | tee /dev/stderr");
'';
})
20 changes: 16 additions & 4 deletions pkgs/applications/misc/mupdf/default.nix
Expand Up @@ -4,7 +4,15 @@
, enableCurl ? true, curl, openssl
}:

stdenv.mkDerivation rec {
let

# OpenJPEG version is hardcoded in package source
openJpegVersion = with stdenv;
lib.concatStringsSep "." (lib.lists.take 2
(lib.splitString "." (lib.getVersion openjpeg)));


in stdenv.mkDerivation rec {
version = "1.11";
name = "mupdf-${version}";

Expand All @@ -16,9 +24,9 @@ stdenv.mkDerivation rec {
patches = [
# Compatibility with new openjpeg
(fetchpatch {
name = "mupdf-1.11-openjpeg-2.1.1.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mupdf-openjpeg.patch?h=packages/mupdf&id=3d997e7ff2ac20c44856ede22760ba6fbca81a5c";
sha256 = "1vr12kpzmmfr8pp3scwfhrm5laqwd58xm6vx971c4y8bxy60b2ig";
name = "mupdf-1.11-openjpeg-version.patch";
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mupdf-openjpeg.patch?h=packages/mupdf&id=c19349f42838e4dca02e564b97e0a5ab3e1b943f";
sha256 = "0sx7jq84sr8bj6sg2ahg9cdgqz8dh4w6r0ah2yil8vrsznn4la8r";
})

(fetchurl {
Expand Down Expand Up @@ -58,6 +66,10 @@ stdenv.mkDerivation rec {
})
];

postPatch = ''
sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c
'';

makeFlags = [ "prefix=$(out)" ];
nativeBuildInputs = [ pkgconfig ];
buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg ]
Expand Down
4 changes: 4 additions & 0 deletions pkgs/applications/networking/cluster/minikube/default.nix
Expand Up @@ -34,6 +34,10 @@ in buildGoPackage rec {
sha256 = "1f7kjn26y7knmab5avj8spb40ny1y0jix5j5p0dqfjvg9climl0h";
};

patches = [
./localkube.patch
];

# kubernetes is here only to shut up a loud warning when generating the completions below. minikube checks very eagerly
# that kubectl is on the $PATH, even if it doesn't use it at all to generate the completions
buildInputs = [ go-bindata makeWrapper kubernetes gpgme ] ++ stdenv.lib.optional hostPlatform.isDarwin vmnet;
Expand Down
20 changes: 20 additions & 0 deletions pkgs/applications/networking/cluster/minikube/localkube.patch
@@ -0,0 +1,20 @@
diff --git a/pkg/minikube/bootstrapper/localkube/localkube.go b/pkg/minikube/bootstrapper/localkube/localkube.go
index 1c4b5000..c9f120d4 100644
--- a/pkg/minikube/bootstrapper/localkube/localkube.go
+++ b/pkg/minikube/bootstrapper/localkube/localkube.go
@@ -113,14 +113,9 @@ func (lk *LocalkubeBootstrapper) UpdateCluster(config bootstrapper.KubernetesCon

copyableFiles := []assets.CopyableFile{}
var localkubeFile assets.CopyableFile
- var err error

//add url/file/bundled localkube to file list
- lCacher := localkubeCacher{config}
- localkubeFile, err = lCacher.fetchLocalkubeFromURI()
- if err != nil {
- return errors.Wrap(err, "Error updating localkube from uri")
- }
+ localkubeFile = assets.NewBinDataAsset("out/localkube", "/", "localkube", "0777")
copyableFiles = append(copyableFiles, localkubeFile)

// user added files
4 changes: 2 additions & 2 deletions pkgs/applications/networking/corebird/default.nix
Expand Up @@ -3,14 +3,14 @@
, glib_networking }:

stdenv.mkDerivation rec {
version = "1.7.2";
version = "1.7.3";
name = "corebird-${version}";

src = fetchFromGitHub {
owner = "baedert";
repo = "corebird";
rev = version;
sha256 = "0mydxxga4h1663xchb3543rk3k8frlmlyy5wz20zh38fpdlkhyf1";
sha256 = "1xay22v5j239ppl6ydbj842zpm5v2mg5mcgpy5cjrhhmnbg79fgk";
};

preConfigure = ''
Expand Down

0 comments on commit ab0d141

Please sign in to comment.