Skip to content

Commit

Permalink
Merge commit '0f21306ca3af2bc94a452ac8c414cdbe36703be2' into gcc-7
Browse files Browse the repository at this point in the history
  • Loading branch information
dezgeg committed Jan 29, 2018
2 parents e2c1c76 + 0f21306 commit f03c188
Show file tree
Hide file tree
Showing 14 changed files with 312 additions and 68 deletions.
19 changes: 15 additions & 4 deletions nixos/modules/services/web-servers/nginx/default.nix
Expand Up @@ -15,6 +15,9 @@ let
} // (optionalAttrs vhostConfig.enableACME {
sslCertificate = "/var/lib/acme/${serverName}/fullchain.pem";
sslCertificateKey = "/var/lib/acme/${serverName}/key.pem";
}) // (optionalAttrs (vhostConfig.useACMEHost != null) {
sslCertificate = "/var/lib/acme/${vhostConfig.useACMEHost}/fullchain.pem";
sslCertificateKey = "/var/lib/acme/${vhostConfig.useACMEHost}/key.pem";
})
) cfg.virtualHosts;
enableIPv6 = config.networking.enableIPv6;
Expand Down Expand Up @@ -174,7 +177,7 @@ let

redirectListen = filter (x: !x.ssl) defaultListen;

