Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into HEAD
Browse files Browse the repository at this point in the history
  • Loading branch information
FRidh committed Feb 18, 2018
2 parents 0586da4 + 655446c commit 5d4012b
Show file tree
Hide file tree
Showing 71 changed files with 1,316 additions and 145 deletions.
8 changes: 6 additions & 2 deletions lib/licenses.nix
Expand Up @@ -2,7 +2,7 @@
let

spdx = lic: lic // {
url = "http://spdx.org/licenses/${lic.spdxId}";
url = "http://spdx.org/licenses/${lic.spdxId}.html";
};

in
Expand Down Expand Up @@ -580,6 +580,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
fullName = "Vovida Software License v1.0";
};

watcom = spdx {
spdxId = "Watcom-1.0";
fullName = "Sybase Open Watcom Public License 1.0";
};

w3c = spdx {
spdxId = "W3C";
fullName = "W3C Software Notice and License";
Expand Down Expand Up @@ -614,5 +619,4 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
spdxId = "ZPL-2.1";
fullName = "Zope Public License 2.1";
};

}
1 change: 1 addition & 0 deletions lib/maintainers.nix
Expand Up @@ -496,6 +496,7 @@
nicknovitski = "Nick Novitski <nixpkgs@nicknovitski.com>";
nico202 = "Nicolò Balzarotti <anothersms@gmail.com>";
NikolaMandic = "Ratko Mladic <nikola@mandic.email>";
ninjatrappeur = "Félix Baylac-Jacqué <felix@alternativebit.fr>";
nipav = "Niko Pavlinek <niko.pavlinek@gmail.com>";
nixy = "Andrew R. M. <nixy@nixy.moe>";
nmattia = "Nicolas Mattia <nicolas@nmattia.com>";
Expand Down
1 change: 1 addition & 0 deletions nixos/modules/module-list.nix
Expand Up @@ -694,6 +694,7 @@
./services/x11/xserver.nix
./system/activation/activation-script.nix
./system/activation/top-level.nix
./system/boot/binfmt.nix
./system/boot/coredump.nix
./system/boot/emergency-mode.nix
./system/boot/grow-partition.nix
Expand Down
6 changes: 5 additions & 1 deletion nixos/modules/services/mail/postfix.nix
Expand Up @@ -414,14 +414,18 @@ in
postmasterAlias = mkOption {
type = types.str;
default = "root";
description = "Who should receive postmaster e-mail.";
description = "
Who should receive postmaster e-mail. Multiple values can be added by
separating values with comma.
";
};

rootAlias = mkOption {
type = types.str;
default = "";
description = "
Who should receive root e-mail. Blank for no redirection.
Multiple values can be added by separating values with comma.
";
};

Expand Down
139 changes: 139 additions & 0 deletions nixos/modules/system/boot/binfmt.nix
@@ -0,0 +1,139 @@
{ config, lib, ... }:
let
inherit (lib) mkOption types optionalString;

cfg = config.boot.binfmtMiscRegistrations;

makeBinfmtLine = name: { recognitionType, offset, magicOrExtension
, mask, preserveArgvZero, openBinary
, matchCredentials, fixBinary, ...
}: let
type = if recognitionType == "magic" then "M" else "E";
offset' = toString offset;
mask' = toString mask;
interpreter = "/run/binfmt/${name}";
flags = if !(matchCredentials -> openBinary)
then throw "boot.binfmtMiscRegistrations.${name}: you can't specify openBinary = false when matchCredentials = true."
else optionalString preserveArgvZero "P" +
optionalString (openBinary && !matchCredentials) "O" +
optionalString matchCredentials "C" +
optionalString fixBinary "F";
in ":${name}:${type}:${offset'}:${magicOrExtension}:${mask'}:${interpreter}:${flags}";

binfmtFile = builtins.toFile "binfmt_nixos.conf"
(lib.concatStringsSep "\n" (lib.mapAttrsToList makeBinfmtLine cfg));

