forked from mirrors/nixpkgs
commit
993c35991b
|
@ -8546,6 +8546,12 @@
|
|||
githubId = 9636071;
|
||||
name = "Myrl Hex";
|
||||
};
|
||||
n0emis = {
|
||||
email = "nixpkgs@n0emis.network";
|
||||
github = "n0emis";
|
||||
githubId = 22817873;
|
||||
name = "Ember Keske";
|
||||
};
|
||||
nadrieril = {
|
||||
email = "nadrieril@gmail.com";
|
||||
github = "nadrieril";
|
||||
|
|
|
@ -396,6 +396,7 @@
|
|||
./services/development/jupyterhub/default.nix
|
||||
./services/development/rstudio-server/default.nix
|
||||
./services/development/lorri.nix
|
||||
./services/development/zammad.nix
|
||||
./services/display-managers/greetd.nix
|
||||
./services/editors/emacs.nix
|
||||
./services/editors/infinoted.nix
|
||||
|
|
323
nixos/modules/services/development/zammad.nix
Normal file
323
nixos/modules/services/development/zammad.nix
Normal file
|
@ -0,0 +1,323 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.zammad;
|
||||
settingsFormat = pkgs.formats.yaml { };
|
||||
filterNull = filterAttrs (_: v: v != null);
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
|
||||
User = "zammad";
|
||||
Group = "zammad";
|
||||
PrivateTmp = true;
|
||||
StateDirectory = "zammad";
|
||||
WorkingDirectory = cfg.dataDir;
|
||||
};
|
||||
environment = {
|
||||
RAILS_ENV = "production";
|
||||
NODE_ENV = "production";
|
||||
RAILS_SERVE_STATIC_FILES = "true";
|
||||
RAILS_LOG_TO_STDOUT = "true";
|
||||
};
|
||||
databaseConfig = settingsFormat.generate "database.yml" cfg.database.settings;
|
||||
in
|
||||
{
|
||||
|
||||
options = {
|
||||
services.zammad = {
|
||||
enable = mkEnableOption "Zammad, a web-based, open source user support/ticketing solution.";
|
||||
|
||||
package = mkOption {
|
||||
type = types.package;
|
||||
default = pkgs.zammad;
|
||||
defaultText = literalExpression "pkgs.zammad";
|
||||
description = "Zammad package to use.";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/zammad";
|
||||
description = ''
|
||||
Path to a folder that will contain Zammad working directory.
|
||||
'';
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
example = "192.168.23.42";
|
||||
description = "Host address.";
|
||||
};
|
||||
|
||||
openPorts = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to open firewall ports for Zammad";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
default = 3000;
|
||||
description = "Web service port.";
|
||||
};
|
||||
|
||||
websocketPort = mkOption {
|
||||
type = types.port;
|
||||
default = 6042;
|
||||
description = "Websocket service port.";
|
||||
};
|
||||
|
||||
database = {
|
||||
type = mkOption {
|
||||
type = types.enum [ "PostgreSQL" "MySQL" ];
|
||||
default = "PostgreSQL";
|
||||
example = "MySQL";
|
||||
description = "Database engine to use.";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = {
|
||||
PostgreSQL = "/run/postgresql";
|
||||
MySQL = "localhost";
|
||||
}.${cfg.database.type};
|
||||
defaultText = literalExpression ''
|
||||
{
|
||||
PostgreSQL = "/run/postgresql";
|
||||
MySQL = "localhost";
|
||||
}.''${config.services.zammad.database.type};
|
||||
'';
|
||||
description = ''
|
||||
Database host address.
|
||||
'';
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.nullOr types.port;
|
||||
default = null;
|
||||
description = "Database port. Use <literal>null</literal> for default port.";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "zammad";
|
||||
description = ''
|
||||
Database name.
|
||||
'';
|
||||
};
|
||||
|
||||
user = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = "zammad";
|
||||
description = "Database user.";
|
||||
};
|
||||
|
||||
passwordFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
example = "/run/keys/zammad-dbpassword";
|
||||
description = ''
|
||||
A file containing the password for <option>services.zammad.database.user</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
createLocally = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = "Whether to create a local database automatically.";
|
||||
};
|
||||
|
||||
settings = mkOption {
|
||||
type = settingsFormat.type;
|
||||
default = { };
|
||||
example = literalExpression ''
|
||||
{
|
||||
}
|
||||
'';
|
||||
description = ''
|
||||
The <filename>database.yml</filename> configuration file as key value set.
|
||||
See <link xlink:href='TODO' />
|
||||
for list of configuration parameters.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
secretKeyBaseFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
example = "/run/keys/secret_key_base";
|
||||
description = ''
|
||||
The path to a file containing the
|
||||
<literal>secret_key_base</literal> secret.
|
||||
|
||||
Zammad uses <literal>secret_key_base</literal> to encrypt
|
||||
the cookie store, which contains session data, and to digest
|
||||
user auth tokens.
|
||||
|
||||
Needs to be a 64 byte long string of hexadecimal
|
||||
characters. You can generate one by running
|
||||
|
||||
<screen>
|
||||
<prompt>$ </prompt>openssl rand -hex 64 >/path/to/secret_key_base_file
|
||||
</screen>
|
||||
|
||||
This should be a string, not a nix path, since nix paths are
|
||||
copied into the world-readable nix store.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.zammad.database.settings = {
|
||||
production = mapAttrs (_: v: mkDefault v) (filterNull {
|
||||
adapter = {
|
||||
PostgreSQL = "postgresql";
|
||||
MySQL = "mysql2";
|
||||
}.${cfg.database.type};
|
||||
database = cfg.database.name;
|
||||
pool = 50;
|
||||
timeout = 5000;
|
||||
encoding = "utf8";
|
||||
username = cfg.database.user;
|
||||
host = cfg.database.host;
|
||||
port = cfg.database.port;
|
||||
});
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = mkIf cfg.openPorts [
|
||||
config.services.zammad.port
|
||||
config.services.zammad.websocketPort
|
||||
];
|
||||
|
||||
users.users.zammad = {
|
||||
isSystemUser = true;
|
||||
home = cfg.dataDir;
|
||||
group = "zammad";
|
||||
};
|
||||
|
||||
users.groups.zammad = { };
|
||||
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.database.createLocally -> cfg.database.user == "zammad";
|
||||
message = "services.zammad.database.user must be set to \"zammad\" if services.zammad.database.createLocally is set to true";
|
||||
}
|
||||
{
|
||||
assertion = cfg.database.createLocally -> cfg.database.passwordFile == null;
|
||||
message = "a password cannot be specified if services.zammad.database.createLocally is set to true";
|
||||
}
|
||||
];
|
||||
|
||||
services.mysql = optionalAttrs (cfg.database.createLocally && cfg.database.type == "MySQL") {
|
||||
enable = true;
|
||||
package = mkDefault pkgs.mariadb;
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = cfg.database.user;
|
||||
ensurePermissions = { "${cfg.database.name}.*" = "ALL PRIVILEGES"; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
services.postgresql = optionalAttrs (cfg.database.createLocally && cfg.database.type == "PostgreSQL") {
|
||||
enable = true;
|
||||
ensureDatabases = [ cfg.database.name ];
|
||||
ensureUsers = [
|
||||
{
|
||||
name = cfg.database.user;
|
||||
ensurePermissions = { "DATABASE ${cfg.database.name}" = "ALL PRIVILEGES"; };
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
systemd.services.zammad-web = {
|
||||
inherit environment;
|
||||
serviceConfig = serviceConfig // {
|
||||
# loading all the gems takes time
|
||||
TimeoutStartSec = 1200;
|
||||
};
|
||||
after = [
|
||||
"network.target"
|
||||
"postgresql.service"
|
||||
];
|
||||
requires = [
|
||||
"postgresql.service"
|
||||
];
|
||||
description = "Zammad web";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
preStart = ''
|
||||
# Blindly copy the whole project here.
|
||||
chmod -R +w .
|
||||
rm -rf ./public/assets/*
|
||||
rm -rf ./tmp/*
|
||||
rm -rf ./log/*
|
||||
cp -r --no-preserve=owner ${cfg.package}/* .
|
||||
chmod -R +w .
|
||||
# config file
|
||||
cp ${databaseConfig} ./config/database.yml
|
||||
chmod -R +w .
|
||||
${optionalString (cfg.database.passwordFile != null) ''
|
||||
{
|
||||
echo -n " password: "
|
||||
cat ${cfg.database.passwordFile}
|
||||
} >> ./config/database.yml
|
||||
''}
|
||||
${optionalString (cfg.secretKeyBaseFile != null) ''
|
||||
{
|
||||
echo "production: "
|
||||
echo -n " secret_key_base: "
|
||||
cat ${cfg.secretKeyBaseFile}
|
||||
} > ./config/secrets.yml
|
||||
''}
|
||||
|
||||
if [ `${config.services.postgresql.package}/bin/psql \
|
||||
--host ${cfg.database.host} \
|
||||
${optionalString
|
||||
(cfg.database.port != null)
|
||||
"--port ${toString cfg.database.port}"} \
|
||||
--username ${cfg.database.user} \
|
||||
--dbname ${cfg.database.name} \
|
||||
--command "SELECT COUNT(*) FROM pg_class c \
|
||||
JOIN pg_namespace s ON s.oid = c.relnamespace \
|
||||
WHERE s.nspname NOT IN ('pg_catalog', 'pg_toast', 'information_schema') \
|
||||
AND s.nspname NOT LIKE 'pg_temp%';" | sed -n 3p` -eq 0 ]; then
|
||||
echo "Initialize database"
|
||||
./bin/rake --no-system db:migrate
|
||||
./bin/rake --no-system db:seed
|
||||
else
|
||||
echo "Migrate database"
|
||||
./bin/rake --no-system db:migrate
|
||||
fi
|
||||
echo "Done"
|
||||
'';
|
||||
script = "./script/rails server -b ${cfg.host} -p ${toString cfg.port}";
|
||||
};
|
||||
|
||||
systemd.services.zammad-websocket = {
|
||||
inherit serviceConfig environment;
|
||||
after = [ "zammad-web.service" ];
|
||||
requires = [ "zammad-web.service" ];
|
||||
description = "Zammad websocket";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "./script/websocket-server.rb -b ${cfg.host} -p ${toString cfg.websocketPort} start";
|
||||
};
|
||||
|
||||
systemd.services.zammad-scheduler = {
|
||||
inherit environment;
|
||||
serviceConfig = serviceConfig // { Type = "forking"; };
|
||||
after = [ "zammad-web.service" ];
|
||||
requires = [ "zammad-web.service" ];
|
||||
description = "Zammad scheduler";
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
script = "./script/scheduler.rb start";
|
||||
};
|
||||
};
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ garbas taeer ];
|
||||
}
|
|
@ -572,6 +572,7 @@ in
|
|||
xxh = handleTest ./xxh.nix {};
|
||||
yabar = handleTest ./yabar.nix {};
|
||||
yggdrasil = handleTest ./yggdrasil.nix {};
|
||||
zammad = handleTest ./zammad.nix {};
|
||||
zfs = handleTest ./zfs.nix {};
|
||||
zigbee2mqtt = handleTest ./zigbee2mqtt.nix {};
|
||||
zoneminder = handleTest ./zoneminder.nix {};
|
||||
|
|
60
nixos/tests/zammad.nix
Normal file
60
nixos/tests/zammad.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
import ./make-test-python.nix (
|
||||
{ lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
name = "zammad";
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ garbas taeer ];
|
||||
|
||||
nodes.machine = { config, ... }: {
|
||||
services.zammad.enable = true;
|
||||
services.zammad.secretKeyBaseFile = pkgs.writeText "secret" ''
|
||||
52882ef142066e09ab99ce816ba72522e789505caba224a52d750ec7dc872c2c371b2fd19f16b25dfbdd435a4dd46cb3df9f82eb63fafad715056bdfe25740d6
|
||||
'';
|
||||
|
||||
systemd.services.zammad-locale-cheat =
|
||||
let cfg = config.services.zammad; in
|
||||
{
|
||||
serviceConfig = {
|
||||
Type = "simple";
|
||||
Restart = "always";
|
||||
|
||||
User = "zammad";
|
||||
Group = "zammad";
|
||||
PrivateTmp = true;
|
||||
StateDirectory = "zammad";
|
||||
WorkingDirectory = cfg.dataDir;
|
||||
};
|
||||
wantedBy = [ "zammad-web.service" ];
|
||||
description = "Hack in the locale files so zammad doesn't try to access the internet";
|
||||
script = ''
|
||||
mkdir -p ./config/translations
|
||||
VERSION=$(cat ${cfg.package}/VERSION)
|
||||
|
||||
# If these files are not in place, zammad will try to access the internet.
|
||||
# For the test, we only need to supply en-us.
|
||||
echo '[{"locale":"en-us","alias":"en","name":"English (United States)","active":true,"dir":"ltr"}]' \
|
||||
> ./config/locales-$VERSION.yml
|
||||
echo '[{"locale":"en-us","format":"time","source":"date","target":"mm/dd/yyyy","target_initial":"mm/dd/yyyy"},{"locale":"en-us","format":"time","source":"timestamp","target":"mm/dd/yyyy HH:MM","target_initial":"mm/dd/yyyy HH:MM"}]' \
|
||||
> ./config/translations/en-us-$VERSION.yml
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
machine.wait_for_unit("postgresql.service")
|
||||
machine.wait_for_unit("zammad-web.service")
|
||||
machine.wait_for_unit("zammad-websocket.service")
|
||||
machine.wait_for_unit("zammad-scheduler.service")
|
||||
# wait for zammad to fully come up
|
||||
machine.sleep(120)
|
||||
|
||||
# without the grep the command does not produce valid utf-8 for some reason
|
||||
with subtest("welcome screen loads"):
|
||||
machine.succeed(
|
||||
"curl -sSfL http://localhost:3000/ | grep '<title>Zammad Helpdesk</title>'"
|
||||
)
|
||||
'';
|
||||
}
|
||||
)
|
15
pkgs/applications/networking/misc/zammad/0001-nulldb.patch
Normal file
15
pkgs/applications/networking/misc/zammad/0001-nulldb.patch
Normal file
|
@ -0,0 +1,15 @@
|
|||
diff --git a/config/application.rb b/config/application.rb
|
||||
index d85a17491..90ea5e387 100644
|
||||
--- a/config/application.rb
|
||||
+++ b/config/application.rb
|
||||
@@ -3,6 +3,7 @@
|
||||
require_relative 'boot'
|
||||
|
||||
require 'rails/all'
|
||||
+require 'nulldb'
|
||||
require_relative 'issue_2656_workaround_for_rails_issue_33600'
|
||||
|
||||
# DO NOT REMOVE THIS LINE - see issue #2037
|
||||
diff --git a/db/schema.rb b/db/schema.rb
|
||||
new file mode 100644
|
||||
index 000000000..e69de29bb
|
137
pkgs/applications/networking/misc/zammad/default.nix
Normal file
137
pkgs/applications/networking/misc/zammad/default.nix
Normal file
|
@ -0,0 +1,137 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, applyPatches
|
||||
, bundlerEnv
|
||||
, defaultGemConfig
|
||||
, callPackage
|
||||
, writeText
|
||||
, procps
|
||||
, ruby_2_7
|
||||
, postgresql
|
||||
, imlib2
|
||||
, nodejs
|
||||
, yarn
|
||||
, yarn2nix-moretea
|
||||
, v8
|
||||
, cacert
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "zammad";
|
||||
version = "5.0.2";
|
||||
|
||||
src = applyPatches {
|
||||
|
||||
src = fetchFromGitHub (lib.importJSON ./source.json);
|
||||
|
||||
patches = [ ./0001-nulldb.patch ];
|
||||
|
||||
postPatch = ''
|
||||
sed -i -e "s|ruby '2.7.4'|ruby '${ruby_2_7.version}'|" Gemfile
|
||||
sed -i -e "s|ruby 2.7.4p191|ruby ${ruby_2_7.version}|" Gemfile.lock
|
||||
sed -i -e "s|2.7.4|${ruby_2_7.version}|" .ruby-version
|
||||
'';
|
||||
};
|
||||
|
||||
databaseConfig = writeText "database.yml" ''
|
||||
production:
|
||||
url: <%= ENV['DATABASE_URL'] %>
|
||||
'';
|
||||
|
||||
secretsConfig = writeText "secrets.yml" ''
|
||||
production:
|
||||
secret_key_base: <%= ENV['SECRET_KEY_BASE'] %>
|
||||
'';
|
||||
|
||||
rubyEnv = bundlerEnv {
|
||||
name = "${pname}-gems-${version}";
|
||||
inherit version;
|
||||
|
||||
# Which ruby version to select:
|
||||
# https://docs.zammad.org/en/latest/prerequisites/software.html#ruby-programming-language
|
||||
inherit ruby_2_7;
|
||||
|
||||
gemdir = src;
|
||||
gemset = ./gemset.nix;
|
||||
groups = [
|
||||
"assets"
|
||||
"unicorn" # server
|
||||
"nulldb"
|
||||
"test"
|
||||
"mysql"
|
||||
"puma"
|
||||
"development"
|
||||
"postgres" # database
|
||||
];
|
||||
gemConfig = defaultGemConfig // {
|
||||
pg = attrs: {
|
||||
buildFlags = [ "--with-pg-config=${postgresql}/bin/pg_config" ];
|
||||
};
|
||||
rszr = attrs: {
|
||||
buildInputs = [ imlib2 imlib2.dev ];
|
||||
};
|
||||
mini_racer = attrs: {
|
||||
buildFlags = [
|
||||
"--with-v8-dir=\"${v8}\""
|
||||
];
|
||||
dontBuild = false;
|
||||
postPatch = ''
|
||||
substituteInPlace ext/mini_racer_extension/extconf.rb \
|
||||
--replace Libv8.configure_makefile '$CPPFLAGS += " -x c++"; Libv8.configure_makefile'
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
yarnEnv = yarn2nix-moretea.mkYarnPackage {
|
||||
pname = "${pname}-node-modules";
|
||||
inherit version src;
|
||||
yarnLock = ./yarn.lock;
|
||||
yarnNix = ./yarn.nix;
|
||||
packageJSON = ./package.json;
|
||||
};
|
||||
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
inherit pname version src;
|
||||
|
||||
buildInputs = [
|
||||
rubyEnv
|
||||
rubyEnv.wrappedRuby
|
||||
rubyEnv.bundler
|
||||
yarn
|
||||
nodejs
|
||||
procps
|
||||
cacert
|
||||
];
|
||||
|
||||
RAILS_ENV = "production";
|
||||
|
||||
buildPhase = ''
|
||||
node_modules=${yarnEnv}/libexec/Zammad/node_modules
|
||||
${yarn2nix-moretea.linkNodeModulesHook}
|
||||
|
||||
rake DATABASE_URL="nulldb://user:pass@127.0.0.1/dbname" assets:precompile
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cp -R . $out
|
||||
cp ${databaseConfig} $out/config/database.yml
|
||||
cp ${secretsConfig} $out/config/secrets.yml
|
||||
sed -i -e "s|info|debug|" $out/config/environments/production.rb
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit rubyEnv yarnEnv;
|
||||
updateScript = [ "${callPackage ./update.nix {}}/bin/update.sh" pname (toString ./.) ];
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Zammad, a web-based, open source user support/ticketing solution.";
|
||||
homepage = "https://zammad.org";
|
||||
license = licenses.agpl3Plus;
|
||||
platforms = [ "x86_64-linux" ];
|
||||
maintainers = with maintainers; [ n0emis garbas taeer ];
|
||||
};
|
||||
}
|
2834
pkgs/applications/networking/misc/zammad/gemset.nix
Normal file
2834
pkgs/applications/networking/misc/zammad/gemset.nix
Normal file
File diff suppressed because it is too large
Load diff
14
pkgs/applications/networking/misc/zammad/package.json
Normal file
14
pkgs/applications/networking/misc/zammad/package.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "Zammad",
|
||||
"version": "1.0.0",
|
||||
"devDependencies": {
|
||||
"gulp": "^3.8.11",
|
||||
"gulp-cheerio": "^0.6.2",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-svgmin": "^1.1.2",
|
||||
"gulp-svgstore": "^5.0.1",
|
||||
"gulp-util": "^3.0.4",
|
||||
"gulp-watch": "^4.2.4",
|
||||
"through2": "^0.6.5"
|
||||
}
|
||||
}
|
7
pkgs/applications/networking/misc/zammad/source.json
Normal file
7
pkgs/applications/networking/misc/zammad/source.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"owner": "zammad",
|
||||
"repo": "zammad",
|
||||
"rev": "ad12ad4e01f5e6d1d58da019107b66e562ae463c",
|
||||
"sha256": "i50A0/dBsdvv7L/fZiA1LvJEcO3OghjjgwS/7oFjk2o=",
|
||||
"fetchSubmodules": true
|
||||
}
|
35
pkgs/applications/networking/misc/zammad/update.nix
Normal file
35
pkgs/applications/networking/misc/zammad/update.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{ stdenv
|
||||
, lib
|
||||
, makeWrapper
|
||||
, bundix
|
||||
, common-updater-scripts
|
||||
, nix-prefetch-github
|
||||
, yarn
|
||||
, yarn2nix
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
name = "zammad-update-script";
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp ${./update.sh} $out/bin/update.sh
|
||||
patchShebangs $out/bin/update.sh
|
||||
wrapProgram $out/bin/update.sh --prefix PATH : ${lib.makeBinPath buildInputs}
|
||||
'';
|
||||
phases = [ "installPhase" ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
buildInputs = [
|
||||
bundix
|
||||
common-updater-scripts
|
||||
nix-prefetch-github
|
||||
yarn
|
||||
yarn2nix
|
||||
];
|
||||
|
||||
meta = {
|
||||
maintainers = with lib.maintainers; [ n0emis ];
|
||||
description = "Utility to generate Nix expressions for Zammad's dependencies";
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
68
pkgs/applications/networking/misc/zammad/update.sh
Executable file
68
pkgs/applications/networking/misc/zammad/update.sh
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
if [ "$#" -gt 2 ] || [[ "$1" == -* ]]; then
|
||||
echo "Regenerates packaging data for the zammad packages."
|
||||
echo "Usage: $0 [package name] [zammad directory in nixpkgs]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
VERSION=$(curl -s https://ftp.zammad.com/ | grep -v latest | grep tar.gz | sed "s/<a href=\".*\">zammad-//" | sort -h | tail -n 1 | awk '{print $1}' | sed 's/.tar.gz<\/a>//')
|
||||
TARGET_DIR="$2"
|
||||
WORK_DIR=$(mktemp -d)
|
||||
SOURCE_DIR=$WORK_DIR/zammad-$VERSION
|
||||
|
||||
pushd $TARGET_DIR
|
||||
|
||||
rm -rf \
|
||||
./source.json \
|
||||
./gemset.nix \
|
||||
./yarn.lock \
|
||||
./yarn.nix
|
||||
|
||||
|
||||
# Check that working directory was created.
|
||||
if [[ ! "$WORK_DIR" || ! -d "$WORK_DIR" ]]; then
|
||||
echo "Could not create temporary directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete the working directory on exit.
|
||||
function cleanup {
|
||||
rm -rf "$WORK_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
|
||||
pushd $WORK_DIR
|
||||
|
||||
echo ":: Creating source.json"
|
||||
nix-prefetch-github zammad zammad --rev $VERSION --json > $TARGET_DIR/source.json
|
||||
echo >> $TARGET_DIR/source.json
|
||||
|
||||
echo ":: Fetching source"
|
||||
curl -L https://github.com/zammad/zammad/archive/$VERSION.tar.gz --output source.tar.gz
|
||||
tar zxf source.tar.gz
|
||||
|
||||
if [[ ! "$SOURCE_DIR" || ! -d "$SOURCE_DIR" ]]; then
|
||||
echo "Source directory does not exists."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd $SOURCE_DIR
|
||||
|
||||
echo ":: Creating gemset.nix"
|
||||
bundix --lockfile=./Gemfile.lock --gemfile=./Gemfile --gemset=$TARGET_DIR/gemset.nix
|
||||
|
||||
echo ":: Creating yarn.nix"
|
||||
yarn install
|
||||
cp yarn.lock $TARGET_DIR
|
||||
yarn2nix > $TARGET_DIR/yarn.nix
|
||||
|
||||
# needed to avoid import from derivation
|
||||
cp package.json $TARGET_DIR
|
||||
|
||||
popd
|
||||
popd
|
||||
popd
|
2347
pkgs/applications/networking/misc/zammad/yarn.lock
Normal file
2347
pkgs/applications/networking/misc/zammad/yarn.lock
Normal file
File diff suppressed because it is too large
Load diff
2669
pkgs/applications/networking/misc/zammad/yarn.nix
Normal file
2669
pkgs/applications/networking/misc/zammad/yarn.nix
Normal file
File diff suppressed because it is too large
Load diff
|
@ -30162,6 +30162,8 @@ with pkgs;
|
|||
|
||||
zam-plugins = callPackage ../applications/audio/zam-plugins { };
|
||||
|
||||
zammad = callPackage ../applications/networking/misc/zammad { };
|
||||
|
||||
zanshin = libsForQt5.callPackage ../applications/office/zanshin { };
|
||||
|
||||
zathuraPkgs = callPackage ../applications/misc/zathura { };
|
||||
|
|
Loading…
Reference in a new issue