Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ff0148d868bd
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: f024e7b769df
Choose a head ref
  • 5 commits
  • 6 files changed
  • 2 contributors

Commits on Oct 7, 2019

  1. mxisd: 1.4.5 -> 1.4.6

    mguentner committed Oct 7, 2019

    Verified

    This commit was signed with the committer’s verified signature.
    snyk-bot Snyk bot
    Copy the full SHA
    fd0eec1 View commit details
  2. Copy the full SHA
    ca1c9bc View commit details
  3. ma1sd: init at 2.1.1

    ma1sd is a fork of mxisd which is already packaged
    but EOL.
    mguentner committed Oct 7, 2019
    Copy the full SHA
    ce58704 View commit details
  4. nixos/mxisd: add support for ma1sd

    both servers only differ slighly so the module
    can be reused
    mguentner committed Oct 7, 2019
    Copy the full SHA
    176b1ae View commit details

Commits on Oct 9, 2019

  1. Merge pull request #67890 from mguentner/mxisd_ma1sd

    mxisd: 1.4.5 -> 1.4.6 ☺ ma1sd: init at 2.1.1
    fpletz authored Oct 9, 2019
    Copy the full SHA
    f024e7b View commit details
33 changes: 24 additions & 9 deletions nixos/modules/services/networking/mxisd.nix
Original file line number Diff line number Diff line change
@@ -3,6 +3,15 @@
with lib;

let

isMa1sd =
package:
lib.hasPrefix "ma1sd" package.name;

isMxisd =
package:
lib.hasPrefix "mxisd" package.name;

cfg = config.services.mxisd;

server = optionalAttrs (cfg.server.name != null) { inherit (cfg.server) name; }
@@ -12,37 +21,41 @@ let
matrix.domain = cfg.matrix.domain;
key.path = "${cfg.dataDir}/signing.key";
storage = {
provider.sqlite.database = "${cfg.dataDir}/mxisd.db";
provider.sqlite.database = if isMa1sd cfg.package
then "${cfg.dataDir}/ma1sd.db"
else "${cfg.dataDir}/mxisd.db";
};
} // optionalAttrs (server != {}) { inherit server; };

# merges baseConfig and extraConfig into a single file
fullConfig = recursiveUpdate baseConfig cfg.extraConfig;

configFile = pkgs.writeText "mxisd-config.yaml" (builtins.toJSON fullConfig);
configFile = if isMa1sd cfg.package
then pkgs.writeText "ma1sd-config.yaml" (builtins.toJSON fullConfig)
else pkgs.writeText "mxisd-config.yaml" (builtins.toJSON fullConfig);

