From 8119e08e34fe37cac47e3cc7db2fb7bceaf67f35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TG=20=E2=8A=97=20=CE=98?= <*@tg-x.net> Date: Tue, 25 Dec 2018 18:50:41 +0100 Subject: [PATCH 1/7] pythonPackages.mozsvc: 0.8 -> 0.10 --- .../python-modules/mozsvc/default.nix | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pkgs/development/python-modules/mozsvc/default.nix b/pkgs/development/python-modules/mozsvc/default.nix index b7fed9e6ad98..a7b3984b912e 100644 --- a/pkgs/development/python-modules/mozsvc/default.nix +++ b/pkgs/development/python-modules/mozsvc/default.nix @@ -1,7 +1,6 @@ { stdenv , buildPythonPackage -, fetchgit -, fetchurl +, fetchFromGitHub , pyramid , simplejson , konfig @@ -9,26 +8,22 @@ buildPythonPackage rec { pname = "mozsvc"; - version = "0.8"; + version = "0.10"; - src = fetchgit { - url = https://github.com/mozilla-services/mozservices.git; - rev = "refs/tags/${version}"; - sha256 = "1zci2ikk83mf7va88c83dr6snfh4ddjqw0lsg3y29qk5nxf80vx2"; + src = fetchFromGitHub { + owner = "mozilla-services"; + repo = "mozservices"; + rev = version; + sha256 = "0a0558g8j55pd1nnhnnf3k377jv6cah8lxb24v98rq8kxr5960cg"; }; - patches = stdenv.lib.singleton (fetchurl { - url = https://github.com/nbp/mozservices/commit/f86c0b0b870cd8f80ce90accde9e16ecb2e88863.diff; - sha256 = "1lnghx821f6dqp3pa382ka07cncdz7hq0mkrh44d0q3grvrlrp9n"; - }); - - doCheck = false; # lazy packager + doCheck = false; # too many dependencies and conflicting versions; I (nadrieril) gave up propagatedBuildInputs = [ pyramid simplejson konfig ]; meta = with stdenv.lib; { homepage = https://github.com/mozilla-services/mozservices; description = "Various utilities for Mozilla apps"; license = licenses.mpl20; + maintainers = with maintainers; [ nadrieril ]; }; - } From c1a071dd49a8e00820bc687231fdab80b7333bfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TG=20=E2=8A=97=20=CE=98?= <*@tg-x.net> Date: Tue, 25 Dec 2018 18:51:16 +0100 Subject: [PATCH 2/7] pythonPackages.syncserver: 1.6.0 -> 1.8.0 --- .../python-modules/syncserver/default.nix | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/pkgs/development/python-modules/syncserver/default.nix b/pkgs/development/python-modules/syncserver/default.nix index 7a93d64a89f5..7320a00a5575 100644 --- a/pkgs/development/python-modules/syncserver/default.nix +++ b/pkgs/development/python-modules/syncserver/default.nix @@ -1,5 +1,6 @@ -{ buildPythonPackage -, fetchgit +{ stdenv +, buildPythonPackage +, fetchFromGitHub , isPy27 , unittest2 , cornice @@ -16,13 +17,14 @@ buildPythonPackage rec { pname = "syncserver"; - version = "1.6.0"; + version = "1.8.0"; disabled = ! isPy27; - src = fetchgit { - url = https://github.com/mozilla-services/syncserver.git; - rev = "refs/tags/${version}"; - sha256 = "1fsiwihgq3z5b5kmssxxil5g2abfvsf6wfikzyvi4sy8hnym77mb"; + src = fetchFromGitHub { + owner = "mozilla-services"; + repo = "syncserver"; + rev = version; + sha256 = "0hxjns9hz7a8r87iqr1yfvny4vwj1rlhwcf8bh7j6lsf92mkmgy8"; }; buildInputs = [ unittest2 ]; @@ -30,4 +32,11 @@ buildPythonPackage rec { cornice gunicorn pyramid requests simplejson sqlalchemy mozsvc tokenserver serversyncstorage configparser ]; + + meta = with stdenv.lib; { + description = "Run-Your-Own Firefox Sync Server"; + homepage = "https://github.com/mozilla-services/syncserver"; + platforms = platforms.unix; + license = licenses.mpl20; + }; } From ab3d099d30d9d7b3425ef79d74568479b2e9164c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TG=20=E2=8A=97=20=CE=98?= <*@tg-x.net> Date: Tue, 25 Dec 2018 18:51:31 +0100 Subject: [PATCH 3/7] pythonPackages.serversyncstorage: 1.6.11 -> 1.6.14 --- .../serversyncstorage/default.nix | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/serversyncstorage/default.nix b/pkgs/development/python-modules/serversyncstorage/default.nix index 0e4b6cfa1e47..7342a729e292 100644 --- a/pkgs/development/python-modules/serversyncstorage/default.nix +++ b/pkgs/development/python-modules/serversyncstorage/default.nix @@ -1,5 +1,6 @@ -{ buildPythonPackage -, fetchgit +{ stdenv +, buildPythonPackage +, fetchFromGitHub , isPy27 , testfixtures , unittest2 @@ -20,13 +21,14 @@ buildPythonPackage rec { pname = "serversyncstorage"; - version = "1.6.11"; + version = "1.6.14"; disabled = !isPy27; - src = fetchgit { - url = https://github.com/mozilla-services/server-syncstorage.git; - rev = "refs/tags/${version}"; - sha256 = "197gj2jfs2c6nzs20j37kqxwi91wabavxnfm4rqmrjwhgqjwhnm0"; + src = fetchFromGitHub { + owner = "mozilla-services"; + repo = "server-syncstorage"; + rev = version; + sha256 = "08xclxj38rav8yay9cijiavv35jbyf6a9jzr24vgcna8pjjnbbmh"; }; checkInputs = [ testfixtures unittest2 webtest ]; @@ -35,7 +37,10 @@ buildPythonPackage rec { pymysqlsa umemcache WSGIProxy requests pybrowserid ]; - meta = { - broken = true; # 2018-11-04 + meta = with stdenv.lib; { + description = "The SyncServer server software, as used by Firefox Sync"; + homepage = https://github.com/mozilla-services/server-syncstorage; + license = licenses.mpl20; + maintainers = with maintainers; [ nadrieril ]; }; } From 08aa3e7f2ebbd73868712db24ed672f91f37a5bc Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Wed, 30 Jan 2019 15:57:40 +0100 Subject: [PATCH 4/7] pythonPackages.tokenserver: add Nadrieril to maintainers --- pkgs/development/python-modules/tokenserver/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/python-modules/tokenserver/default.nix b/pkgs/development/python-modules/tokenserver/default.nix index a07da568dca4..08f3f87321fe 100644 --- a/pkgs/development/python-modules/tokenserver/default.nix +++ b/pkgs/development/python-modules/tokenserver/default.nix @@ -31,5 +31,6 @@ buildPythonPackage rec { description = "The Mozilla Token Server"; homepage = https://github.com/mozilla-services/tokenserver; license = licenses.mpl20; + maintainers = with maintainers; [ nadrieril ]; }; } From 957d0589ad716d21ec999a4bfa9c7a8c6cc346fd Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 28 Jan 2019 18:11:32 +0100 Subject: [PATCH 5/7] pythonPackages.syncserver: move to all-packages.nix and fix dependencies --- .../networking/firefox/sync-server.nix | 10 ++-- .../python-modules/syncserver/default.nix | 42 ----------------- pkgs/servers/syncserver/default.nix | 47 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 2 - 5 files changed, 56 insertions(+), 47 deletions(-) delete mode 100644 pkgs/development/python-modules/syncserver/default.nix create mode 100644 pkgs/servers/syncserver/default.nix diff --git a/nixos/modules/services/networking/firefox/sync-server.nix b/nixos/modules/services/networking/firefox/sync-server.nix index 97d223a56cab..2ae3226e924f 100644 --- a/nixos/modules/services/networking/firefox/sync-server.nix +++ b/nixos/modules/services/networking/firefox/sync-server.nix @@ -127,14 +127,16 @@ in config = mkIf cfg.enable { systemd.services.syncserver = let - syncServerEnv = pkgs.python.withPackages(ps: with ps; [ syncserver pasteScript requests ]); user = "syncserver"; group = "syncserver"; in { after = [ "network.target" ]; description = "Firefox Sync Server"; wantedBy = [ "multi-user.target" ]; - path = [ pkgs.coreutils syncServerEnv ]; + path = [ + pkgs.coreutils + (pkgs.python.withPackages (ps: [ pkgs.syncserver ps.pasteScript ps.requests ])) + ]; serviceConfig = { User = user; @@ -166,7 +168,9 @@ in chown ${user}:${group} ${defaultDbLocation} fi ''; - serviceConfig.ExecStart = "${syncServerEnv}/bin/paster serve ${syncServerIni}"; + script = '' + paster serve ${syncServerIni} + ''; }; users.users.syncserver = { diff --git a/pkgs/development/python-modules/syncserver/default.nix b/pkgs/development/python-modules/syncserver/default.nix deleted file mode 100644 index 7320a00a5575..000000000000 --- a/pkgs/development/python-modules/syncserver/default.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ stdenv -, buildPythonPackage -, fetchFromGitHub -, isPy27 -, unittest2 -, cornice -, gunicorn -, pyramid -, requests -, simplejson -, sqlalchemy -, mozsvc -, tokenserver -, serversyncstorage -, configparser -}: - -buildPythonPackage rec { - pname = "syncserver"; - version = "1.8.0"; - disabled = ! isPy27; - - src = fetchFromGitHub { - owner = "mozilla-services"; - repo = "syncserver"; - rev = version; - sha256 = "0hxjns9hz7a8r87iqr1yfvny4vwj1rlhwcf8bh7j6lsf92mkmgy8"; - }; - - buildInputs = [ unittest2 ]; - propagatedBuildInputs = [ - cornice gunicorn pyramid requests simplejson sqlalchemy mozsvc tokenserver - serversyncstorage configparser - ]; - - meta = with stdenv.lib; { - description = "Run-Your-Own Firefox Sync Server"; - homepage = "https://github.com/mozilla-services/syncserver"; - platforms = platforms.unix; - license = licenses.mpl20; - }; -} diff --git a/pkgs/servers/syncserver/default.nix b/pkgs/servers/syncserver/default.nix new file mode 100644 index 000000000000..d41923758017 --- /dev/null +++ b/pkgs/servers/syncserver/default.nix @@ -0,0 +1,47 @@ +{ lib +, python2 +, fetchFromGitHub +}: + +let + python = python2.override { + packageOverrides = self: super: { + # Older version, used by syncserver, tokenserver and serversyncstorage + cornice = super.cornice.overridePythonAttrs (oldAttrs: rec { + version = "0.17"; + src = oldAttrs.src.override { + inherit version; + sha256 = "1vvymhf6ydc885ygqiqpa39xr9v302i1l6nzirjnczqy9llyqvpj"; + }; + }); + }; + }; + +# buildPythonPackage is necessary for syncserver to work with gunicorn or paster scripts +in python.pkgs.buildPythonPackage rec { + pname = "syncserver"; + version = "1.8.0"; + + src = fetchFromGitHub { + owner = "mozilla-services"; + repo = "syncserver"; + rev = version; + sha256 = "0hxjns9hz7a8r87iqr1yfvny4vwj1rlhwcf8bh7j6lsf92mkmgy8"; + }; + + # There are no tests + doCheck = false; + + propagatedBuildInputs = with python.pkgs; [ + cornice gunicorn pyramid requests simplejson sqlalchemy mozsvc tokenserver + serversyncstorage configparser + ]; + + meta = with lib; { + description = "Run-Your-Own Firefox Sync Server"; + homepage = https://github.com/mozilla-services/syncserver; + platforms = platforms.unix; + license = licenses.mpl20; + maintainers = with maintainers; [ nadrieril ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 556dfcf0c040..d9b3b4c46096 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14138,6 +14138,8 @@ in systemd-journal2gelf = callPackage ../tools/system/systemd-journal2gelf { }; + syncserver = callPackage ../servers/syncserver { }; + inherit (callPackages ../servers/http/tomcat { }) tomcat7 tomcat8 diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index d0e571686ea5..02db7bfc1954 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -774,8 +774,6 @@ in { supervise_api = callPackage ../development/python-modules/supervise_api { }; - syncserver = callPackage ../development/python-modules/syncserver {}; - tables = callPackage ../development/python-modules/tables { hdf5 = pkgs.hdf5.override { zlib = pkgs.zlib; }; }; From 63c7fe0819ce5255a59609f5b73be49da82060b8 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 28 Jan 2019 17:56:20 +0100 Subject: [PATCH 6/7] nixos/syncserver: use gunicorn As described in `syncserver`'s documentation. Makes it possible to run behind a reverse proxy. --- nixos/modules/services/networking/firefox/sync-server.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nixos/modules/services/networking/firefox/sync-server.nix b/nixos/modules/services/networking/firefox/sync-server.nix index 2ae3226e924f..03109652e982 100644 --- a/nixos/modules/services/networking/firefox/sync-server.nix +++ b/nixos/modules/services/networking/firefox/sync-server.nix @@ -13,7 +13,7 @@ let overrides = ${cfg.privateConfig} [server:main] - use = egg:Paste#http + use = egg:gunicorn host = ${cfg.listen.address} port = ${toString cfg.listen.port} @@ -135,7 +135,7 @@ in wantedBy = [ "multi-user.target" ]; path = [ pkgs.coreutils - (pkgs.python.withPackages (ps: [ pkgs.syncserver ps.pasteScript ps.requests ])) + (pkgs.python.withPackages (ps: [ pkgs.syncserver ps.gunicorn ])) ]; serviceConfig = { @@ -168,8 +168,9 @@ in chown ${user}:${group} ${defaultDbLocation} fi ''; + script = '' - paster serve ${syncServerIni} + gunicorn --paste ${syncServerIni} ''; }; From 375020cf991351d1ba80313301f5de8c3e11ff2f Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Mon, 28 Jan 2019 17:55:56 +0100 Subject: [PATCH 7/7] nixos/syncserver: mild cleanup --- .../services/networking/firefox/sync-server.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/nixos/modules/services/networking/firefox/sync-server.nix b/nixos/modules/services/networking/firefox/sync-server.nix index 03109652e982..6842aa735617 100644 --- a/nixos/modules/services/networking/firefox/sync-server.nix +++ b/nixos/modules/services/networking/firefox/sync-server.nix @@ -30,6 +30,8 @@ let audiences = ${removeSuffix "/" cfg.publicUrl} ''; + user = "syncserver"; + group = "syncserver"; in { @@ -126,10 +128,7 @@ in config = mkIf cfg.enable { - systemd.services.syncserver = let - user = "syncserver"; - group = "syncserver"; - in { + systemd.services.syncserver = { after = [ "network.target" ]; description = "Firefox Sync Server"; wantedBy = [ "multi-user.target" ]; @@ -174,11 +173,11 @@ in ''; }; - users.users.syncserver = { - group = "syncserver"; + users.users.${user} = { + inherit group; isSystemUser = true; }; - users.groups.syncserver = {}; + users.groups.${group} = {}; }; }