activationSnippet = name: { interpreter, ... }:
"ln -sf ${interpreter} /run/binfmt/${name}";
activationScript = ''
mkdir -p -m 0755 /run/binfmt
${lib.concatStringsSep "\n" (lib.mapAttrsToList activationSnippet cfg)}
'';
in {
options = {
boot.binfmtMiscRegistrations = mkOption {
default = {};

description = ''
Extra binary formats to register with the kernel.
See https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html for more details.
'';

type = types.attrsOf (types.submodule ({ config, ... }: {
options = {
recognitionType = mkOption {
default = "magic";
description = "Whether to recognize executables by magic number or extension.";
type = types.enum [ "magic" "extension" ];
};

offset = mkOption {
default = null;
description = "The byte offset of the magic number used for recognition.";
type = types.nullOr types.int;
};

magicOrExtension = mkOption {
description = "The magic number or extension to match on.";
type = types.str;
};

mask = mkOption {
default = null;
description =
"A mask to be ANDed with the byte sequence of the file before matching";
type = types.nullOr types.str;
};

interpreter = mkOption {
description = ''
The interpreter to invoke to run the program.
Note that the actual registration will point to
/run/binfmt/''${name}, so the kernel interpreter length
limit doesn't apply.
'';
type = types.path;
};

preserveArgvZero = mkOption {
default = false;
description = ''
Whether to pass the original argv[0] to the interpreter.
See the description of the 'P' flag in the kernel docs
for more details;
'';
type = types.bool;
};

openBinary = mkOption {
default = config.matchCredentials;
description = ''
Whether to pass the binary to the interpreter as an open
file descriptor, instead of a path.
'';
type = types.bool;
};

matchCredentials = mkOption {
default = false;
description = ''
Whether to launch with the credentials and security
token of the binary, not the interpreter (e.g. setuid
bit).
See the description of the 'C' flag in the kernel docs
for more details.
Implies/requires openBinary = true.
'';
type = types.bool;
};

fixBinary = mkOption {
default = false;
description = ''
Whether to open the interpreter file as soon as the
registration is loaded, rather than waiting for a
relevant file to be invoked.
See the description of the 'F' flag in the kernel docs
for more details.
'';
type = types.bool;
};
};
}));
};
};

config = lib.mkIf (cfg != {}) {
environment.etc."binfmt.d/nixos.conf".source = binfmtFile;
system.activationScripts.binfmt = activationScript;
systemd.additionalUpstreamSystemUnits =
[ "proc-sys-fs-binfmt_misc.automount"
"proc-sys-fs-binfmt_misc.mount"
];
};
}
36 changes: 33 additions & 3 deletions nixos/tests/home-assistant.nix
Expand Up @@ -2,17 +2,27 @@ import ./make-test.nix ({ pkgs, ... }:

let
configDir = "/var/lib/foobar";
apiPassword = "secret";

in {
name = "home-assistant";
meta = with pkgs.stdenv.lib; {
maintainers = with maintainers; [ dotlambda ];
};

nodes = {
hass =
{ config, pkgs, ... }:
{
environment.systemPackages = with pkgs; [
mosquitto
];
services.home-assistant = {
inherit configDir;
enable = true;
package = pkgs.home-assistant.override {
extraPackages = ps: with ps; [ hbmqtt ];
};
config = {
homeassistant = {
name = "Home";
Expand All @@ -22,7 +32,16 @@ in {
elevation = 0;
};
frontend = { };
http = { };
http.api_password = apiPassword;
mqtt = { }; # Use hbmqtt as broker
binary_sensor = [
{
platform = "mqtt";
state_topic = "home-assistant/test";
payload_on = "let_there_be_light";
payload_off = "off";
}
];
};
};
};
Expand All @@ -31,16 +50,27 @@ in {
testScript = ''
startAll;
$hass->waitForUnit("home-assistant.service");
# Since config is specified using a Nix attribute set,
# configuration.yaml is a link to the Nix store
$hass->succeed("test -L ${configDir}/configuration.yaml");
# Check that Home Assistant's web interface and API can be reached
$hass->waitForOpenPort(8123);
$hass->succeed("curl --fail http://localhost:8123/states");
$hass->succeed("curl --fail http://localhost:8123/api/ | grep 'API running'");
$hass->succeed("curl --fail -H 'x-ha-access: ${apiPassword}' http://localhost:8123/api/ | grep -qF 'API running'");
# Toggle a binary sensor using MQTT
$hass->succeed("curl http://localhost:8123/api/states/binary_sensor.mqtt_binary_sensor -H 'x-ha-access: ${apiPassword}' | grep -qF '\"state\": \"off\"'");
$hass->waitUntilSucceeds("mosquitto_pub -V mqttv311 -t home-assistant/test -u homeassistant -P '${apiPassword}' -m let_there_be_light");
$hass->succeed("curl http://localhost:8123/api/states/binary_sensor.mqtt_binary_sensor -H 'x-ha-access: ${apiPassword}' | grep -qF '\"state\": \"on\"'");
# Check that no errors were logged
$hass->fail("cat ${configDir}/home-assistant.log | grep -qF ERROR");
# Print log to ease debugging
my $log = $hass->succeed("cat ${configDir}/home-assistant.log");
print "\n### home-assistant.log ###\n";
print "$log\n";
'';
})
2 changes: 1 addition & 1 deletion nixos/tests/networking.nix
Expand Up @@ -530,7 +530,7 @@ let
$client->waitUntilSucceeds("ping -c 1 fd00:1234:5678:1::1");
# Test address used is temporary
$client->succeed("! ip route get fd00:1234:5678:1::1 | grep -q ':[a-f0-9]*ff:fe[a-f0-9]*:'");
$client->waitUntilSucceeds("! ip route get fd00:1234:5678:1::1 | grep -q ':[a-f0-9]*ff:fe[a-f0-9]*:'");
'';
};
};
Expand Down
8 changes: 4 additions & 4 deletions pkgs/applications/editors/vscode/default.nix
Expand Up @@ -2,7 +2,7 @@
makeWrapper, libXScrnSaver, libxkbfile, libsecret }:

let
version = "1.20.0";
version = "1.20.1";
channel = "stable";

plat = {
Expand All @@ -12,9 +12,9 @@ let
}.${stdenv.system};