in {
options = {
services.mxisd = {
enable = mkEnableOption "mxisd matrix federated identity server";
enable = mkEnableOption "matrix federated identity server";

package = mkOption {
type = types.package;
default = pkgs.mxisd;
defaultText = "pkgs.mxisd";
description = "The mxisd package to use";
description = "The mxisd/ma1sd package to use";
};

dataDir = mkOption {
type = types.str;
default = "/var/lib/mxisd";
description = "Where data mxisd uses resides";
description = "Where data mxisd/ma1sd uses resides";
};

extraConfig = mkOption {
type = types.attrs;
default = {};
description = "Extra options merged into the mxisd configuration";
description = "Extra options merged into the mxisd/ma1sd configuration";
};

matrix = {
@@ -62,7 +75,7 @@ in {
type = types.nullOr types.str;
default = null;
description = ''
Public hostname of mxisd, if different from the Matrix domain.
Public hostname of mxisd/ma1sd, if different from the Matrix domain.
'';
};

@@ -103,11 +116,13 @@ in {
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];

serviceConfig = {
serviceConfig = let
executable = if isMa1sd cfg.package then "ma1sd" else "mxisd";
in {
Type = "simple";
User = "mxisd";
Group = "mxisd";
ExecStart = "${cfg.package}/bin/mxisd -c ${configFile}";
ExecStart = "${cfg.package}/bin/${executable} -c ${configFile}";
WorkingDirectory = cfg.dataDir;
Restart = "on-failure";
};
12 changes: 11 additions & 1 deletion nixos/tests/mxisd.nix
Original file line number Diff line number Diff line change
@@ -10,12 +10,22 @@ import ./make-test.nix ({ pkgs, ... } : {
services.mxisd.enable = true;
services.mxisd.matrix.domain = "example.org";
};

server_ma1sd = args : {
services.mxisd.enable = true;
services.mxisd.matrix.domain = "example.org";
services.mxisd.package = pkgs.ma1sd;
};
};

testScript = ''
startAll;
$server_mxisd->waitForUnit("mxisd.service");
$server_mxisd->waitForOpenPort(8090);
$server_mxisd->succeed("curl -Ssf \"http://127.0.0.1:8090/_matrix/identity/api/v1\"")
$server_mxisd->succeed("curl -Ssf \"http://127.0.0.1:8090/_matrix/identity/api/v1\"");
$server_ma1sd->waitForUnit("mxisd.service");
$server_ma1sd->waitForOpenPort(8090);
$server_ma1sd->succeed("curl -Ssf \"http://127.0.0.1:8090/_matrix/identity/api/v1\"")
'';
})
20 changes: 20 additions & 0 deletions pkgs/servers/ma1sd/0001-gradle.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/build.gradle 2019-09-01 16:17:17.815513296 +0200
+++ b/build.gradle 2019-09-01 16:21:14.688832785 +0200
@@ -73,7 +73,7 @@

buildscript {
repositories {
- jcenter()
+REPLACE
}

dependencies {
@@ -83,7 +83,7 @@
}

repositories {
- jcenter()
+REPLACE
}

dependencies {
70 changes: 70 additions & 0 deletions pkgs/servers/ma1sd/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{ stdenv, fetchFromGitHub, jre, git, gradle_5, perl, makeWrapper }:

let
name = "ma1sd-${version}";
version = "2.1.1";
rev = "a112a5e57cb38ad282939d2dcb9c1476e038af39";

src = fetchFromGitHub {
inherit rev;
owner = "ma1uta";
repo = "ma1sd";
sha256 = "1qibn6m6mvxwnbiypxlgkaqg6in358vkf0q47410rv1dx1gjcnv5";
};


deps = stdenv.mkDerivation {
name = "${name}-deps";
inherit src;
nativeBuildInputs = [ gradle_5 perl git ];

buildPhase = ''
export MA1SD_BUILD_VERSION=${rev}
export GRADLE_USER_HOME=$(mktemp -d);
gradle --no-daemon build -x test
'';

# perl code mavenizes pathes (com.squareup.okio/okio/1.13.0/a9283170b7305c8d92d25aff02a6ab7e45d06cbe/okio-1.13.0.jar -> com/squareup/okio/okio/1.13.0/okio-1.13.0.jar)
installPhase = ''
find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
| perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/$5" #e' \
| sh
'';

dontStrip = true;

outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "1w9cxq0rlzyh7bzqr3v3vn2cjhpn7hhc5lk9qzwj7sdj4jn2qxq6";
};

in
stdenv.mkDerivation {
inherit name src version;
nativeBuildInputs = [ gradle_5 perl makeWrapper ];
buildInputs = [ jre ];

patches = [ ./0001-gradle.patch ];

buildPhase = ''
export MA1SD_BUILD_VERSION=${rev}
export GRADLE_USER_HOME=$(mktemp -d)
sed -ie "s#REPLACE#mavenLocal(); maven { url '${deps}' }#g" build.gradle
gradle --offline --no-daemon build -x test
'';

installPhase = ''
install -D build/libs/source.jar $out/lib/ma1sd.jar
makeWrapper ${jre}/bin/java $out/bin/ma1sd --add-flags "-jar $out/lib/ma1sd.jar"
'';

meta = with stdenv.lib; {
description = "a federated matrix identity server; fork of mxisd";
homepage = https://github.com/ma1uta/ma1sd;
license = licenses.agpl3;
maintainers = with maintainers; [ mguentner ];
platforms = platforms.all;
};

}
12 changes: 6 additions & 6 deletions pkgs/servers/mxisd/default.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{ stdenv, fetchFromGitHub, jre, git, gradle_4_10, perl, makeWrapper }:
{ stdenv, fetchFromGitHub, jre, git, gradle_4, perl, makeWrapper }:

let
name = "mxisd-${version}";
version = "1.4.5";
rev = "a964b073bfa7552e94fe51f48e18830b1051b0b7";
version = "1.4.6";
rev = "6e9601cb3a18281857c3cefd20ec773023b577d2";

src = fetchFromGitHub {
inherit rev;
owner = "kamax-matrix";
repo = "mxisd";
sha256 = "1h1lx531rjswh0m2zdsmfizrkkx9bh414v9m321hbbfzk3f98fkk";
sha256 = "07gpdgbz281506p2431qn92bvdza6ap3jfq5b7xdm7nwrry80pzd";
};


deps = stdenv.mkDerivation {
name = "${name}-deps";
inherit src;
nativeBuildInputs = [ gradle_4_10 perl git ];
nativeBuildInputs = [ gradle_4 perl git ];

buildPhase = ''
export MXISD_BUILD_VERSION=${rev}
@@ -41,7 +41,7 @@ let
in
stdenv.mkDerivation {
inherit name src version;
nativeBuildInputs = [ gradle_4_10 perl makeWrapper ];
nativeBuildInputs = [ gradle_4 perl makeWrapper ];
buildInputs = [ jre ];

patches = [ ./0001-gradle.patch ];
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
@@ -4331,6 +4331,8 @@ in

kzipmix = pkgsi686Linux.callPackage ../tools/compression/kzipmix { };

ma1sd = callPackage ../servers/ma1sd { };

mailcatcher = callPackage ../development/web/mailcatcher { };

makebootfat = callPackage ../tools/misc/makebootfat { };