diff --git a/doc/stdenv.xml b/doc/stdenv.xml
index 68441ea9393a..44a0e4601fc1 100644
--- a/doc/stdenv.xml
+++ b/doc/stdenv.xml
@@ -1401,8 +1401,15 @@ These can be toggled using the stdenv.mkDerivation parameters
hardeningDisable and hardeningEnable.
-The following flags are enabled by default and might require disabling
-if the program to package is incompatible.
+
+Both parameters take a list of flags as strings. The special
+"all" flag can be passed to hardeningDisable
+to turn off all hardening. These flags can also be used as environment variables
+for testing or development purposes.
+
+
+The following flags are enabled by default and might require disabling with
+hardeningDisable if the program to package is incompatible.
@@ -1563,7 +1570,8 @@ intel_drv.so: undefined symbol: vgaHWFreeHWRec
The following flags are disabled by default and should be enabled
-for packages that take untrusted input, like network services.
+with hardeningEnable for packages that take untrusted
+input like network services.
diff --git a/lib/maintainers.nix b/lib/maintainers.nix
index d40722dacacd..1e9a6fe0f0d8 100644
--- a/lib/maintainers.nix
+++ b/lib/maintainers.nix
@@ -27,6 +27,7 @@
akaWolf = "Artjom Vejsel ";
akc = "Anders Claesson ";
algorith = "Dries Van Daele ";
+ alibabzo = "Alistair Bill ";
all = "Nix Committers ";
ambrop72 = "Ambroz Bizjak ";
amiddelk = "Arie Middelkoop ";
@@ -102,6 +103,7 @@
corngood = "David McFarland ";
coroa = "Jonas Hörsch ";
couchemar = "Andrey Pavlov ";
+ cpages = "Carles Pagès ";
cransom = "Casey Ransom ";
cryptix = "Henry Bubert ";
CrystalGamma = "Jona Stubbe ";
@@ -350,7 +352,6 @@
osener = "Ozan Sener ";
otwieracz = "Slawomir Gonet ";
oxij = "Jan Malakhovski ";
- page = "Carles Pagès ";
paholg = "Paho Lurie-Gregg ";
pakhfn = "Fedor Pakhomov ";
palo = "Ingolf Wanger ";
diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 9e7cfbd686cc..426aaa34885c 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -13,7 +13,7 @@ let
resolvconfOptions = cfg.resolvconfOptions
++ optional cfg.dnsSingleRequest "single-request"
- ++ optional cfg.dnsExtensionMechanism "ends0";
+ ++ optional cfg.dnsExtensionMechanism "edns0";
in
{
diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix
index e23e28aa25ef..3eaf9e2ab370 100644
--- a/nixos/modules/i18n/input-method/ibus.nix
+++ b/nixos/modules/i18n/input-method/ibus.nix
@@ -10,6 +10,11 @@ let
check = x: (lib.types.package.check x) && (attrByPath ["meta" "isIbusEngine"] false x);
};
+ impanel =
+ if cfg.panel != null
+ then "--panel=${cfg.panel}"
+ else "";
+
ibusAutostart = pkgs.writeTextFile {
name = "autostart-ibus-daemon";
destination = "/etc/xdg/autostart/ibus-daemon.desktop";
@@ -17,7 +22,7 @@ let
[Desktop Entry]
Name=IBus
Type=Application
- Exec=${ibusPackage}/bin/ibus-daemon --daemonize --xim
+ Exec=${ibusPackage}/bin/ibus-daemon --daemonize --xim ${impanel}
'';
};
in
@@ -36,6 +41,12 @@ in
in
"Enabled IBus engines. Available engines are: ${engines}.";
};
+ panel = mkOption {
+ type = with types; nullOr path;
+ default = null;
+ example = literalExample "${pkgs.kde5.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
+ description = "Replace the IBus panel with another panel.";
+ };
};
};
diff --git a/nixos/modules/misc/ids.nix b/nixos/modules/misc/ids.nix
index de69ada5bfe7..5058d41bf753 100644
--- a/nixos/modules/misc/ids.nix
+++ b/nixos/modules/misc/ids.nix
@@ -283,6 +283,7 @@
keystone = 265;
glance = 266;
couchpotato = 267;
+ gogs = 268;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
@@ -536,6 +537,7 @@
keystone = 265;
glance = 266;
couchpotato = 267;
+ gogs = 268;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index cd00ea10baa7..e99e344b932d 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -258,6 +258,7 @@
#./services/misc/gitit.nix
./services/misc/gitlab.nix
./services/misc/gitolite.nix
+ ./services/misc/gogs.nix
./services/misc/gpsd.nix
./services/misc/ihaskell.nix
./services/misc/leaps.nix
@@ -311,6 +312,7 @@
./services/monitoring/monit.nix
./services/monitoring/munin.nix
./services/monitoring/nagios.nix
+ ./services/monitoring/netdata.nix
./services/monitoring/prometheus/default.nix
./services/monitoring/prometheus/alertmanager.nix
./services/monitoring/prometheus/blackbox-exporter.nix
diff --git a/nixos/modules/services/misc/gogs.nix b/nixos/modules/services/misc/gogs.nix
new file mode 100644
index 000000000000..09e5c4fe1ff1
--- /dev/null
+++ b/nixos/modules/services/misc/gogs.nix
@@ -0,0 +1,215 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.services.gogs;
+ configFile = pkgs.writeText "app.ini" ''
+ APP_NAME = ${cfg.appName}
+ RUN_USER = ${cfg.user}
+ RUN_MODE = prod
+
+ [database]
+ DB_TYPE = ${cfg.database.type}
+ HOST = ${cfg.database.host}:${toString cfg.database.port}
+ NAME = ${cfg.database.name}
+ USER = ${cfg.database.user}
+ PASSWD = ${cfg.database.password}
+ PATH = ${cfg.database.path}
+
+ [repository]
+ ROOT = ${cfg.repositoryRoot}
+
+ [server]
+ DOMAIN = ${cfg.domain}
+ HTTP_ADDR = ${cfg.httpAddress}
+ HTTP_PORT = ${toString cfg.httpPort}
+ ROOT_URL = ${cfg.rootUrl}
+
+ [security]
+ SECRET_KEY = #secretkey#
+ INSTALL_LOCK = true
+
+ ${cfg.extraConfig}
+ '';
+in
+
+{
+ options = {
+ services.gogs = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Enable Go Git Service.";
+ };
+
+ useWizard = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Do not generate a configuration and use Gogs' installation wizard instead. The first registered user will be administrator.";
+ };
+
+ stateDir = mkOption {
+ default = "/var/lib/gogs";
+ type = types.str;
+ description = "Gogs data directory.";
+ };
+
+ user = mkOption {
+ type = types.str;
+ default = "gogs";
+ description = "User account under which Gogs runs.";
+ };
+
+ group = mkOption {
+ type = types.str;
+ default = "gogs";
+ description = "Group account under which Gogs runs.";
+ };
+
+ database = {
+ type = mkOption {
+ type = types.enum [ "sqlite3" "mysql" "postgres" ];
+ example = "mysql";
+ default = "sqlite3";
+ description = "Database engine to use.";
+ };
+
+ host = mkOption {
+ type = types.str;
+ default = "127.0.0.1";
+ description = "Database host address.";
+ };
+
+ port = mkOption {
+ type = types.int;
+ default = 3306;
+ description = "Database host port.";
+ };
+
+ name = mkOption {
+ type = types.str;
+ default = "gogs";
+ description = "Database name.";
+ };
+
+ user = mkOption {
+ type = types.str;
+ default = "gogs";
+ description = "Database user.";
+ };
+
+ password = mkOption {
+ type = types.str;
+ default = "";
+ description = "Database password.";
+ };
+
+ path = mkOption {
+ type = types.str;
+ default = "${cfg.stateDir}/data/gogs.db";
+ description = "Path to the sqlite3 database file.";
+ };
+ };
+
+ appName = mkOption {
+ type = types.str;
+ default = "Gogs: Go Git Service";
+ description = "Application name.";
+ };
+
+ repositoryRoot = mkOption {
+ type = types.str;
+ default = "${cfg.stateDir}/repositories";
+ description = "Path to the git repositories.";
+ };
+
+ domain = mkOption {
+ type = types.str;
+ default = "localhost";
+ description = "Domain name of your server.";
+ };
+
+ rootUrl = mkOption {
+ type = types.str;
+ default = "http://localhost:3000/";
+ description = "Full public URL of Gogs server.";
+ };
+
+ httpAddress = mkOption {
+ type = types.str;
+ default = "0.0.0.0";
+ description = "HTTP listen address.";
+ };
+
+ httpPort = mkOption {
+ type = types.int;
+ default = 3000;
+ description = "HTTP listen port.";
+ };
+
+ extraConfig = mkOption {
+ type = types.str;
+ default = "";
+ description = "Configuration lines appended to the generated Gogs configuration file.";
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+
+ systemd.services.gogs = {
+ description = "Gogs (Go Git Service)";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ path = [ pkgs.gogs.bin ];
+
+ preStart = ''
+ # copy custom configuration and generate a random secret key if needed
+ ${optionalString (cfg.useWizard == false) ''
+ mkdir -p ${cfg.stateDir}/custom/conf
+ cp -f ${configFile} ${cfg.stateDir}/custom/conf/app.ini
+ KEY=$(head -c 16 /dev/urandom | tr -dc A-Za-z0-9)
+ sed -i "s,#secretkey#,$KEY,g" ${cfg.stateDir}/custom/conf/app.ini
+ ''}
+
+ mkdir -p ${cfg.repositoryRoot}
+ # update all hooks' binary paths
+ HOOKS=$(find ${cfg.repositoryRoot} -mindepth 4 -maxdepth 4 -type f -wholename "*git/hooks/*")
+ if [ "$HOOKS" ]
+ then
+ sed -ri 's,/nix/store/[a-z0-9.-]+/bin/gogs,${pkgs.gogs.bin}/bin/gogs,g' $HOOKS
+ sed -ri 's,/nix/store/[a-z0-9.-]+/bin/env,${pkgs.coreutils}/bin/env,g' $HOOKS
+ sed -ri 's,/nix/store/[a-z0-9.-]+/bin/bash,${pkgs.bash}/bin/bash,g' $HOOKS
+ sed -ri 's,/nix/store/[a-z0-9.-]+/bin/perl,${pkgs.perl}/bin/perl,g' $HOOKS
+ fi
+ '';
+
+ serviceConfig = {
+ Type = "simple";
+ User = cfg.user;
+ Group = cfg.group;
+ WorkingDirectory = cfg.stateDir;
+ ExecStart = "${pkgs.gogs.bin}/bin/gogs web";
+ Restart = "always";
+ };
+
+ environment = {
+ USER = cfg.user;
+ HOME = cfg.stateDir;
+ GOGS_WORK_DIR = cfg.stateDir;
+ };
+ };
+
+ users = {
+ extraUsers.gogs = {
+ description = "Go Git Service";
+ uid = config.ids.uids.gogs;
+ group = "gogs";
+ home = cfg.stateDir;
+ createHome = true;
+ };
+ extraGroups.gogs.gid = config.ids.gids.gogs;
+ };
+ };
+}
diff --git a/nixos/modules/services/misc/mesos-master.nix b/nixos/modules/services/misc/mesos-master.nix
index 99583ebeebd5..0523c6549ed6 100644
--- a/nixos/modules/services/misc/mesos-master.nix
+++ b/nixos/modules/services/misc/mesos-master.nix
@@ -16,12 +16,30 @@ in {
type = types.bool;
};
+ ip = mkOption {
+ description = "IP address to listen on.";
+ default = "0.0.0.0";
+ type = types.str;
+ };
+
port = mkOption {
description = "Mesos Master port";
default = 5050;
type = types.int;
};
+ advertiseIp = mkOption {
+ description = "IP address advertised to reach this master.";
+ default = null;
+ type = types.nullOr types.str;
+ };
+
+ advertisePort = mkOption {
+ description = "Port advertised to reach this Mesos master.";
+ default = null;
+ type = types.nullOr types.int;
+ };
+
zk = mkOption {
description = ''
ZooKeeper URL (used for leader election amongst masters).
@@ -84,7 +102,10 @@ in {
serviceConfig = {
ExecStart = ''
${pkgs.mesos}/bin/mesos-master \
+ --ip=${cfg.ip} \
--port=${toString cfg.port} \
+ ${optionalString (cfg.advertiseIp != null) "--advertise_ip=${cfg.advertiseIp}"} \
+ ${optionalString (cfg.advertisePort != null) "--advertise_port=${toString cfg.advertisePort}"} \
${if cfg.quorum == 0
then "--registry=in_memory"
else "--zk=${cfg.zk} --registry=replicated_log --quorum=${toString cfg.quorum}"} \
diff --git a/nixos/modules/services/misc/mesos-slave.nix b/nixos/modules/services/misc/mesos-slave.nix
index 9ddecb6fe30c..47be10274d3b 100644
--- a/nixos/modules/services/misc/mesos-slave.nix
+++ b/nixos/modules/services/misc/mesos-slave.nix
@@ -12,7 +12,23 @@ let
attribsArg = optionalString (cfg.attributes != {})
"--attributes=${mkAttributes cfg.attributes}";
- containerizers = [ "mesos" ] ++ (optional cfg.withDocker "docker");
+ containerizersArg = concatStringsSep "," (
+ lib.unique (
+ cfg.containerizers ++ (optional cfg.withDocker "docker")
+ )
+ );
+
+ imageProvidersArg = concatStringsSep "," (
+ lib.unique (
+ cfg.imageProviders ++ (optional cfg.withDocker "docker")
+ )
+ );
+
+ isolationArg = concatStringsSep "," (
+ lib.unique (
+ cfg.isolation ++ (optionals cfg.withDocker [ "filesystem/linux" "docker/runtime"])
+ )
+ );
in {
@@ -27,7 +43,7 @@ in {
ip = mkOption {
description = "IP address to listen on.";
default = "0.0.0.0";
- type = types.string;
+ type = types.str;
};
port = mkOption {
@@ -36,6 +52,53 @@ in {
type = types.int;
};
+ advertiseIp = mkOption {
+ description = "IP address advertised to reach this agent.";
+ default = null;
+ type = types.nullOr types.str;
+ };
+
+ advertisePort = mkOption {
+ description = "Port advertised to reach this agent.";
+ default = null;
+ type = types.nullOr types.int;
+ };
+
+ containerizers = mkOption {
+ description = ''
+ List of containerizer implementations to compose in order to provide
+ containerization. Available options are mesos and docker.
+ The order the containerizers are specified is the order they are tried.
+ '';
+ default = [ "mesos" ];
+ type = types.listOf types.str;
+ };
+
+ imageProviders = mkOption {
+ description = "List of supported image providers, e.g., APPC,DOCKER.";
+ default = [ ];
+ type = types.listOf types.str;
+ };
+
+ imageProvisionerBackend = mkOption {
+ description = ''
+ Strategy for provisioning container rootfs from images,
+ e.g., aufs, bind, copy, overlay.
+ '';
+ default = "copy";
+ type = types.str;
+ };
+
+ isolation = mkOption {
+ description = ''
+ Isolation mechanisms to use, e.g., posix/cpu,posix/mem, or
+ cgroups/cpu,cgroups/mem, or network/port_mapping, or `gpu/nvidia` for nvidia
+ specific gpu isolation.
+ '';
+ default = [ "posix/cpu" "posix/mem" ];
+ type = types.listOf types.str;
+ };
+
master = mkOption {
description = ''
May be one of:
@@ -57,6 +120,16 @@ in {
type = types.bool;
};
+ dockerRegistry = mkOption {
+ description = ''
+ The default url for pulling Docker images.
+ It could either be a Docker registry server url,
+ or a local path in which Docker image archives are stored.
+ '';
+ default = null;
+ type = types.nullOr (types.either types.str types.path);
+ };
+
workDir = mkOption {
description = "The Mesos work directory.";
default = "/var/lib/mesos/slave";
@@ -96,28 +169,45 @@ in {
host = "aabc123";
os = "nixos"; };
};
+
+ executorEnvironmentVariables = mkOption {
+ description = ''
+ The environment variables that should be passed to the executor, and thus subsequently task(s).
+ '';
+ default = {
+ PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin";
+ };
+ type = types.attrsOf types.str;
+ };
};
};
-
config = mkIf cfg.enable {
systemd.services.mesos-slave = {
description = "Mesos Slave";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
- environment.MESOS_CONTAINERIZERS = concatStringsSep "," containerizers;
+ path = [ pkgs.stdenv.shellPackage ];
serviceConfig = {
ExecStart = ''
${pkgs.mesos}/bin/mesos-slave \
+ --containerizers=${containerizersArg} \
+ --image_providers=${imageProvidersArg} \
+ --image_provisioner_backend=${cfg.imageProvisionerBackend} \
+ --isolation=${isolationArg} \
--ip=${cfg.ip} \
--port=${toString cfg.port} \
+ ${optionalString (cfg.advertiseIp != null) "--advertise_ip=${cfg.advertiseIp}"} \
+ ${optionalString (cfg.advertisePort != null) "--advertise_port=${toString cfg.advertisePort}"} \
--master=${cfg.master} \
--work_dir=${cfg.workDir} \
--logging_level=${cfg.logLevel} \
${attribsArg} \
${optionalString cfg.withHadoop "--hadoop-home=${pkgs.hadoop}"} \
${optionalString cfg.withDocker "--docker=${pkgs.docker}/libexec/docker/docker"} \
+ ${optionalString (cfg.dockerRegistry != null) "--docker_registry=${cfg.dockerRegistry}"} \
+ --executor_environment_variables=${lib.escapeShellArg (builtins.toJSON cfg.executorEnvironmentVariables)} \
${toString cfg.extraCmdLineOptions}
'';
PermissionsStartOnly = true;
diff --git a/nixos/modules/services/monitoring/netdata.nix b/nixos/modules/services/monitoring/netdata.nix
new file mode 100644
index 000000000000..e1fde4fc9500
--- /dev/null
+++ b/nixos/modules/services/monitoring/netdata.nix
@@ -0,0 +1,78 @@
+{ config, pkgs, lib, ... }:
+
+with lib;
+
+let
+ cfg = config.services.netdata;
+
+ configFile = pkgs.writeText "netdata.conf" cfg.configText;
+
+ defaultUser = "netdata";
+
+in {
+ options = {
+ services.netdata = {
+ enable = mkOption {
+ default = false;
+ type = types.bool;
+ description = "Whether to enable netdata monitoring.";
+ };
+
+ user = mkOption {
+ type = types.str;
+ default = "netdata";
+ description = "User account under which netdata runs.";
+ };
+
+ group = mkOption {
+ type = types.str;
+ default = "netdata";
+ description = "Group under which netdata runs.";
+ };
+
+ configText = mkOption {
+ type = types.lines;
+ default = "";
+ description = "netdata.conf configuration.";
+ example = ''
+ [global]
+ debug log = syslog
+ access log = syslog
+ error log = syslog
+ '';
+ };
+
+ };
+ };
+
+ config = mkIf cfg.enable {
+ systemd.services.netdata = {
+ description = "Real time performance monitoring";
+ after = [ "network.target" ];
+ wantedBy = [ "multi-user.target" ];
+ preStart = concatStringsSep "\n" (map (dir: ''
+ mkdir -vp ${dir}
+ chmod 750 ${dir}
+ chown -R ${cfg.user}:${cfg.group} ${dir}
+ '') [ "/var/cache/netdata"
+ "/var/log/netdata"
+ "/var/lib/netdata" ]);
+ serviceConfig = {
+ User = cfg.user;
+ Group = cfg.group;
+ PermissionsStartOnly = true;
+ ExecStart = "${pkgs.netdata}/bin/netdata -D -c ${configFile}";
+ TimeoutStopSec = 60;
+ };
+ };
+
+ users.extraUsers = optional (cfg.user == defaultUser) {
+ name = defaultUser;
+ };
+
+ users.extraGroups = optional (cfg.group == defaultUser) {
+ name = defaultUser;
+ };
+
+ };
+}
diff --git a/nixos/modules/services/networking/flannel.nix b/nixos/modules/services/networking/flannel.nix
index ca47a18bc1f6..b93e28e34efd 100644
--- a/nixos/modules/services/networking/flannel.nix
+++ b/nixos/modules/services/networking/flannel.nix
@@ -149,6 +149,6 @@ in {
serviceConfig.ExecStart = "${cfg.package}/bin/flannel";
};
- services.etcd.enable = mkDefault cfg.etcd.endpoints == ["http://127.0.0.1:2379"];
+ services.etcd.enable = mkDefault (cfg.etcd.endpoints == ["http://127.0.0.1:2379"]);
};
}
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index 8f353979d3fc..c11d4434c206 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -174,7 +174,7 @@ in {
assertions = [{
assertion = config.networking.wireless.enable == false;
- message = "You can not use networking.networkmanager with services.networking.wireless";
+ message = "You can not use networking.networkmanager with networking.wireless";
}];
boot.kernelModules = [ "ppp_mppe" ]; # Needed for most (all?) PPTP VPN connections.
@@ -239,7 +239,8 @@ in {
# Turn off NixOS' network management
networking = {
useDHCP = false;
- wireless.enable = false;
+ # use mkDefault to trigger the assertion about the conflict above
+ wireless.enable = lib.mkDefault false;
};
powerManagement.resumeCommands = ''
diff --git a/nixos/modules/services/x11/display-managers/slim.nix b/nixos/modules/services/x11/display-managers/slim.nix
index 68acde85b5dc..05b979eef47f 100644
--- a/nixos/modules/services/x11/display-managers/slim.nix
+++ b/nixos/modules/services/x11/display-managers/slim.nix
@@ -20,6 +20,7 @@ let
${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
${optionalString (cfg.defaultUser != null) ("focus_password yes")}
${optionalString cfg.autoLogin "auto_login yes"}
+ ${optionalString (cfg.consoleCmd != null) "console_cmd ${cfg.consoleCmd}"}
${cfg.extraConfig}
'';
@@ -105,6 +106,18 @@ in
'';
};
+ consoleCmd = mkOption {
+ type = types.nullOr types.str;
+ default = ''
+ ${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ${pkgs.shadow}/bin/login
+ '';
+ defaultText = ''
+ ''${pkgs.xterm}/bin/xterm -C -fg white -bg black +sb -T "Console login" -e ''${pkgs.shadow}/bin/login
+ '';
+ description = ''
+ The command to run when "console" is given as the username.
+ '';
+ };
};
};
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
index 515136c904c5..b91d64bb0a7f 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot-builder.py
@@ -28,6 +28,8 @@ def write_loader_conf(generation):
if "@timeout@" != "":
f.write("timeout @timeout@\n")
f.write("default nixos-generation-%d\n" % generation)
+ if not @editor@:
+ f.write("editor 0");
os.rename("@efiSysMountPoint@/loader/loader.conf.tmp", "@efiSysMountPoint@/loader/loader.conf")
def copy_from_profile(generation, name, dry_run=False):
diff --git a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
index cc43fb8bab4c..ec02f73cada2 100644
--- a/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
+++ b/nixos/modules/system/boot/loader/systemd-boot/systemd-boot.nix
@@ -20,6 +20,8 @@ let
timeout = if config.boot.loader.timeout != null then config.boot.loader.timeout else "";
+ editor = if cfg.editor then "True" else "False";
+
inherit (efi) efiSysMountPoint canTouchEfiVariables;
};
in {
@@ -36,6 +38,20 @@ in {
description = "Whether to enable the systemd-boot (formerly gummiboot) EFI boot manager";
};
+
+ editor = mkOption {
+ default = true;
+
+ type = types.bool;
+
+ description = ''
+ Whether to allow editing the kernel command-line before
+ boot. It is recommended to set this to false, as it allows
+ gaining root access by passing init=/bin/sh as a kernel
+ parameter. However, it is enabled by default for backwards
+ compatibility.
+ '';
+ };
};
config = mkIf cfg.enable {
diff --git a/nixos/tests/mesos.nix b/nixos/tests/mesos.nix
index 3610603aeba2..6e9af126f032 100644
--- a/nixos/tests/mesos.nix
+++ b/nixos/tests/mesos.nix
@@ -1,32 +1,91 @@
-import ./make-test.nix ({ pkgs, ...} : {
- name = "simple";
+import ./make-test.nix ({ pkgs, ...} : rec {
+ name = "mesos";
meta = with pkgs.stdenv.lib.maintainers; {
- maintainers = [ offline ];
+ maintainers = [ offline kamilchm cstrahan ];
};
- machine = { config, pkgs, ... }: {
- services.zookeeper.enable = true;
- virtualisation.docker.enable = true;
- services.mesos = {
- slave = {
- enable = true;
- master = "zk://localhost:2181/mesos";
- attributes = {
- tag1 = "foo";
- tag2 = "bar";
- };
- };
- master = {
- enable = true;
- zk = "zk://localhost:2181/mesos";
+ nodes = {
+ master = { config, pkgs, ... }: {
+ networking.firewall.enable = false;
+ services.zookeeper.enable = true;
+ services.mesos.master = {
+ enable = true;
+ zk = "zk://master:2181/mesos";
};
};
+
+ slave = { config, pkgs, ... }: {
+ networking.firewall.enable = false;
+ networking.nat.enable = true;
+ virtualisation.docker.enable = true;
+ services.mesos = {
+ slave = {
+ enable = true;
+ master = "master:5050";
+ dockerRegistry = registry;
+ executorEnvironmentVariables = {
+ PATH = "/run/current-system/sw/bin";
+ };
+ };
+ };
+ };
+ };
+
+ simpleDocker = pkgs.dockerTools.buildImage {
+ name = "echo";
+ contents = [ pkgs.stdenv.shellPackage pkgs.coreutils ];
+ config = {
+ Env = [
+ # When shell=true, mesos invokes "sh -c ''", so make sure "sh" is
+ # on the PATH.
+ "PATH=${pkgs.stdenv.shellPackage}/bin:${pkgs.coreutils}/bin"
+ ];
+ Entrypoint = [ "echo" ];
+ };
+ };
+
+ registry = pkgs.runCommand "registry" { } ''
+ mkdir -p $out
+ cp ${simpleDocker} $out/echo:latest.tar
+ '';
+
+ testFramework = pkgs.pythonPackages.buildPythonPackage {
+ name = "mesos-tests";
+ propagatedBuildInputs = [ pkgs.mesos ];
+ catchConflicts = false;
+ src = ./mesos_test.py;
+ phases = [ "installPhase" "fixupPhase" ];
+ installPhase = ''
+ mkdir $out
+ cp $src $out/mesos_test.py
+ chmod +x $out/mesos_test.py
+
+ echo "done" > test.result
+ tar czf $out/test.tar.gz test.result
+ '';
};
testScript =
''
startAll;
- $machine->waitForUnit("mesos-master.service");
- $machine->waitForUnit("mesos-slave.service");
+ $master->waitForUnit("mesos-master.service");
+ $slave->waitForUnit("mesos-slave.service");
+
+ $master->waitForOpenPort(5050);
+ $slave->waitForOpenPort(5051);
+
+ # is slave registred?
+ $master->waitUntilSucceeds("curl -s --fail http://master:5050/master/slaves".
+ " | grep -q \"\\\"hostname\\\":\\\"slave\\\"\"");
+
+ # try to run docker image
+ $master->succeed("${pkgs.mesos}/bin/mesos-execute --master=master:5050".
+ " --resources=\"cpus:0.1;mem:32\" --name=simple-docker".
+ " --containerizer=mesos --docker_image=echo:latest".
+ " --shell=true --command=\"echo done\" | grep -q TASK_FINISHED");
+
+ # simple command with .tar.gz uri
+ $master->succeed("${testFramework}/mesos_test.py master ".
+ "${testFramework}/test.tar.gz");
'';
})
diff --git a/nixos/tests/mesos_test.py b/nixos/tests/mesos_test.py
new file mode 100644
index 000000000000..be8bb32e49a7
--- /dev/null
+++ b/nixos/tests/mesos_test.py
@@ -0,0 +1,72 @@
+#!/usr/bin/env python
+import uuid
+import time
+import subprocess
+import os
+
+import sys
+
+from mesos.interface import Scheduler
+from mesos.native import MesosSchedulerDriver
+from mesos.interface import mesos_pb2
+
+def log(msg):
+ process = subprocess.Popen("systemd-cat", stdin=subprocess.PIPE)
+ (out,err) = process.communicate(msg)
+
+class NixosTestScheduler(Scheduler):
+ def __init__(self):
+ self.master_ip = sys.argv[1]
+ self.download_uri = sys.argv[2]
+
+ def resourceOffers(self, driver, offers):
+ log("XXX got resource offer")
+
+ offer = offers[0]
+ task = self.new_task(offer)
+ uri = task.command.uris.add()
+ uri.value = self.download_uri
+ task.command.value = "cat test.result"
+ driver.launchTasks(offer.id, [task])
+
+ def statusUpdate(self, driver, update):
+ log("XXX status update")
+ if update.state == mesos_pb2.TASK_FAILED:
+ log("XXX test task failed with message: " + update.message)
+ driver.stop()
+ sys.exit(1)
+ elif update.state == mesos_pb2.TASK_FINISHED:
+ driver.stop()
+ sys.exit(0)
+
+ def new_task(self, offer):
+ task = mesos_pb2.TaskInfo()
+ id = uuid.uuid4()
+ task.task_id.value = str(id)
+ task.slave_id.value = offer.slave_id.value
+ task.name = "task {}".format(str(id))
+
+ cpus = task.resources.add()
+ cpus.name = "cpus"
+ cpus.type = mesos_pb2.Value.SCALAR
+ cpus.scalar.value = 0.1
+
+ mem = task.resources.add()
+ mem.name = "mem"
+ mem.type = mesos_pb2.Value.SCALAR
+ mem.scalar.value = 32
+
+ return task
+
+if __name__ == '__main__':
+ log("XXX framework started")
+
+ framework = mesos_pb2.FrameworkInfo()
+ framework.user = "root"
+ framework.name = "nixos-test-framework"
+ driver = MesosSchedulerDriver(
+ NixosTestScheduler(),
+ framework,
+ sys.argv[1] + ":5050"
+ )
+ driver.run()
diff --git a/pkgs/applications/graphics/pencil/default.nix b/pkgs/applications/graphics/pencil/default.nix
index 7d9b77e9661e..5b1f79a6c4fd 100644
--- a/pkgs/applications/graphics/pencil/default.nix
+++ b/pkgs/applications/graphics/pencil/default.nix
@@ -1,12 +1,12 @@
{ stdenv, fetchurl, makeWrapper, xulrunner }:
stdenv.mkDerivation rec {
- version = "2.0.18";
+ version = "2.0.21";
name = "pencil-${version}";
src = fetchurl {
url = "https://github.com/prikhi/pencil/releases/download/v${version}/Pencil-${version}-linux-pkg.tar.gz";
- sha256 = "0x0kibb2na12fwl0x68xhkjpbm5h2widm346cx2r29gp1kq9kklc";
+ sha256 = "0xq3gczqy7gzf1997qxdql5z7qqk1vabr0rzgakmsi4dq2q4d3kq";
};
buildPhase = "";
@@ -32,8 +32,5 @@ stdenv.mkDerivation rec {
license = licenses.gpl2; # Commercial license is also available
maintainers = with maintainers; [ bjornfor prikhi ];
platforms = platforms.linux;
- # See https://github.com/prikhi/pencil/issues/840
- # ("Error: Platform version '47.0' is not compatible with minVersion >= 36.0 maxVersion <= 46.*")
- broken = true;
};
}
diff --git a/pkgs/applications/misc/golden-cheetah/default.nix b/pkgs/applications/misc/golden-cheetah/default.nix
index 5a149657931f..68c9246c24b1 100644
--- a/pkgs/applications/misc/golden-cheetah/default.nix
+++ b/pkgs/applications/misc/golden-cheetah/default.nix
@@ -1,34 +1,30 @@
-{ stdenv, fetchurl, qtbase, qtsvg, qtserialport, qtwebkit, qtmultimedia
-, qttools, yacc, flex, zlib, config, qmakeHook, makeQtWrapper }:
+{ stdenv, fetchurl
+, qtbase, qtsvg, qtserialport, qtwebkit, qtmultimedia, qttools, qtconnectivity
+, yacc, flex, zlib, config, qmakeHook, makeQtWrapper
+}:
stdenv.mkDerivation rec {
name = "golden-cheetah-${version}";
- version = "4.0-DEV1603";
+ version = "3.4";
src = fetchurl {
name = "${name}.tar.gz";
url = "https://github.com/GoldenCheetah/GoldenCheetah/archive/V${version}.tar.gz";
- sha256 = "12knlzqmq8b3nyl3kvcsnzrbjksgd83mzwzj97wccyfiffjl4wah";
+ sha256 = "0fiz2pj155cd357kph50lc6rjyzwp045glfv4y68qls9j7m9ayaf";
};
- buildInputs = [
+ qtInputs = [
qtbase qtsvg qtserialport qtwebkit qtmultimedia qttools yacc flex zlib
+ qtconnectivity
];
- nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+ nativeBuildInputs = [ makeQtWrapper qmakeHook ] ++ qtInputs;
preConfigure = ''
cp src/gcconfig.pri.in src/gcconfig.pri
cp qwt/qwtconfig.pri.in qwt/qwtconfig.pri
echo 'QMAKE_LRELEASE = ${qttools.dev}/bin/lrelease' >> src/gcconfig.pri
sed -i -e '21,23d' qwt/qwtconfig.pri # Removed forced installation to /usr/local
'';
- #postConfigure =
- # + (
- # with (config.golden-cheetah);
- # stdenv.lib.optionalString (dropbox-client-id != null && dropbox-client-secret != null) ''
- # echo 'DEFINES += GC_DROPBOX_CLIENT_ID=\\\"${config.golden-cheetah.dropbox-client-id}\\\"' >> src/gcconfig.pri
- # echo 'DEFINES += GC_DROPBOX_CLIENT_SECRET=\\\"${config.golden-cheetah.dropbox-client-secret}\\\"' >> src/gcconfig.pri
- # '');
installPhase = ''
mkdir -p $out/bin
cp src/GoldenCheetah $out/bin
- wrapQtProgram $out/bin/GoldenCheetah --set LD_LIBRARY_PATH "${zlib.out}/lib" # patchelf doesn't seem to work
+ wrapQtProgram $out/bin/GoldenCheetah --set LD_LIBRARY_PATH "${zlib.out}/lib"
'';
meta = {
description = "Performance software for cyclists, runners and triathletes";
diff --git a/pkgs/applications/misc/termite/default.nix b/pkgs/applications/misc/termite/default.nix
index 837d736d10dd..850512a837d0 100644
--- a/pkgs/applications/misc/termite/default.nix
+++ b/pkgs/applications/misc/termite/default.nix
@@ -35,6 +35,7 @@ let
homepage = https://github.com/thestinger/termite/;
maintainers = with maintainers; [ koral garbas ];
platforms = platforms.all;
+ broken = true;
};
};
in if configFile == null then termite else symlinkJoin {
diff --git a/pkgs/applications/networking/browsers/palemoon/default.nix b/pkgs/applications/networking/browsers/palemoon/default.nix
new file mode 100644
index 000000000000..de21c37bc79e
--- /dev/null
+++ b/pkgs/applications/networking/browsers/palemoon/default.nix
@@ -0,0 +1,94 @@
+{ stdenv, fetchFromGitHub, makeDesktopItem
+, pkgconfig, autoconf213, alsaLib, bzip2, cairo
+, dbus, dbus_glib, file, fontconfig, freetype
+, gstreamer, gst_plugins_base, gst_all_1
+, gtk2, hunspell, icu, libevent, libjpeg, libnotify
+, libstartup_notification, libvpx, makeWrapper, mesa
+, nspr, nss, pango, perl, python, libpulseaudio, sqlite
+, unzip, xlibs, which, yasm, zip, zlib
+}:
+
+stdenv.mkDerivation rec {
+ name = "palemoon-${version}";
+ version = "27.0.3";
+
+ src = fetchFromGitHub {
+ name = "palemoon-src";
+ owner = "MoonchildProductions";
+ repo = "Pale-Moon";
+ rev = "c09119484da17c682a66e32bacbffb8cff411608";
+ sha256 = "1i4hp1lz0xaryy4zpncr67gbqg8v7a2cnyqjwvs2an86rk1vg913";
+ };
+
+ desktopItem = makeDesktopItem {
+ name = "palemoon";
+ exec = "palemoon %U";
+ desktopName = "Pale Moon";
+ genericName = "Web Browser";
+ categories = "Application;Network;WebBrowser;";
+ mimeType = stdenv.lib.concatStringsSep ";" [
+ "text/html"
+ "text/xml"
+ "application/xhtml+xml"
+ "application/vnd.mozilla.xul+xml"
+ "x-scheme-handler/http"
+ "x-scheme-handler/https"
+ "x-scheme-handler/ftp"
+ ];
+ };
+
+ buildInputs = [
+ alsaLib bzip2 cairo dbus dbus_glib file fontconfig freetype
+ gst_plugins_base gstreamer gst_all_1.gst-plugins-base gtk2
+ hunspell icu libevent libjpeg libnotify libstartup_notification
+ libvpx makeWrapper mesa nspr nss pango perl pkgconfig python
+ libpulseaudio sqlite unzip which yasm zip zlib
+ ] ++ (with xlibs; [
+ libX11 libXext libXft libXi libXrender libXScrnSaver
+ libXt pixman scrnsaverproto xextproto
+ ]);
+
+ enableParallelBuilding = true;
+
+ configurePhase = ''
+ export AUTOCONF=${autoconf213}/bin/autoconf
+ export MOZBUILD_STATE_PATH=$(pwd)/.mozbuild
+ export MOZ_CONFIG=$(pwd)/.mozconfig
+ export builddir=$(pwd)/build
+ mkdir -p $MOZBUILD_STATE_PATH $builddir
+ echo > $MOZ_CONFIG "
+ . $src/build/mozconfig.common
+ ac_add_options --prefix=$out
+ ac_add_options --enable-application=browser
+ ac_add_options --enable-official-branding
+ ac_add_options --enable-optimize="-O2"
+ ac_add_options --enable-jemalloc
+ ac_add_options --enable-shared-js
+ ac_add_options --disable-tests
+ "
+ '';
+
+ patchPhase = ''
+ chmod u+w .
+ sed -i /status4evar/d browser/installer/package-manifest.in
+ '';
+
+ buildPhase = ''
+ cd $builddir
+ $src/mach build
+ '';
+
+ installPhase = ''
+ cd $builddir
+ $src/mach install
+ '';
+
+ meta = with stdenv.lib; {
+ description = "A web browser";
+ homepage = https://www.palemoon.org/;
+ license = licenses.mpl20;
+ maintainers = with maintainers; [ rnhmjoj ];
+ platforms = platforms.linux;
+ };
+
+}
diff --git a/pkgs/applications/networking/browsers/w3m/default.nix b/pkgs/applications/networking/browsers/w3m/default.nix
index f07668756adf..637041379dbd 100644
--- a/pkgs/applications/networking/browsers/w3m/default.nix
+++ b/pkgs/applications/networking/browsers/w3m/default.nix
@@ -15,7 +15,7 @@ assert mouseSupport -> gpm-ncurses != null;
with stdenv.lib;
stdenv.mkDerivation rec {
- name = "w3m-v0.5.3+git20161120";
+ name = "w3m-0.5.3+git20161120";
src = fetchFromGitHub {
owner = "tats";
diff --git a/pkgs/applications/networking/cluster/mesos/default.nix b/pkgs/applications/networking/cluster/mesos/default.nix
index 8857e6ba4e35..818848f6a7f1 100644
--- a/pkgs/applications/networking/cluster/mesos/default.nix
+++ b/pkgs/applications/networking/cluster/mesos/default.nix
@@ -2,16 +2,27 @@
, automake115x, libtool, unzip, gnutar, jdk, maven, python, wrapPython
, setuptools, boto, pythonProtobuf, apr, subversion, gzip, systemd
, leveldb, glog, perf, utillinux, libnl, iproute, openssl, libevent
-, ethtool, coreutils
+, ethtool, coreutils, which, iptables
, bash
}:
let
mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
soext = if stdenv.system == "x86_64-darwin" then "dylib" else "so";
+ # `tar -z` requires gzip on $PATH, so wrap tar.
+ # At some point, we should try to patch mesos so we add gzip to the PATH when
+ # tar is invoked. I think that only needs to be done here:
+ # src/common/command_utils.cpp
+ # https://github.com/NixOS/nixpkgs/issues/13783
+ tarWithGzip = lib.overrideDerivation gnutar (oldAttrs: {
+ buildInputs = (oldAttrs.buildInputs or []) ++ [ makeWrapper ];
+ postInstall = (oldAttrs.postInstall or "") + ''
+ wrapProgram $out/bin/tar --prefix PATH ":" "${gzip}/bin"
+ '';
+ });
in stdenv.mkDerivation rec {
- version = "1.0.1";
+ version = "1.1.0";
name = "mesos-${version}";
enableParallelBuilding = true;
@@ -19,17 +30,14 @@ in stdenv.mkDerivation rec {
src = fetchurl {
url = "mirror://apache/mesos/${version}/${name}.tar.gz";
- sha256 = "1hdh2wh11ck98ycfrxfzgivgk2pjl3638vkyw14xj7faj9qxjlz0";
+ sha256 = "1hdjd4syyp88l0bnh88bhzvn9466ad2ysfp9pq3kwj3qzwg5jv8g";
};
patches = [
# https://reviews.apache.org/r/36610/
+ # TODO: is this still needed?
./rb36610.patch
- # https://issues.apache.org/jira/browse/MESOS-6013
- ./rb51324.patch
- ./rb51325.patch
-
# see https://github.com/cstrahan/mesos/tree/nixos-${version}
./nixos.patch
];
@@ -46,33 +54,55 @@ in stdenv.mkDerivation rec {
pythonProtobuf
];
+ # note that we *must* statically link libprotobuf.
+ # if we dynamically link the lib, we get these errors:
+ # https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
preConfigure = ''
+ substituteInPlace 3rdparty/stout/include/stout/os/posix/chown.hpp \
+ --subst-var-by chown ${coreutils}/bin/chown
+
+ substituteInPlace 3rdparty/stout/Makefile.am \
+ --replace "-lprotobuf" \
+ "${pythonProtobuf.protobuf.lib}/lib/libprotobuf.a"
+
substituteInPlace 3rdparty/stout/include/stout/os/posix/fork.hpp \
--subst-var-by sh ${bash}/bin/bash
- substituteInPlace 3rdparty/stout/include/stout/os/posix/shell.hpp \
- --subst-var-by sh ${bash}/bin/bash
-
- substituteInPlace src/Makefile.am \
- --subst-var-by mavenRepo ${mavenRepo}
+ substituteInPlace 3rdparty/stout/include/stout/posix/os.hpp \
+ --subst-var-by tar ${tarWithGzip}/bin/tar
substituteInPlace src/cli/mesos-scp \
--subst-var-by scp ${openssh}/bin/scp
+ substituteInPlace src/common/command_utils.cpp \
+ --subst-var-by curl ${curl}/bin/curl \
+ --subst-var-by gzip ${gzip}/bin/gzip \
+ --subst-var-by sha512sum ${coreutils}/bin/sha512sum \
+ --subst-var-by tar ${tarWithGzip}/bin/tar
+
substituteInPlace src/launcher/fetcher.cpp \
+ --subst-var-by cp ${coreutils}/bin/cp \
--subst-var-by gzip ${gzip}/bin/gzip \
- --subst-var-by tar ${gnutar}/bin/tar \
+ --subst-var-by tar ${tarWithGzip}/bin/tar \
--subst-var-by unzip ${unzip}/bin/unzip
substituteInPlace src/python/cli/src/mesos/cli.py \
--subst-var-by mesos-resolve $out/bin/mesos-resolve
+ substituteInPlace src/python/native_common/ext_modules.py.in \
+ --replace "-lprotobuf" \
+ "${pythonProtobuf.protobuf.lib}/lib/libprotobuf.a"
+
+ substituteInPlace src/slave/containerizer/mesos/isolators/gpu/volume.cpp \
+ --subst-var-by cp ${coreutils}/bin/cp \
+ --subst-var-by which ${which}/bin/which
+
substituteInPlace src/slave/containerizer/mesos/isolators/posix/disk.cpp \
- --subst-var-by du ${coreutils}/bin/du \
- --subst-var-by cp ${coreutils}/bin/cp
+ --subst-var-by du ${coreutils}/bin/du
substituteInPlace src/slave/containerizer/mesos/provisioner/backends/copy.cpp \
- --subst-var-by cp ${coreutils}/bin/cp
+ --subst-var-by cp ${coreutils}/bin/cp \
+ --subst-var-by rm ${coreutils}/bin/rm
substituteInPlace src/uri/fetchers/copy.cpp \
--subst-var-by cp ${coreutils}/bin/cp
@@ -83,23 +113,48 @@ in stdenv.mkDerivation rec {
substituteInPlace src/uri/fetchers/docker.cpp \
--subst-var-by curl ${curl}/bin/curl
+ substituteInPlace src/Makefile.am \
+ --subst-var-by mavenRepo ${mavenRepo} \
+ --replace "-lprotobuf" \
+ "${pythonProtobuf.protobuf.lib}/lib/libprotobuf.a"
+
'' + lib.optionalString stdenv.isLinux ''
substituteInPlace src/linux/perf.cpp \
--subst-var-by perf ${perf}/bin/perf
+ substituteInPlace src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
+
+ substituteInPlace src/slave/containerizer/mesos/isolators/filesystem/linux.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
+
substituteInPlace src/slave/containerizer/mesos/isolators/filesystem/shared.cpp \
--subst-var-by mount ${utillinux}/bin/mount
+ substituteInPlace src/slave/containerizer/mesos/isolators/gpu/isolator.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
+
substituteInPlace src/slave/containerizer/mesos/isolators/namespaces/pid.cpp \
--subst-var-by mount ${utillinux}/bin/mount
+ substituteInPlace src/slave/containerizer/mesos/isolators/network/cni/cni.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
+
+ substituteInPlace src/slave/containerizer/mesos/isolators/network/cni/plugins/port_mapper/port_mapper.cpp \
+ --subst-var-by iptables ${iptables}/bin/iptables
+
substituteInPlace src/slave/containerizer/mesos/isolators/network/port_mapping.cpp \
- --subst-var-by tc ${iproute}/bin/tc \
+ --subst-var-by ethtool ${ethtool}/sbin/ethtool \
--subst-var-by ip ${iproute}/bin/ip \
--subst-var-by mount ${utillinux}/bin/mount \
- --subst-var-by sh ${stdenv.shell} \
- --subst-var-by ethtool ${ethtool}/sbin/ethtool
+ --subst-var-by tc ${iproute}/bin/tc
+
+ substituteInPlace src/slave/containerizer/mesos/isolators/volume/image.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
+
+ substituteInPlace src/slave/containerizer/mesos/isolators/volume/sandbox_path.cpp \
+ --subst-var-by mount ${utillinux}/bin/mount
'';
configureFlags = [
@@ -108,7 +163,6 @@ in stdenv.mkDerivation rec {
"--with-svn=${subversion.dev}"
"--with-leveldb=${leveldb}"
"--with-glog=${glog}"
- "--with-glog=${glog}"
"--enable-optimize"
"--disable-python-dependency-install"
"--enable-ssl"
diff --git a/pkgs/applications/networking/cluster/mesos/maven_repo.patch b/pkgs/applications/networking/cluster/mesos/maven_repo.patch
deleted file mode 100644
index 9ee12976fde1..000000000000
--- a/pkgs/applications/networking/cluster/mesos/maven_repo.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/src/Makefile.am b/src/Makefile.am
-index ae2740a..1df91a7 100644
---- a/src/Makefile.am
-+++ b/src/Makefile.am
-@@ -1310,7 +1310,7 @@ if HAS_JAVA
-
- $(MESOS_JAR): $(MESOS_JAR_SOURCE) $(MESOS_JAR_GENERATED) java/mesos.pom
- @echo "Building mesos-$(PACKAGE_VERSION).jar ..."
-- @cd $(abs_top_builddir)/src/java && $(MVN) -f mesos.pom clean package
-+ @cd $(abs_top_builddir)/src/java && $(MVN) -f mesos.pom -Dmaven.repo.local=@mavenRepo@ clean package
-
- # Convenience library for JNI bindings.
- # TODO(Charles Reiss): We really should be building the Java library
diff --git a/pkgs/applications/networking/cluster/mesos/nixos.patch b/pkgs/applications/networking/cluster/mesos/nixos.patch
index 032357e452db..78e374b8d6bc 100644
--- a/pkgs/applications/networking/cluster/mesos/nixos.patch
+++ b/pkgs/applications/networking/cluster/mesos/nixos.patch
@@ -1,5 +1,18 @@
+diff --git a/3rdparty/stout/include/stout/os/posix/chown.hpp b/3rdparty/stout/include/stout/os/posix/chown.hpp
+index c82e2e574..15d332107 100644
+--- a/3rdparty/stout/include/stout/os/posix/chown.hpp
++++ b/3rdparty/stout/include/stout/os/posix/chown.hpp
+@@ -34,7 +34,7 @@ inline Try chown(
+ // TODO(bmahler): Consider walking the file tree instead. We would need
+ // to be careful to not miss dotfiles.
+ std::string command =
+- "chown -R " + stringify(uid) + ':' + stringify(gid) + " '" + path + "'";
++ "@chown@ -R " + stringify(uid) + ':' + stringify(gid) + " '" + path + "'";
+
+ int status = os::system(command);
+ if (status != 0) {
diff --git a/3rdparty/stout/include/stout/os/posix/fork.hpp b/3rdparty/stout/include/stout/os/posix/fork.hpp
-index a29967d..290b98b 100644
+index a29967dcb..290b98b50 100644
--- a/3rdparty/stout/include/stout/os/posix/fork.hpp
+++ b/3rdparty/stout/include/stout/os/posix/fork.hpp
@@ -369,7 +369,7 @@ private:
@@ -11,48 +24,97 @@ index a29967d..290b98b 100644
EXIT(EXIT_FAILURE)
<< "Failed to execute '" << command << "': " << os::strerror(errno);
} else if (wait.isSome()) {
-diff --git a/3rdparty/stout/include/stout/os/posix/shell.hpp b/3rdparty/stout/include/stout/os/posix/shell.hpp
-index 1d73ae5..9bf89b5 100644
---- a/3rdparty/stout/include/stout/os/posix/shell.hpp
-+++ b/3rdparty/stout/include/stout/os/posix/shell.hpp
-@@ -37,7 +37,7 @@ namespace Shell {
- // received by the callee, usually the command name and `arg1` is the
- // second command argument received by the callee.
-
--constexpr const char* name = "sh";
-+constexpr const char* name = "@sh@";
- constexpr const char* arg0 = "sh";
- constexpr const char* arg1 = "-c";
+diff --git a/3rdparty/stout/include/stout/posix/os.hpp b/3rdparty/stout/include/stout/posix/os.hpp
+index c37e64db6..d3d87b7f0 100644
+--- a/3rdparty/stout/include/stout/posix/os.hpp
++++ b/3rdparty/stout/include/stout/posix/os.hpp
+@@ -375,7 +375,7 @@ inline Option getenv(const std::string& key)
+ inline Try tar(const std::string& path, const std::string& archive)
+ {
+ Try tarOut =
+- os::shell("tar %s %s %s", "-czf", archive.c_str(), path.c_str());
++ os::shell("@tar@ %s %s %s", "-czf", archive.c_str(), path.c_str());
+ if (tarOut.isError()) {
+ return Error("Failed to archive " + path + ": " + tarOut.error());
diff --git a/src/Makefile.am b/src/Makefile.am
-index 28dd151..36fc6ec 100644
+index 3bcc0f2df..e5cbc57e8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
-@@ -1528,7 +1528,8 @@ if HAS_JAVA
+@@ -1545,7 +1545,7 @@ if HAS_JAVA
$(MESOS_JAR): $(MESOS_JAR_SOURCE) $(MESOS_JAR_GENERATED) java/mesos.pom
@echo "Building mesos-$(PACKAGE_VERSION).jar ..."
- @cd $(abs_top_builddir)/src/java && $(MVN) -B -f mesos.pom clean package
+ @cd $(abs_top_builddir)/src/java && $(MVN) -B -f mesos.pom -Dmaven.repo.local=@mavenRepo@ clean package
-+
# Convenience library for JNI bindings.
# TODO(Charles Reiss): We really should be building the Java library
diff --git a/src/cli/mesos-scp b/src/cli/mesos-scp
-index a71ab07..feed8c4 100755
+index a71ab0708..1043d1b3c 100755
--- a/src/cli/mesos-scp
+++ b/src/cli/mesos-scp
-@@ -19,7 +19,7 @@ if sys.version_info < (2,6,0):
+@@ -19,7 +19,8 @@ if sys.version_info < (2,6,0):
def scp(host, src, dst):
- cmd = 'scp -pr %s %s' % (src, host + ':' + dst)
+ cmd = '@scp@ -pr %s %s' % (src, host + ':' + dst)
++
try:
process = subprocess.Popen(
cmd,
+diff --git a/src/common/command_utils.cpp b/src/common/command_utils.cpp
+index 09e805140..90bf65896 100644
+--- a/src/common/command_utils.cpp
++++ b/src/common/command_utils.cpp
+@@ -140,7 +140,7 @@ Future tar(
+
+ argv.emplace_back(input);
+
+- return launch("tar", argv)
++ return launch("@tar@", argv)
+ .then([]() { return Nothing(); });
+ }
+
+@@ -162,7 +162,7 @@ Future untar(
+ argv.emplace_back(directory.get());
+ }
+
+- return launch("tar", argv)
++ return launch("@tar@", argv)
+ .then([]() { return Nothing(); });
+ }
+
+@@ -170,7 +170,7 @@ Future untar(
+ Future sha512(const Path& input)
+ {
+ #ifdef __linux__
+- const string cmd = "sha512sum";
++ const string cmd = "@sha512sum@";
+ vector argv = {
+ cmd,
+ input // Input file to compute shasum.
+@@ -206,7 +206,7 @@ Future gzip(const Path& input)
+ input
+ };
+
+- return launch("gzip", argv)
++ return launch("@gzip@", argv)
+ .then([]() { return Nothing(); });
+ }
+
+@@ -219,7 +219,7 @@ Future decompress(const Path& input)
+ input
+ };
+
+- return launch("gzip", argv)
++ return launch("@gzip@", argv)
+ .then([]() { return Nothing(); });
+ }
+
diff --git a/src/launcher/fetcher.cpp b/src/launcher/fetcher.cpp
-index 4456c28..e22c8fc 100644
+index 4456c2813..e22c8fc03 100644
--- a/src/launcher/fetcher.cpp
+++ b/src/launcher/fetcher.cpp
@@ -68,13 +68,13 @@ static Try extract(
@@ -82,11 +144,11 @@ index 4456c28..e22c8fc 100644
LOG(INFO) << "Copying resource with command:" << command;
diff --git a/src/linux/perf.cpp b/src/linux/perf.cpp
-index ea823b3..170f54d 100644
+index aa31982eb..8b5331b17 100644
--- a/src/linux/perf.cpp
+++ b/src/linux/perf.cpp
-@@ -125,7 +125,7 @@ private:
- // NOTE: The watchdog process places perf in its own process group
+@@ -127,7 +127,7 @@ private:
+ // NOTE: The supervisor childhook places perf in its own process group
// and will kill the perf process when the parent dies.
Try _perf = subprocess(
- "perf",
@@ -104,37 +166,51 @@ index ea823b3..170f54d 100644
command << " --event " << event;
}
diff --git a/src/linux/systemd.cpp b/src/linux/systemd.cpp
-index 619aa27..c1cbfe4 100644
+index 6318f48fc..394d88d47 100644
--- a/src/linux/systemd.cpp
+++ b/src/linux/systemd.cpp
-@@ -196,12 +196,19 @@ bool exists()
+@@ -196,13 +196,21 @@ bool exists()
// This is static as the init system should not change while we are running.
static const bool exists = []() -> bool {
// (1) Test whether `/sbin/init` links to systemd.
- const Result realpath = os::realpath("/sbin/init");
- if (realpath.isError() || realpath.isNone()) {
- LOG(WARNING) << "Failed to test /sbin/init for systemd environment: "
-- << realpath.error();
+- << (realpath.isError() ? realpath.error()
+- : "does not exist");
-
- return false;
-+ // cstrahan: first assume we're on NixOS, then try non-NixOS
++ // cstrahan(nixos): first assume we're on NixOS, then try non-NixOS
+ Result realpath = os::realpath("/run/current-system/systemd/lib/systemd/systemd");
+ Result realpathNixOS = realpath;
+ if (realpathNixOS.isError() || realpathNixOS.isNone()) {
+ Result realpathNonNixOS = realpath = os::realpath("/sbin/init");
+ if (realpathNonNixOS.isError() || realpathNonNixOS.isNone()) {
+ LOG(WARNING) << "Failed to test /run/current-system/systemd/lib/systemd/systemd for systemd environment: "
-+ << realpathNixOS.error();
++ << (realpathNixOS.isError() ? realpathNixOS.error()
++ : "does not exist");
+ LOG(WARNING) << "Failed to test /sbin/init for systemd environment: "
-+ << realpathNonNixOS.error();
++ << (realpathNonNixOS.isError() ? realpathNonNixOS.error()
++ : "does not exist");
+
+ return false;
+ }
}
CHECK_SOME(realpath);
+@@ -278,6 +286,10 @@ Path hierarchy()
+
+ Try daemonReload()
+ {
++ // cstrahan(nixos): should we patch these `systemctl`s?
++ // probably don't want to hard-code a particular systemd store path here,
++ // but if we use /run/current-system/sw/bin/systemctl,
++ // we won't be able to support non-NixOS distros.
+ Try daemonReload = os::shell("systemctl daemon-reload");
+ if (daemonReload.isError()) {
+ return Error("Failed to reload systemd daemon: " + daemonReload.error());
diff --git a/src/python/cli/src/mesos/cli.py b/src/python/cli/src/mesos/cli.py
-index f342992..354abf4 100644
+index f342992e0..354abf443 100644
--- a/src/python/cli/src/mesos/cli.py
+++ b/src/python/cli/src/mesos/cli.py
@@ -40,7 +40,7 @@ def resolve(master):
@@ -146,11 +222,70 @@ index f342992..354abf4 100644
stdin=None,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+diff --git a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
+index af9f3736b..f8554d414 100644
+--- a/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
++++ b/src/slave/containerizer/mesos/isolators/docker/volume/isolator.cpp
+@@ -499,7 +499,7 @@ Future