acmeLocation = ''
acmeLocation = optionalString (vhost.enableACME || vhost.useACMEHost != null) ''
location /.well-known/acme-challenge {
${optionalString (vhost.acmeFallbackHost != null) "try_files $uri @acme-fallback;"}
root ${vhost.acmeRoot};
Expand All @@ -194,7 +197,7 @@ let
${concatMapStringsSep "\n" listenString redirectListen}
server_name ${vhost.serverName} ${concatStringsSep " " vhost.serverAliases};
${optionalString vhost.enableACME acmeLocation}
${acmeLocation}
location / {
return 301 https://$host$request_uri;
}
Expand All @@ -204,7 +207,7 @@ let
server {
${concatMapStringsSep "\n" listenString hostListen}
server_name ${vhost.serverName} ${concatStringsSep " " vhost.serverAliases};
${optionalString vhost.enableACME acmeLocation}
${acmeLocation}
${optionalString (vhost.root != null) "root ${vhost.root};"}
${optionalString (vhost.globalRedirect != null) ''
return 301 http${optionalString hasSSL "s"}://${vhost.globalRedirect}$request_uri;
Expand Down Expand Up @@ -555,6 +558,14 @@ in
are mutually exclusive.
'';
}

{
assertion = all (conf: !(conf.enableACME && conf.useACMEHost != null)) (attrValues virtualHosts);
message = ''
Options services.nginx.service.virtualHosts.<name>.enableACME and
services.nginx.virtualHosts.<name>.useACMEHost are mutually exclusive.
'';
}
];

systemd.services.nginx = {
Expand All @@ -580,7 +591,7 @@ in
security.acme.certs = filterAttrs (n: v: v != {}) (
let
vhostsConfigs = mapAttrsToList (vhostName: vhostConfig: vhostConfig) virtualHosts;
acmeEnabledVhosts = filter (vhostConfig: vhostConfig.enableACME) vhostsConfigs;
acmeEnabledVhosts = filter (vhostConfig: vhostConfig.enableACME && vhostConfig.useACMEHost == null) vhostsConfigs;
acmePairs = map (vhostConfig: { name = vhostConfig.serverName; value = {
user = cfg.user;
group = lib.mkDefault cfg.group;
Expand Down
16 changes: 15 additions & 1 deletion nixos/modules/services/web-servers/nginx/vhost-options.nix
Expand Up @@ -48,7 +48,21 @@ with lib;
enableACME = mkOption {
type = types.bool;
default = false;
description = "Whether to ask Let's Encrypt to sign a certificate for this vhost.";
description = ''
Whether to ask Let's Encrypt to sign a certificate for this vhost.
Alternately, you can use an existing certificate through <option>useACMEHost</option>.
'';
};

useACMEHost = mkOption {
type = types.nullOr types.str;
default = null;
description = ''
A host of an existing Let's Encrypt certificate to use.
This is useful if you have many subdomains and want to avoid hitting the
<link xlink:href="https://letsencrypt.org/docs/rate-limits/">rate limit</link>.
Alternately, you can generate a certificate through <option>enableACME</option>.
'';
};

acmeRoot = mkOption {
Expand Down
21 changes: 21 additions & 0 deletions pkgs/applications/audio/pmidi/default.nix
@@ -0,0 +1,21 @@
{ stdenv, fetchurl, alsaLib
, version ? "1.7.1"
, sourceSha256 ? "051mv6f13c8y13c1iv3279k1hhzpz4fm9sfczhgp9sim2bjdj055"
}:
stdenv.mkDerivation {
name = "pmidi-${version}";

src = fetchurl {
url = "mirror://sourceforge/pmidi/${version}/pmidi-${version}.tar.gz";
sha256 = sourceSha256;
};

buildInputs = [ alsaLib ];

meta = with stdenv.lib; {
homepage = http://www.parabola.me.uk/alsa/pmidi.html;
description = "A straightforward command line program to play midi files through the ALSA sequencer";
maintainers = with maintainers; [ lheckemann ];
license = licenses.gpl2;
};
}
26 changes: 14 additions & 12 deletions pkgs/applications/misc/hubstaff/default.nix
@@ -1,15 +1,16 @@
{ stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE, libXext
, freetype, libXrender, fontconfig, libXft, libXinerama, libnotify, glib
, gtk3, libappindicator-gtk3, curl }:
{ stdenv, fetchurl, unzip, makeWrapper, libX11, zlib, libSM, libICE
, libXext , freetype, libXrender, fontconfig, libXft, libXinerama
, libXfixes, libXScrnSaver, libnotify, glib , gtk3, libappindicator-gtk3
, curl }:

let

version = "1.2.15-590e8bc";
version = "1.3.0-9b2ba62";

rpath = stdenv.lib.makeLibraryPath
[ libX11 zlib libSM libICE libXext freetype libXrender fontconfig libXft
libXinerama stdenv.cc.cc.lib libnotify glib gtk3 libappindicator-gtk3
curl ];
curl libXfixes libXScrnSaver ];

in

Expand All @@ -18,14 +19,14 @@ stdenv.mkDerivation {

src = fetchurl {
url = "https://hubstaff-production.s3.amazonaws.com/downloads/HubstaffClient/Builds/Release/${version}/Hubstaff-${version}.sh";
sha256 = "142q8xvwn5gdmpv5x25py2lindr74jqncf8vvw22yb9nj5aqqsi6";
sha256 = "1dxzyl3yxbfmbw1pv8k3vhqzbmyyf16zkgrhzsbm866nmbgnqk1s";
};

nativeBuildInputs = [ unzip makeWrapper ];

unpackCmd = ''
# MojoSetups have a ZIP file at the end. ZIP’s magic string is
# most often PK\x03\x04. This *should* work for future updates,
# most often PK\x03\x04. This has worked for all past updates,
# but feel free to come up with something more reasonable.
dataZipOffset=$(grep --max-count=1 --byte-offset --only-matching --text ''$'PK\x03\x04' $curSrc | cut -d: -f1)
dd bs=$dataZipOffset skip=1 if=$curSrc of=data.zip 2>/dev/null
Expand All @@ -38,17 +39,18 @@ stdenv.mkDerivation {
installPhase = ''
# TODO: handle 32-bit arch?
rm -r x86
rm -r x86_64/lib64
opt=$out/opt/hubstaff
mkdir -p $out/bin $opt
cp -r . $opt/
prog=$opt/x86_64/HubstaffClient.bin.x86_64
for f in "$opt/x86_64/"*.bin.x86_64 ; do
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) $f
wrapProgram $f --prefix LD_LIBRARY_PATH : ${rpath}
done
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) $prog
wrapProgram $prog --prefix LD_LIBRARY_PATH : ${rpath}
ln -s $prog $out/bin/HubstaffClient
ln -s $opt/x86_64/HubstaffClient.bin.x86_64 $out/bin/HubstaffClient
# Why is this needed? SEGV otherwise.
ln -s $opt/data/resources $opt/x86_64/resources
Expand Down
56 changes: 56 additions & 0 deletions pkgs/applications/networking/syncthing-gtk/default.nix
@@ -0,0 +1,56 @@
{ stdenv, fetchFromGitHub, libnotify, librsvg, psmisc, gtk3, substituteAll, syncthing, wrapGAppsHook, gnome3, buildPythonApplication, dateutil, pyinotify, pygobject3, bcrypt, gobjectIntrospection }:

buildPythonApplication rec {
version = "0.9.2.7";
name = "syncthing-gtk-${version}";

src = fetchFromGitHub {
owner = "syncthing";
repo = "syncthing-gtk";
rev = "v${version}";
sha256 = "08k7vkibia85klwjxbnzk67h4pphrizka5v9zxwvvv3cisjiclc2";
};

nativeBuildInputs = [
wrapGAppsHook
# For setup hook populating GI_TYPELIB_PATH
gobjectIntrospection
];

buildInputs = [
gtk3 (librsvg.override { enableIntrospection = true; })
libnotify
# Schemas with proxy configuration
gnome3.gsettings_desktop_schemas
];

propagatedBuildInputs = [
dateutil pyinotify pygobject3 bcrypt
];

patches = [
./disable-syncthing-binary-configuration.patch
(substituteAll {
src = ./paths.patch;
killall = "${psmisc}/bin/killall";
syncthing = "${syncthing}/bin/syncthing";
})
];

postPatch = ''
substituteInPlace setup.py --replace "version = get_version()" "version = '${version}'"
substituteInPlace scripts/syncthing-gtk --replace "/usr/share" "$out/share"
substituteInPlace syncthing_gtk/app.py --replace "/usr/share" "$out/share"
substituteInPlace syncthing_gtk/uisettingsdialog.py --replace "/usr/share" "$out/share"
substituteInPlace syncthing_gtk/wizard.py --replace "/usr/share" "$out/share"
substituteInPlace syncthing-gtk.desktop --replace "/usr/bin/syncthing-gtk" "$out/bin/syncthing-gtk"
'';

meta = with stdenv.lib; {
description = "GTK3 & python based GUI for Syncthing";
maintainers = with maintainers; [ ];
platforms = syncthing.meta.platforms;
homepage = https://github.com/syncthing/syncthing-gtk;
license = licenses.gpl2;
};
}
@@ -0,0 +1,77 @@
--- a/find-daemon.glade
+++ b/find-daemon.glade
@@ -112,6 +112,7 @@
<object class="GtkEntry" id="vsyncthing_binary">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="sensitive">False</property>
<property name="margin_right">20</property>
<signal name="changed" handler="cb_check_value" swapped="no"/>
</object>
@@ -126,6 +127,7 @@
<property name="label" translatable="yes">_Browse...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="sensitive">False</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="yalign">0.51999998092651367</property>
--- a/syncthing_gtk/configuration.py
+++ b/syncthing_gtk/configuration.py
@@ -168,6 +168,8 @@
yield k

def get(self, key):
+ if key == "syncthing_binary":
+ return self.REQUIRED_KEYS[key][1]
return self.values[key]

def set(self, key, value):
--- a/syncthing_gtk/finddaemondialog.py
+++ b/syncthing_gtk/finddaemondialog.py
@@ -163,7 +163,7 @@
self["lblDownloadProgress"].set_markup(_("Download failed."))
self["btDownload"].set_visible(True)
self["pbDownload"].set_visible(False)
- self["vsyncthing_binary"].set_sensitive(True)
+ self["vsyncthing_binary"].set_sensitive(False)
self["btBrowse"].set_sensitive(True)
self["btSave"].set_sensitive(True)

@@ -179,7 +179,7 @@

def cb_extract_finished(self, downloader, *a):
""" Called after extraction is finished """
- self["vsyncthing_binary"].set_sensitive(True)
+ self["vsyncthing_binary"].set_sensitive(False)
self["btBrowse"].set_sensitive(True)
self["vsyncthing_binary"].set_text(downloader.get_target())
self["lblDownloadProgress"].set_markup("<b>" + _("Download finished.") + "</b>")
--- a/syncthing_gtk/wizard.py
+++ b/syncthing_gtk/wizard.py
@@ -60,7 +60,6 @@
self.quit_button.connect("clicked", lambda *a : self.emit("cancel"))
# Pages
self.add_page(IntroPage(self))
- self.add_page(FindDaemonPage())
self.add_page(GenerateKeysPage())
self.add_page(HttpSettingsPage())
self.add_page(SaveSettingsPage())
--- a/ui-settings.glade
+++ b/ui-settings.glade
@@ -943,6 +943,7 @@
<property name="label" translatable="yes">_Browse...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="sensitive">False</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<property name="yalign">0.51999998092651367</property>
@@ -974,6 +975,7 @@
<object class="GtkEntry" id="vsyncthing_binary">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="sensitive">False</property>
<property name="hexpand">True</property>
<signal name="changed" handler="cb_check_value" swapped="no"/>
</object>
22 changes: 22 additions & 0 deletions pkgs/applications/networking/syncthing-gtk/paths.patch
@@ -0,0 +1,22 @@
--- a/syncthing_gtk/configuration.py
+++ b/syncthing_gtk/configuration.py
@@ -30,7 +30,7 @@
"autokill_daemon" : (int, 2), # 0 - never kill, 1 - always kill, 2 - ask
"daemon_priority" : (int, 0), # uses nice values
"max_cpus" : (int, 0), # 0 for all cpus
- "syncthing_binary" : (str, "/usr/bin/syncthing"),
+ "syncthing_binary" : (str, "@syncthing@"),
"syncthing_arguments" : (str, ""),
"minimize_on_start" : (bool, False),
"folder_as_path" : (bool, True),
--- a/syncthing_gtk/tools.py
+++ b/syncthing_gtk/tools.py
@@ -303,7 +303,7 @@
return False
# signal 0 doesn't kill anything, but killall exits with 1 if
# named process is not found
- p = Popen(["killall", "-u", os.environ["USER"], "-q", "-s", "0", "syncthing"])
+ p = Popen(["@killall@", "-u", os.environ["USER"], "-q", "-s", "0", "syncthing"])
p.communicate()
return p.returncode == 0
else:
20 changes: 20 additions & 0 deletions pkgs/applications/networking/znc/modules.nix
Expand Up @@ -15,6 +15,26 @@ let

in rec {

backlog = zncDerivation rec {
name = "znc-backlog-${version}";
version = "git-2017-06-13";
module_name = "backlog";

src = fetchFromGitHub {
owner = "FruitieX";
repo = "znc-backlog";
rev = "42e8f439808882d2dae60f2a161eabead14e4b0d";
sha256 = "1k7ifpqqzzf2j7w795q4mx1nvmics2higzjqr3mid3lp43sqg5s6";
};

meta = with stdenv.lib; {
description = "Request backlog for IRC channels.";
homepage = https://github.com/fruitiex/znc-backlog/;
license = licenses.asl20;
maintainers = with maintainers; [ infinisil ];
};
};

clientbuffer = zncDerivation rec {
name = "znc-clientbuffer-${version}";
version = "git-2015-08-27";
Expand Down

0 comments on commit f03c188

Please sign in to comment.