Merge pull request #70441 from doronbehar/package-gotify-server
gotify-server: init at 2.0.10
This commit is contained in:
commit
6db4ae1f27
@ -793,6 +793,7 @@
|
||||
./services/web-apps/cryptpad.nix
|
||||
./services/web-apps/documize.nix
|
||||
./services/web-apps/frab.nix
|
||||
./services/web-apps/gotify-server.nix
|
||||
./services/web-apps/icingaweb2/icingaweb2.nix
|
||||
./services/web-apps/icingaweb2/module-monitoring.nix
|
||||
./services/web-apps/limesurvey.nix
|
||||
|
49
nixos/modules/services/web-apps/gotify-server.nix
Normal file
49
nixos/modules/services/web-apps/gotify-server.nix
Normal file
@ -0,0 +1,49 @@
|
||||
{ pkgs, lib, config, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.gotify;
|
||||
in {
|
||||
options = {
|
||||
services.gotify = {
|
||||
enable = mkEnableOption "Gotify webserver";
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
description = ''
|
||||
Port the server listens to.
|
||||
'';
|
||||
};
|
||||
|
||||
stateDirectoryName = mkOption {
|
||||
type = types.str;
|
||||
default = "gotify-server";
|
||||
description = ''
|
||||
The name of the directory below <filename>/var/lib</filename> where
|
||||
gotify stores its runtime data.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
systemd.services.gotify-server = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
description = "Simple server for sending and receiving messages";
|
||||
|
||||
environment = {
|
||||
GOTIFY_SERVER_PORT = toString cfg.port;
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
WorkingDirectory = "/var/lib/${cfg.stateDirectoryName}";
|
||||
StateDirectory = cfg.stateDirectoryName;
|
||||
Restart = "always";
|
||||
DynamicUser = "yes";
|
||||
ExecStart = "${pkgs.gotify-server}/bin/server";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
@ -93,6 +93,7 @@ in
|
||||
fsck = handleTest ./fsck.nix {};
|
||||
fwupd = handleTestOn ["x86_64-linux"] ./fwupd.nix {}; # libsmbios is unsupported on aarch64
|
||||
gdk-pixbuf = handleTest ./gdk-pixbuf.nix {};
|
||||
gotify-server = handleTest ./gotify-server.nix {};
|
||||
gitea = handleTest ./gitea.nix {};
|
||||
gitlab = handleTest ./gitlab.nix {};
|
||||
gitolite = handleTest ./gitolite.nix {};
|
||||
|
45
nixos/tests/gotify-server.nix
Normal file
45
nixos/tests/gotify-server.nix
Normal file
@ -0,0 +1,45 @@
|
||||
import ./make-test.nix ({ pkgs, lib, ...} : {
|
||||
name = "gotify-server";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ ma27 ];
|
||||
};
|
||||
|
||||
machine = { pkgs, ... }: {
|
||||
environment.systemPackages = [ pkgs.jq ];
|
||||
|
||||
services.gotify = {
|
||||
enable = true;
|
||||
port = 3000;
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
|
||||
$machine->waitForUnit("gotify-server");
|
||||
$machine->waitForOpenPort(3000);
|
||||
|
||||
my $token = $machine->succeed(
|
||||
"curl --fail -sS -X POST localhost:3000/application -F name=nixos " .
|
||||
'-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" ' .
|
||||
'| jq .token | xargs echo -n'
|
||||
);
|
||||
|
||||
my $usertoken = $machine->succeed(
|
||||
"curl --fail -sS -X POST localhost:3000/client -F name=nixos " .
|
||||
'-H "Authorization: Basic $(echo -ne "admin:admin" | base64 --wrap 0)" ' .
|
||||
'| jq .token | xargs echo -n'
|
||||
);
|
||||
|
||||
$machine->succeed(
|
||||
"curl --fail -sS -X POST 'localhost:3000/message?token=$token' -H 'Accept: application/json' " .
|
||||
'-F title=Gotify -F message=Works'
|
||||
);
|
||||
|
||||
my $title = $machine->succeed(
|
||||
"curl --fail -sS 'localhost:3000/message?since=0&token=$usertoken' | jq '.messages|.[0]|.title' | xargs echo -n"
|
||||
);
|
||||
|
||||
$title eq "Gotify" or die "Wrong title ($title), expected 'Gotify'!";
|
||||
'';
|
||||
})
|
55
pkgs/servers/gotify/default.nix
Normal file
55
pkgs/servers/gotify/default.nix
Normal file
@ -0,0 +1,55 @@
|
||||
{ stdenv
|
||||
, buildGoPackage
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, buildGoModule
|
||||
, packr
|
||||
, sqlite
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
buildGoModule rec {
|
||||
pname = "gotify-server";
|
||||
version = "2.0.10";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "gotify";
|
||||
repo = "server";
|
||||
rev = "v${version}";
|
||||
sha256 = "0f7y6gkxikdfjhdxplkv494ss2b0fqmibd2kl9nifabggfz5gjal";
|
||||
};
|
||||
|
||||
modSha256 = "19mghbs1jasb7vxdw13mmwsbk5sfg3y2vvddr73c82lq0f8g2iha";
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace app.go \
|
||||
--replace 'Version = "unknown"' 'Version = "${version}"'
|
||||
'';
|
||||
|
||||
buildInputs = [ sqlite ];
|
||||
|
||||
nativeBuildInputs = [ packr ];
|
||||
|
||||
ui = callPackage ./ui.nix { };
|
||||
|
||||
preBuild = ''
|
||||
cp -r ${ui}/libexec/gotify-ui/deps/gotify-ui/build ui/build && packr
|
||||
'';
|
||||
|
||||
# Otherwise, all other subpackages are built as well and from some reason,
|
||||
# produce binaries which panic when executed and are not interesting at all
|
||||
subPackages = [ "." ];
|
||||
|
||||
buildFlagsArray = [
|
||||
"-ldflags='-X main.Version=${version} -X main.Mode=prod'"
|
||||
];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A simple server for sending and receiving messages in real-time per WebSocket";
|
||||
homepage = "https://gotify.net";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ doronbehar ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
|
||||
}
|
80
pkgs/servers/gotify/package.json
Normal file
80
pkgs/servers/gotify/package.json
Normal file
@ -0,0 +1,80 @@
|
||||
{
|
||||
"name": "gotify-ui",
|
||||
"version": "0.2.0",
|
||||
"private": true,
|
||||
"homepage": ".",
|
||||
"dependencies": {
|
||||
"@material-ui/core": "^4.4.3",
|
||||
"@material-ui/icons": "^4.4.3",
|
||||
"axios": "^0.19.0",
|
||||
"codemirror": "^5.43.0",
|
||||
"detect-browser": "^3.0.0",
|
||||
"js-base64": "^2.5.1",
|
||||
"mobx": "^5.1.1",
|
||||
"mobx-react": "^5.2.8",
|
||||
"mobx-utils": "^5.0.2",
|
||||
"notifyjs": "^3.0.0",
|
||||
"prop-types": "^15.6.2",
|
||||
"react": "^16.4.2",
|
||||
"react-codemirror2": "^5.1.0",
|
||||
"react-dom": "^16.4.2",
|
||||
"react-infinite": "^0.13.0",
|
||||
"react-markdown": "^4.0.6",
|
||||
"react-router": "^4.3.1",
|
||||
"react-router-dom": "^4.3.1",
|
||||
"react-timeago": "^4.1.9",
|
||||
"remove-markdown": "^0.3.0",
|
||||
"typeface-roboto": "0.0.54"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test --env=node",
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "tslint --project .",
|
||||
"lintfix": "tslint --fix --project .",
|
||||
"format": "prettier \"src/**/*.{ts,tsx}\" --write",
|
||||
"testformat": "prettier \"src/**/*.{ts,tsx}\" --list-different"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/codemirror": "0.0.71",
|
||||
"@types/detect-browser": "^2.0.1",
|
||||
"@types/get-port": "^4.0.0",
|
||||
"@types/jest": "^23.3.1",
|
||||
"@types/js-base64": "^2.3.1",
|
||||
"@types/node": "^10.9.0",
|
||||
"@types/notifyjs": "^3.0.0",
|
||||
"@types/puppeteer": "^1.6.3",
|
||||
"@types/react": "^16.4.11",
|
||||
"@types/react-dom": "^16.0.7",
|
||||
"@types/react-infinite": "0.0.33",
|
||||
"@types/react-router-dom": "^4.3.0",
|
||||
"@types/remove-markdown": "^0.1.1",
|
||||
"@types/rimraf": "^2.0.2",
|
||||
"get-port": "^4.0.0",
|
||||
"prettier": "^1.14.2",
|
||||
"puppeteer": "^1.8.0",
|
||||
"react-scripts": "3.1.1",
|
||||
"rimraf": "^2.6.2",
|
||||
"tree-kill": "^1.2.0",
|
||||
"tslint": "^5.20.0",
|
||||
"tslint-sonarts": "^1.7.0",
|
||||
"typescript": "3.6.2",
|
||||
"wait-on": "^3.0.1"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
}
|
||||
}
|
25
pkgs/servers/gotify/ui.nix
Normal file
25
pkgs/servers/gotify/ui.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ yarn2nix-moretea
|
||||
, fetchFromGitHub
|
||||
}:
|
||||
|
||||
yarn2nix-moretea.mkYarnPackage rec {
|
||||
name = "gotify-ui";
|
||||
|
||||
packageJSON = ./package.json;
|
||||
yarnNix = ./yarndeps.nix;
|
||||
|
||||
version = "2.0.8";
|
||||
|
||||
src_all = fetchFromGitHub {
|
||||
owner = "gotify";
|
||||
repo = "server";
|
||||
rev = "v${version}";
|
||||
sha256 = "17bxs3wcazrxippf3i9w7d2mq8lf0v5m4bn3nl2zb8v8dl3lsc9a";
|
||||
};
|
||||
src = "${src_all}/ui";
|
||||
|
||||
buildPhase = ''
|
||||
yarn build
|
||||
'';
|
||||
|
||||
}
|
20
pkgs/servers/gotify/update-yarn-deps.sh
Executable file
20
pkgs/servers/gotify/update-yarn-deps.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -I nixpkgs=../../../ -i bash -p wget yarn2nix-moretea.yarn2nix
|
||||
|
||||
# This script is based upon:
|
||||
# pkgs/applications/networking/instant-messengers/riot/update-riot-desktop.sh
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -ne 1 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates the Yarn dependency lock files for the gotify-server package."
|
||||
echo "Usage: $0 <git release tag>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
GOTIFY_WEB_SRC="https://raw.githubusercontent.com/gotify/server/$1"
|
||||
|
||||
wget "$GOTIFY_WEB_SRC/ui/package.json" -O package.json
|
||||
wget "$GOTIFY_WEB_SRC/ui/yarn.lock" -O yarn.lock
|
||||
yarn2nix --lockfile=yarn.lock > yarndeps.nix
|
||||
rm yarn.lock
|
11845
pkgs/servers/gotify/yarndeps.nix
Normal file
11845
pkgs/servers/gotify/yarndeps.nix
Normal file
File diff suppressed because it is too large
Load Diff
@ -9737,6 +9737,8 @@ in
|
||||
|
||||
gocd-server = callPackage ../development/tools/continuous-integration/gocd-server { };
|
||||
|
||||
gotify-server = callPackage ../servers/gotify { };
|
||||
|
||||
gotty = callPackage ../servers/gotty { };
|
||||
|
||||
gputils = callPackage ../development/tools/misc/gputils { };
|
||||
|
Loading…
Reference in New Issue
Block a user