mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 11:40:45 +00:00
davis: init at 4.4.1
Release: https://github.com/tchapi/davis/releases/tag/v4.4.1
This commit is contained in:
parent
af105fd375
commit
afaaa840c1
10650
pkgs/by-name/da/davis/composer.lock
generated
Normal file
10650
pkgs/by-name/da/davis/composer.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
78
pkgs/by-name/da/davis/davis-data.patch
Normal file
78
pkgs/by-name/da/davis/davis-data.patch
Normal file
|
@ -0,0 +1,78 @@
|
|||
diff --git a/bin/console b/bin/console
|
||||
index 8fe9d49..3af9662 100755
|
||||
--- a/bin/console
|
||||
+++ b/bin/console
|
||||
@@ -1,5 +1,8 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
+if (getenv('ENV_DIR') !== false) {
|
||||
+ $_SERVER['APP_RUNTIME_OPTIONS']['dotenv_path'] = getenv('ENV_DIR').'/.env';
|
||||
+}
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Bundle\FrameworkBundle\Console\Application;
|
||||
@@ -28,7 +31,11 @@ if ($input->hasParameterOption('--no-debug', true)) {
|
||||
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
|
||||
}
|
||||
|
||||
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
+if (getenv('ENV_DIR') !== false) {
|
||||
+ (new Dotenv())->bootEnv(getenv('ENV_DIR').'/.env');
|
||||
+} else {
|
||||
+ (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
+}
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
umask(0000);
|
||||
diff --git a/public/index.php b/public/index.php
|
||||
index 3f8b90e..c57ec21 100644
|
||||
--- a/public/index.php
|
||||
+++ b/public/index.php
|
||||
@@ -1,5 +1,9 @@
|
||||
<?php
|
||||
|
||||
+if (getenv('ENV_DIR') !== false) {
|
||||
+ $_SERVER['APP_RUNTIME_OPTIONS']['dotenv_path'] = getenv('ENV_DIR').'/.env';
|
||||
+}
|
||||
+
|
||||
use App\Kernel;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
use Symfony\Component\ErrorHandler\Debug;
|
||||
@@ -7,7 +11,11 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
-(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
+if (getenv('ENV_DIR') !== false) {
|
||||
+ (new Dotenv())->bootEnv(getenv('ENV_DIR').'/.env');
|
||||
+} else {
|
||||
+ (new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
|
||||
+}
|
||||
|
||||
if ($_SERVER['APP_DEBUG']) {
|
||||
umask(0000);
|
||||
diff --git a/src/Kernel.php b/src/Kernel.php
|
||||
index 0f43d2f..8863f2c 100644
|
||||
--- a/src/Kernel.php
|
||||
+++ b/src/Kernel.php
|
||||
@@ -49,4 +49,20 @@ class Kernel extends BaseKernel
|
||||
(require $path)($routes->withPath($path), $this);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ public function getCacheDir(): string
|
||||
+ {
|
||||
+ if (getenv('CACHE_DIR') !== false) {
|
||||
+ return getenv('CACHE_DIR') . '/' . $this->getEnvironment();
|
||||
+ }
|
||||
+ return parent::getCacheDir();
|
||||
+ }
|
||||
+
|
||||
+ public function getLogDir(): string
|
||||
+ {
|
||||
+ if (getenv('LOG_DIR') !== false) {
|
||||
+ return getenv('LOG_DIR') . '/' . $this->getEnvironment();
|
||||
+ }
|
||||
+ return parent::getLogDir();
|
||||
+ }
|
||||
}
|
41
pkgs/by-name/da/davis/package.nix
Normal file
41
pkgs/by-name/da/davis/package.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ lib, fetchFromGitHub, php, }:
|
||||
|
||||
php.buildComposerProject (finalAttrs: {
|
||||
pname = "davis";
|
||||
version = "4.4.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "tchapi";
|
||||
repo = "davis";
|
||||
rev = "v${finalAttrs.version}";
|
||||
hash = "sha256-UBekmxKs4dveHh866Ix8UzY2NL6ygb8CKor+V3Cblns=";
|
||||
};
|
||||
|
||||
composerLock = ./composer.lock;
|
||||
vendorHash = "sha256-WGeNwBRzfUXa7kPIwd7/5dPXDjaBxXirAJcm6lNzueY=";
|
||||
|
||||
patches = [
|
||||
# Symfony loads .env files from the same directory as composer.json
|
||||
# The .env files contain runtime configuration that shouldn't be baked into deriviation for the package
|
||||
# This patch adds a few extension points exposing three environment variables:
|
||||
# RUNTIME_DIRECTORY (where to load .env from), CACHE_DIRECTORY and LOG_DIRECTORY (symfony cache and log rw directories)
|
||||
# Upstream PR https://github.com/tchapi/davis/issues/154
|
||||
./davis-data.patch
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
# Only include the files needed for runtime in the derivation
|
||||
mv $out/share/php/${finalAttrs.pname}/{migrations,public,src,config,bin,templates,tests,translations,vendor,symfony.lock,composer.json,composer.lock} $out
|
||||
# Save the upstream .env file for reference, but rename it so it is not loaded
|
||||
mv $out/share/php/${finalAttrs.pname}/.env $out/env-upstream
|
||||
rm -rf "$out/share"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
changelog = "https://github.com/tchapi/davis/releases/tag/v${finalAttrs.version}";
|
||||
homepage = "https://github.com/tchapi/davis";
|
||||
description = "A simple CardDav and CalDav server inspired by Baïkal";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ ramblurr ];
|
||||
};
|
||||
})
|
Loading…
Reference in a new issue