aboutsummaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorIsmaël Bouya <ismael.bouya@normalesup.org>2021-05-17 15:10:49 +0200
committerIsmaël Bouya <ismael.bouya@normalesup.org>2021-05-17 15:10:49 +0200
commita3ef18acd6c73b943f9f54e618f9e72e017ff748 (patch)
tree3f1917616270a5ce6f29ff75d5a7a2515a5bc85f /pkgs
parent11c2119f776263b103721302fdd3f2ba8c985bc1 (diff)
downloadNix-a3ef18acd6c73b943f9f54e618f9e72e017ff748.tar.gz
Nix-a3ef18acd6c73b943f9f54e618f9e72e017ff748.tar.zst
Nix-a3ef18acd6c73b943f9f54e618f9e72e017ff748.zip
Add signal
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/default.nix2
-rw-r--r--pkgs/signald/default.nix87
-rw-r--r--pkgs/signald/git-describe-always.patch9
-rw-r--r--pkgs/signald/gradle-plugin.patch26
-rw-r--r--pkgs/signaldctl/default.nix13
5 files changed, 137 insertions, 0 deletions
diff --git a/pkgs/default.nix b/pkgs/default.nix
index fcc92d1..25ff9d7 100644
--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -28,6 +28,8 @@ rec {
28 pgloader = callPackage ./pgloader {}; 28 pgloader = callPackage ./pgloader {};
29 predixy = callPackage ./predixy { inherit mylibs; }; 29 predixy = callPackage ./predixy { inherit mylibs; };
30 rrsync_sudo = callPackage ./rrsync_sudo {}; 30 rrsync_sudo = callPackage ./rrsync_sudo {};
31 signald = callPackage ./signald {};
32 signaldctl = callPackage ./signaldctl {};
31 telegram-cli = callPackage ./telegram-cli { inherit mylibs; }; 33 telegram-cli = callPackage ./telegram-cli { inherit mylibs; };
32 telegram-history-dump = callPackage ./telegram-history-dump { inherit mylibs; }; 34 telegram-history-dump = callPackage ./telegram-history-dump { inherit mylibs; };
33 telegramircd = callPackage ./telegramircd { inherit mylibs; telethon = callPackage ./telethon_sync {}; }; 35 telegramircd = callPackage ./telegramircd { inherit mylibs; telethon = callPackage ./telethon_sync {}; };
diff --git a/pkgs/signald/default.nix b/pkgs/signald/default.nix
new file mode 100644
index 0000000..593e63d
--- /dev/null
+++ b/pkgs/signald/default.nix
@@ -0,0 +1,87 @@
1{ lib, stdenv, fetchurl, fetchgit, jre, coreutils, gradle_6, git, perl
2, makeWrapper }:
3
4let
5 pname = "signald";
6
7 version = "0.13.1";
8
9 # This package uses the .git directory
10 src = fetchgit {
11 url = "https://gitlab.com/signald/signald";
12 rev = version;
13 sha256 = "1ilmg0i1kw2yc7m3hxw1bqdpl3i9wwbj8623qmz9cxhhavbcd5i7";
14 leaveDotGit = true;
15 };
16
17 buildConfigJar = fetchurl {
18 url = "https://dl.bintray.com/mfuerstenau/maven/gradle/plugin/de/fuerstenau/BuildConfigPlugin/1.1.8/BuildConfigPlugin-1.1.8.jar";
19 sha256 = "0y1f42y7ilm3ykgnm6s3ks54d71n8lsy5649xgd9ahv28lj05x9f";
20 };
21
22 patches = [ ./git-describe-always.patch ./gradle-plugin.patch ];
23
24 postPatch = ''
25 patchShebangs gradlew
26 sed -i -e 's|BuildConfig.jar|${buildConfigJar}|' build.gradle
27 '';
28
29 # fake build to pre-download deps into fixed-output derivation
30 deps = stdenv.mkDerivation {
31 name = "${pname}-deps";
32 inherit src version postPatch patches;
33 nativeBuildInputs = [ gradle_6 perl ];
34 buildPhase = ''
35 export GRADLE_USER_HOME=$(mktemp -d)
36 gradle --no-daemon build
37 '';
38 # 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)
39 installPhase = ''
40 find $GRADLE_USER_HOME/caches/modules-2 -type f -regex '.*\.\(jar\|pom\)' \
41 | perl -pe 's#(.*/([^/]+)/([^/]+)/([^/]+)/[0-9a-f]{30,40}/([^/\s]+))$# ($x = $2) =~ tr|\.|/|; "install -Dm444 $1 \$out/$x/$3/$4/''${\($5 =~ s/-jvm//r)}" #e' \
42 | sh
43 '';
44 # Don't move info to share/
45 forceShare = [ "dummy" ];
46 outputHashAlgo = "sha256";
47 outputHashMode = "recursive";
48 outputHash = "0w8ixp1l0ch1jc2dqzxdx3ljlh17hpgns2ba7qvj43nr4prl71l7";
49 };
50
51in stdenv.mkDerivation rec {
52 inherit pname src version postPatch patches;
53
54 buildPhase = ''
55 export GRADLE_USER_HOME=$(mktemp -d)
56
57 # Use the local packages from -deps
58 sed -i -e 's|mavenCentral()|mavenLocal(); maven { url uri("${deps}") }|' build.gradle
59
60 gradle --offline --no-daemon distTar
61 '';
62
63 installPhase = ''
64 mkdir -p $out
65 tar xvf ./build/distributions/signald.tar --strip-components=1 --directory $out/
66 wrapProgram $out/bin/signald \
67 --prefix PATH : ${lib.makeBinPath [ coreutils ]} \
68 --set JAVA_HOME "${jre}"
69 '';
70
71 nativeBuildInputs = [ git gradle_6 makeWrapper ];
72
73 doCheck = true;
74
75 meta = with lib; {
76 description = "Unofficial daemon for interacting with Signal";
77 longDescription = ''
78 Signald is a daemon that facilitates communication over Signal. It is
79 unofficial, unapproved, and not nearly as secure as the real Signal
80 clients.
81 '';
82 homepage = "https://signald.org";
83 license = licenses.gpl3Plus;
84 maintainers = with maintainers; [ expipiplus1 ];
85 platforms = platforms.unix;
86 };
87}
diff --git a/pkgs/signald/git-describe-always.patch b/pkgs/signald/git-describe-always.patch
new file mode 100644
index 0000000..2f4830e
--- /dev/null
+++ b/pkgs/signald/git-describe-always.patch
@@ -0,0 +1,9 @@
1diff --git a/version.sh b/version.sh
2index 7aeeb3c..060cba3 100755
3--- a/version.sh
4+++ b/version.sh
5@@ -1,3 +1,3 @@
6 #!/bin/sh
7-VERSION=$(git describe --exact-match 2> /dev/null) || VERSION=$(git describe --abbrev=0)+git$(date +%Y-%m-%d)r$(git rev-parse --short=8 HEAD).$(git rev-list $(git describe --abbrev=0)..HEAD --count)
8+VERSION=$(git describe --exact-match 2> /dev/null) || VERSION=$(git describe --always --abbrev=0)+git$(date +%Y-%m-%d)r$(git rev-parse --short=8 HEAD).$(git rev-list $(git describe --always --abbrev=0)..HEAD --count)
9 echo $VERSION
diff --git a/pkgs/signald/gradle-plugin.patch b/pkgs/signald/gradle-plugin.patch
new file mode 100644
index 0000000..6952654
--- /dev/null
+++ b/pkgs/signald/gradle-plugin.patch
@@ -0,0 +1,26 @@
1diff --git a/build.gradle b/build.gradle
2index 11d7a99..66805bb 100644
3--- a/build.gradle
4+++ b/build.gradle
5@@ -3,9 +3,12 @@ import org.gradle.nativeplatform.platform.internal.OperatingSystemInternal
6 import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
7 import org.xml.sax.SAXParseException
8
9-plugins {
10- id 'de.fuerstenau.buildconfig' version '1.1.8'
11+buildscript {
12+ dependencies {
13+ classpath files ("BuildConfig.jar")
14+ }
15 }
16+apply plugin: 'de.fuerstenau.buildconfig'
17
18 apply plugin: 'java'
19 apply plugin: 'application'
20@@ -185,4 +188,4 @@ task integrationTest(type: Test) {
21 testClassesDirs = sourceSets.integrationTest.output.classesDirs
22 classpath = sourceSets.integrationTest.runtimeClasspath
23 outputs.upToDateWhen { false }
24-}
25\ No newline at end of file
26+}
diff --git a/pkgs/signaldctl/default.nix b/pkgs/signaldctl/default.nix
new file mode 100644
index 0000000..3ae85d8
--- /dev/null
+++ b/pkgs/signaldctl/default.nix
@@ -0,0 +1,13 @@
1{ buildGoModule, fetchgit, lib }:
2
3buildGoModule {
4 pname = "signaldctl";
5 version = "main-3ca2d6f6";
6 src = fetchgit {
7 url = "https://gitlab.com/signald/signald-go.git";
8 branchName = "main";
9 rev = "3ca2d6f6c91d44f34fca3221c430d1c47fa31a5a";
10 sha256 = "0hh2jqfdsvclilqllyfxswpw6fk0ncyhbiy08mwfp3dnk8nlz5vk";
11 };
12 vendorSha256 = "0m3spzv79fgnrg0sxhi3nrpdrvmrznwdca6rrz8qxgqb7a58qcxv";
13}