sha256 = {
"i686-linux" = "0lhfljcdb05v0p3kc6zimgd2z057397blfp56bhr7v7wnsi6i40k";
"x86_64-linux" = "138kvqa5cixry62yry0lwzxlk9fs8hb4zqzmsd8ag1jjfma8y45k";
"x86_64-darwin" = "1adnwlqf2kw8wfjf86a3xg83j1yqnlsdckksw82b06x3j11g91i8";
"i686-linux" = "0gycz857bl9ikfrylim970qgmyw7rcy3gbg2zsjddp9cgdk9basn";
"x86_64-linux" = "0rx0qyxv173s9wjw97f94h61f12lh42grnmabgsvwd87b8zx4qim";
"x86_64-darwin" = "0mqxmmkp3bsmy1g35prsgan61zzq5368gp720v37cwx1rskl0bfg";
}.${stdenv.system};

archive_fmt = if stdenv.system == "x86_64-darwin" then "zip" else "tar.gz";
Expand Down
7 changes: 3 additions & 4 deletions pkgs/applications/misc/octoprint/default.nix
Expand Up @@ -54,14 +54,13 @@ let

in pythonPackages.buildPythonApplication rec {
name = "OctoPrint-${version}";
version = "1.3.5";
# 1.3.5, 2017-10-16, 77753ca02602d3a798d6b0a22535e6fd69ff448a
version = "1.3.6";

src = fetchFromGitHub {
owner = "foosel";
repo = "OctoPrint";
rev = version;
sha256 = "13krv9i6gm4jn4cb327q4qma4xwwashjnc0dia8vlnbjbbvkrni4";
sha256 = "0pgpkjw5zjnks5bky51gjaksq8mhrzkl52kpgf799hl35pd08xr3";
};

# We need old Tornado
Expand All @@ -70,7 +69,7 @@ in pythonPackages.buildPythonApplication rec {
semantic-version flask_principal werkzeug flaskbabel tornado
psutil pyserial flask_login netaddr markdown sockjs-tornado
pylru pyyaml sarge feedparser netifaces click websocket_client
scandir chainmap future dateutil futures wrapt
scandir chainmap future dateutil futures wrapt monotonic emoji
];

buildInputs = with pythonPackages; [ nose mock ddt ];
Expand Down
5 changes: 4 additions & 1 deletion pkgs/applications/misc/redshift/default.nix
Expand Up @@ -41,7 +41,10 @@ stdenv.mkDerivation rec {
pythonPath = [ pygobject3 pyxdg ];

preConfigure = "./bootstrap";
postFixup = "wrapPythonPrograms";
postFixup = ''
wrapPythonPrograms
rm "$out/share/icons/hicolor/icon-theme.cache"
'';

enableParallelBuilding = true;

Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/networking/browsers/firefox/wrapper.nix
Expand Up @@ -71,7 +71,7 @@ let
++ lib.optionals (cfg.enableQuakeLive or false)
(with xorg; [ stdenv.cc libX11 libXxf86dga libXxf86vm libXext libXt alsaLib zlib libudev ])
++ lib.optional (enableAdobeFlash && (cfg.enableAdobeFlashDRM or false)) hal-flash
++ lib.optional (config.pulseaudio or false) libpulseaudio;
++ lib.optional (config.pulseaudio or true) libpulseaudio;
gst-plugins = with gst_all; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-ffmpeg ];
gtk_modules = [ libcanberra_gtk2 ];

Expand Down
18 changes: 14 additions & 4 deletions pkgs/applications/networking/browsers/palemoon/default.nix
Expand Up @@ -10,14 +10,14 @@

stdenv.mkDerivation rec {
name = "palemoon-${version}";
version = "27.6.2";
version = "27.7.2";

src = fetchFromGitHub {
name = "palemoon-src";
owner = "MoonchildProductions";
repo = "Pale-Moon";
rev = version + "_Release";
sha256 = "0ickxrwl36iyqj3v9qq6hnfl2y652f2ppwi949pfh4f6shm9x0ri";
sha256 = "19ki6gp6bhcvhjnclalviiyp93mqsgc22xjl0gm9x5y4sxdb5wlq";
};

desktopItem = makeDesktopItem {
Expand Down Expand Up @@ -101,10 +101,20 @@ stdenv.mkDerivation rec {

meta = with stdenv.lib; {
description = "A web browser";
longDescription = ''
Pale Moon is an Open Source, Goanna-based web browser focusing on
efficiency and customization.
Pale Moon offers you a browsing experience in a browser completely built
from its own, independently developed source that has been forked off from
Firefox/Mozilla code a number of years ago, with carefully selected
features and optimizations to improve the browser's stability and user
experience, while offering full customization and a growing collection of
extensions and themes to make the browser truly your own.
'';
homepage = https://www.palemoon.org/;
license = licenses.mpl20;
maintainers = with maintainers; [ rnhmjoj ];
maintainers = with maintainers; [ rnhmjoj AndersonTorres ];
platforms = platforms.linux;
};

}

0 comments on commit 5d4012b

Please sign in to comment.