commit
0136206b12
@ -0,0 +1,365 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.services.bookstack; |
||||
bookstack = pkgs.bookstack.override { |
||||
dataDir = cfg.dataDir; |
||||
}; |
||||
db = cfg.database; |
||||
mail = cfg.mail; |
||||
|
||||
user = cfg.user; |
||||
group = cfg.group; |
||||
|
||||
# shell script for local administration |
||||
artisan = pkgs.writeScriptBin "bookstack" '' |
||||
#! ${pkgs.runtimeShell} |
||||
cd ${bookstack} |
||||
sudo=exec |
||||
if [[ "$USER" != ${user} ]]; then |
||||
sudo='exec /run/wrappers/bin/sudo -u ${user}' |
||||
fi |
||||
$sudo ${pkgs.php}/bin/php artisan $* |
||||
''; |
||||
|
||||
|
||||
in { |
||||
options.services.bookstack = { |
||||
|
||||
enable = mkEnableOption "BookStack"; |
||||
|
||||
user = mkOption { |
||||
default = "bookstack"; |
||||
description = "User bookstack runs as."; |
||||
type = types.str; |
||||
}; |
||||
|
||||
group = mkOption { |
||||
default = "bookstack"; |
||||
description = "Group bookstack runs as."; |
||||
type = types.str; |
||||
}; |
||||
|
||||
appKeyFile = mkOption { |
||||
description = '' |
||||
A file containing the AppKey. |
||||
Used for encryption where needed. Can be generated with <code>head -c 32 /dev/urandom| base64</code> and must be prefixed with <literal>base64:</literal>. |
||||
''; |
||||
example = "/run/keys/bookstack-appkey"; |
||||
type = types.path; |
||||
}; |
||||
|
||||
appURL = mkOption { |
||||
description = '' |
||||
The root URL that you want to host BookStack on. All URLs in BookStack will be generated using this value. |
||||
If you change this in the future you may need to run a command to update stored URLs in the database. Command example: <code>php artisan bookstack:update-url https://old.example.com https://new.example.com</code> |
||||
''; |
||||
example = "https://example.com"; |
||||
type = types.str; |
||||
}; |
||||
|
||||
cacheDir = mkOption { |
||||
description = "BookStack cache directory"; |
||||
default = "/var/cache/bookstack"; |
||||
type = types.path; |
||||
}; |
||||
|
||||
dataDir = mkOption { |
||||
description = "BookStack data directory"; |
||||
default = "/var/lib/bookstack"; |
||||
type = types.path; |
||||
}; |
||||
|
||||
database = { |
||||
host = mkOption { |
||||
type = types.str; |
||||
default = "localhost"; |
||||
description = "Database host address."; |
||||
}; |
||||
port = mkOption { |
||||
type = types.port; |
||||
default = 3306; |
||||
description = "Database host port."; |
||||
}; |
||||
name = mkOption { |
||||
type = types.str; |
||||
default = "bookstack"; |
||||
description = "Database name."; |
||||
}; |
||||
user = mkOption { |
||||
type = types.str; |
||||
default = user; |
||||
defaultText = "\${user}"; |
||||
description = "Database username."; |
||||
}; |
||||
passwordFile = mkOption { |
||||
type = with types; nullOr path; |
||||
default = null; |
||||
example = "/run/keys/bookstack-dbpassword"; |
||||
description = '' |
||||
A file containing the password corresponding to |
||||
<option>database.user</option>. |
||||
''; |
||||
}; |
||||
createLocally = mkOption { |
||||
type = types.bool; |
||||
default = false; |
||||
description = "Create the database and database user locally."; |
||||
}; |
||||
}; |
||||
|
||||
mail = { |
||||
driver = mkOption { |
||||
type = types.enum [ "smtp" "sendmail" ]; |
||||
default = "smtp"; |
||||
description = "Mail driver to use."; |
||||
}; |
||||
host = mkOption { |
||||
type = types.str; |
||||
default = "localhost"; |
||||
description = "Mail host address."; |
||||
}; |
||||
port = mkOption { |
||||
type = types.port; |
||||
default = 1025; |
||||
description = "Mail host port."; |
||||
}; |
||||
fromName = mkOption { |
||||
type = types.str; |
||||
default = "BookStack"; |
||||
description = "Mail \"from\" name."; |
||||
}; |
||||
from = mkOption { |
||||
type = types.str; |
||||
default = "mail@bookstackapp.com"; |
||||
description = "Mail \"from\" email."; |
||||
}; |
||||
user = mkOption { |
||||
type = with types; nullOr str; |
||||
default = null; |
||||
example = "bookstack"; |
||||
description = "Mail username."; |
||||
}; |
||||
passwordFile = mkOption { |
||||
type = with types; nullOr path; |
||||
default = null; |
||||
example = "/run/keys/bookstack-mailpassword"; |
||||
description = '' |
||||
A file containing the password corresponding to |
||||
<option>mail.user</option>. |
||||
''; |
||||
}; |
||||
encryption = mkOption { |
||||
type = with types; nullOr (enum [ "tls" ]); |
||||
default = null; |
||||
description = "SMTP encryption mechanism to use."; |
||||
}; |
||||
}; |
||||
|
||||
maxUploadSize = mkOption { |
||||
type = types.str; |
||||
default = "18M"; |
||||
example = "1G"; |
||||
description = "The maximum size for uploads (e.g. images)."; |
||||
}; |
||||
|
||||
poolConfig = mkOption { |
||||
type = with types; attrsOf (oneOf [ str int bool ]); |
||||
default = { |
||||
"pm" = "dynamic"; |
||||
"pm.max_children" = 32; |
||||
"pm.start_servers" = 2; |
||||
"pm.min_spare_servers" = 2; |
||||
"pm.max_spare_servers" = 4; |
||||
"pm.max_requests" = 500; |
||||
}; |
||||
description = '' |
||||
Options for the bookstack PHP pool. See the documentation on <literal>php-fpm.conf</literal> |
||||
for details on configuration directives. |
||||
''; |
||||
}; |
||||
|
||||
nginx = mkOption { |
||||
type = types.submodule ( |
||||
recursiveUpdate |
||||
(import ../web-servers/nginx/vhost-options.nix { inherit config lib; }) {} |
||||
); |
||||
default = {}; |
||||
example = { |
||||
serverAliases = [ |
||||
"bookstack.\${config.networking.domain}" |
||||
]; |
||||
# To enable encryption and let let's encrypt take care of certificate |
||||
forceSSL = true; |
||||
enableACME = true; |
||||
}; |
||||
description = '' |
||||
With this option, you can customize the nginx virtualHost settings. |
||||
''; |
||||
}; |
||||
|
||||
extraConfig = mkOption { |
||||
type = types.nullOr types.lines; |
||||
default = null; |
||||
example = '' |
||||
ALLOWED_IFRAME_HOSTS="https://example.com" |
||||
WKHTMLTOPDF=/home/user/bins/wkhtmltopdf |
||||
''; |
||||
description = '' |
||||
Lines to be appended verbatim to the BookStack configuration. |
||||
Refer to <link xlink:href="https://www.bookstackapp.com/docs/"/> for details on supported values. |
||||
''; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
|
||||
assertions = [ |
||||
{ assertion = db.createLocally -> db.user == user; |
||||
message = "services.bookstack.database.user must be set to ${user} if services.mediawiki.database.createLocally is set true."; |
||||
} |
||||
{ assertion = db.createLocally -> db.passwordFile == null; |
||||
message = "services.bookstack.database.passwordFile cannot be specified if services.bookstack.database.createLocally is set to true."; |
||||
} |
||||
]; |
||||
|
||||
environment.systemPackages = [ artisan ]; |
||||
|
||||
services.mysql = mkIf db.createLocally { |
||||
enable = true; |
||||
package = mkDefault pkgs.mariadb; |
||||
ensureDatabases = [ db.name ]; |
||||
ensureUsers = [ |
||||
{ name = db.user; |
||||
ensurePermissions = { "${db.name}.*" = "ALL PRIVILEGES"; }; |
||||
} |
||||
]; |
||||
}; |
||||
|
||||
services.phpfpm.pools.bookstack = { |
||||
inherit user; |
||||
inherit group; |
||||
phpOptions = '' |
||||
log_errors = on |
||||
post_max_size = ${cfg.maxUploadSize} |
||||
upload_max_filesize = ${cfg.maxUploadSize} |
||||
''; |
||||
settings = { |
||||
"listen.mode" = "0660"; |
||||
"listen.owner" = user; |
||||
"listen.group" = group; |
||||
} // cfg.poolConfig; |
||||
}; |
||||
|
||||
services.nginx = { |
||||
enable = mkDefault true; |
||||
virtualHosts.bookstack = mkMerge [ cfg.nginx { |
||||
root = mkForce "${bookstack}/public"; |
||||
extraConfig = optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "fastcgi_param HTTPS on;"; |
||||
locations = { |
||||
"/" = { |
||||
index = "index.php"; |
||||
extraConfig = ''try_files $uri $uri/ /index.php?$query_string;''; |
||||
}; |
||||
"~ \.php$" = { |
||||
extraConfig = '' |
||||
try_files $uri $uri/ /index.php?$query_string; |
||||
include ${pkgs.nginx}/conf/fastcgi_params; |
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
||||
fastcgi_param REDIRECT_STATUS 200; |
||||
fastcgi_pass unix:${config.services.phpfpm.pools."bookstack".socket}; |
||||
${optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "fastcgi_param HTTPS on;"} |
||||
''; |
||||
}; |
||||
"~ \.(js|css|gif|png|ico|jpg|jpeg)$" = { |
||||
extraConfig = "expires 365d;"; |
||||
}; |
||||
}; |
||||
}]; |
||||
}; |
||||
|
||||
systemd.services.bookstack-setup = { |
||||
description = "Preperation tasks for BookStack"; |
||||
before = [ "phpfpm-bookstack.service" ]; |
||||
after = optional db.createLocally "mysql.service"; |
||||
wantedBy = [ "multi-user.target" ]; |
||||
serviceConfig = { |
||||
Type = "oneshot"; |
||||
User = user; |
||||
WorkingDirectory = "${bookstack}"; |
||||
}; |
||||
script = '' |
||||
# create .env file |
||||
echo " |
||||
APP_KEY=base64:$(head -n1 ${cfg.appKeyFile}) |
||||
APP_URL=${cfg.appURL} |
||||
DB_HOST=${db.host} |
||||
DB_PORT=${toString db.port} |
||||
DB_DATABASE=${db.name} |
||||
DB_USERNAME=${db.user} |
||||
MAIL_DRIVER=${mail.driver} |
||||
MAIL_FROM_NAME=\"${mail.fromName}\" |
||||
MAIL_FROM=${mail.from} |
||||
MAIL_HOST=${mail.host} |
||||
MAIL_PORT=${toString mail.port} |
||||
${optionalString (mail.user != null) "MAIL_USERNAME=${mail.user};"} |
||||
${optionalString (mail.encryption != null) "MAIL_ENCRYPTION=${mail.encryption};"} |
||||
${optionalString (db.passwordFile != null) "DB_PASSWORD=$(head -n1 ${db.passwordFile})"} |
||||
${optionalString (mail.passwordFile != null) "MAIL_PASSWORD=$(head -n1 ${mail.passwordFile})"} |
||||
APP_SERVICES_CACHE=${cfg.cacheDir}/services.php |
||||
APP_PACKAGES_CACHE=${cfg.cacheDir}/packages.php |
||||
APP_CONFIG_CACHE=${cfg.cacheDir}/config.php |
||||
APP_ROUTES_CACHE=${cfg.cacheDir}/routes-v7.php |
||||
APP_EVENTS_CACHE=${cfg.cacheDir}/events.php |
||||
${optionalString (cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME) "SESSION_SECURE_COOKIE=true"} |
||||
${toString cfg.extraConfig} |
||||
" > "${cfg.dataDir}/.env" |
||||
# set permissions |
||||
chmod 700 "${cfg.dataDir}/.env" |
||||
|
||||
# migrate db |
||||
${pkgs.php}/bin/php artisan migrate --force |
||||
|
||||
# create caches |
||||
${pkgs.php}/bin/php artisan config:cache |
||||
${pkgs.php}/bin/php artisan route:cache |
||||
${pkgs.php}/bin/php artisan view:cache |
||||
''; |
||||
}; |
||||
|
||||
systemd.tmpfiles.rules = [ |
||||
"d ${cfg.cacheDir} 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir} 0710 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/public 0750 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/public/uploads 0750 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/app 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/fonts 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/framework 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/framework/cache 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/framework/sessions 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/framework/views 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/logs 0700 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/storage/uploads 0700 ${user} ${group} - -" |
||||
]; |
||||
|
||||
users = { |
||||
users = mkIf (user == "bookstack") { |
||||
bookstack = { |
||||
inherit group; |
||||
isSystemUser = true; |
||||
}; |
||||
"${config.services.nginx.user}".extraGroups = [ group ]; |
||||
}; |
||||
groups = mkIf (group == "bookstack") { |
||||
bookstack = {}; |
||||
}; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
meta.maintainers = with maintainers; [ ymarkus ]; |
||||
} |
@ -0,0 +1,41 @@ |
||||
import ./make-test-python.nix { |
||||
name = "systemd-template-override"; |
||||
|
||||
machine = { pkgs, lib, ... }: let |
||||
touchTmp = pkgs.writeTextFile { |
||||
name = "touch-tmp@.service"; |
||||
text = '' |
||||
[Service] |
||||
Type=oneshot |
||||
ExecStart=${pkgs.coreutils}/bin/touch /tmp/%I |
||||
''; |
||||
destination = "/etc/systemd/system/touch-tmp@.service"; |
||||
}; |
||||
in { |
||||
systemd.packages = [ touchTmp ]; |
||||
|
||||
systemd.services."touch-tmp@forbidden" = { |
||||
serviceConfig.ExecStart = [ "" '' |
||||
${pkgs.coreutils}/bin/true |
||||
'']; |
||||
}; |
||||
|
||||
systemd.services."touch-tmp@intercept" = { |
||||
serviceConfig.ExecStart = [ "" '' |
||||
${pkgs.coreutils}/bin/touch /tmp/renamed |
||||
'']; |
||||
}; |
||||
}; |
||||
|
||||
testScript = '' |
||||
machine.wait_for_unit("default.target") |
||||
|
||||
machine.succeed("systemctl start touch-tmp@normal") |
||||
machine.succeed("systemctl start touch-tmp@forbbidden") |
||||
machine.succeed("systemctl start touch-tmp@intercept") |
||||
|
||||
machine.succeed("[ -e /tmp/normal ]") |
||||
machine.succeed("[ ! -e /tmp/forbidden ]") |
||||
machine.succeed("[ -e /tmp/renamed ]") |
||||
''; |
||||
} |
@ -1,31 +1,53 @@ |
||||
{ lib |
||||
, mkDerivation |
||||
, fetchFromGitHub |
||||
, fetchurl |
||||
, qmake |
||||
, qttools |
||||
, zlib |
||||
}: |
||||
|
||||
/* |
||||
To use aditional parts libraries |
||||
set the variable LEOCAD_LIB=/path/to/libs/ or use option -l /path/to/libs/ |
||||
*/ |
||||
|
||||
{ lib, stdenv, fetchFromGitHub, qt4, qmake4Hook, zlib }: |
||||
let |
||||
parts = fetchurl { |
||||
url = "https://web.archive.org/web/20190715142541/https://www.ldraw.org/library/updates/complete.zip"; |
||||
sha256 = "sha256-PW3XCbFwRaNkx4EgCnl2rXH7QgmpNgjTi17kZ5bladA="; |
||||
}; |
||||
|
||||
stdenv.mkDerivation rec { |
||||
in |
||||
mkDerivation rec { |
||||
pname = "leocad"; |
||||
version = "19.07.1"; |
||||
version = "21.03"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "leozide"; |
||||
repo = "leocad"; |
||||
rev = "v${version}"; |
||||
sha256 = "02kv1m18g6s4dady9jv4sjivfkrp192bmdw2a3d9lzlp60zks0p2"; |
||||
sha256 = "sha256-69Ocfk5dBXwcRqAZWEP9Xg41o/tAQo76dIOk9oYhCUE="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ qmake4Hook ]; |
||||
buildInputs = [ qt4 zlib ]; |
||||
postPatch = '' |
||||
export qmakeFlags="$qmakeFlags INSTALL_PREFIX=$out" |
||||
''; |
||||
nativeBuildInputs = [ qmake qttools ]; |
||||
|
||||
buildInputs = [ zlib ]; |
||||
|
||||
qmakeFlags = [ |
||||
"INSTALL_PREFIX=${placeholder "out"}" |
||||
"DISABLE_UPDATE_CHECK=1" |
||||
]; |
||||
|
||||
qtWrapperArgs = [ |
||||
"--set-default LEOCAD_LIB ${parts}" |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
description = "CAD program for creating virtual LEGO models"; |
||||
homepage = "https://www.leocad.org/"; |
||||
license = licenses.gpl2; |
||||
license = licenses.gpl2Only; |
||||
maintainers = with maintainers; [ peterhoeg ]; |
||||
platforms = platforms.linux; |
||||
}; |
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,24 +0,0 @@ |
||||
{ lib, stdenv, fetchurl }: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "concurrencykit"; |
||||
version = "0.6.0"; |
||||
|
||||
src = fetchurl { |
||||
url = "http://concurrencykit.org/releases/ck-${version}.tar.gz"; |
||||
sha256 = "1pv21p7sjwwmbs2xblpy1lqk53r2i212yrqyjlr5dr3rlv87vqnp"; |
||||
}; |
||||
|
||||
#Deleting this line causes "Unknown option --disable-static" |
||||
configurePhase = "./configure --prefix=$out"; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
meta = with lib; { |
||||
description = "A library of safe, high-performance concurrent data structures"; |
||||
homepage = "http://concurrencykit.org"; |
||||
license = licenses.bsd2; |
||||
platforms = platforms.unix; |
||||
maintainers = [ maintainers.thoughtpolice ]; |
||||
}; |
||||
} |
@ -1,40 +1,47 @@ |
||||
{ lib, stdenv, fetchurl, freetype, libGL, libGLU, OpenGL }: |
||||
|
||||
let |
||||
name = "ftgl-2.1.3-rc5"; |
||||
in |
||||
stdenv.mkDerivation { |
||||
inherit name; |
||||
{ lib |
||||
, stdenv |
||||
, fetchurl |
||||
, freetype |
||||
, libGL |
||||
, libGLU |
||||
, OpenGL |
||||
}: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "ftgl"; |
||||
version = "2.1.3-rc5"; |
||||
|
||||
src = fetchurl { |
||||
url = "mirror://sourceforge/ftgl/${name}.tar.gz"; |
||||
sha256 = "0nsn4s6vnv5xcgxcw6q031amvh2zfj2smy1r5mbnjj2548hxcn2l"; |
||||
url = "mirror://sourceforge/${pname}-${version}.tar.gz"; |
||||
hash = "sha256-VFjWISJFSGlXLTn4qoV0X8BdVRgAG876Y71su40mVls="; |
||||
}; |
||||
|
||||
buildInputs = [ freetype ] |
||||
++ (if stdenv.isDarwin then |
||||
[ OpenGL ] |
||||
else |
||||
[ libGL libGLU ]) |
||||
; |
||||
buildInputs = [ |
||||
freetype |
||||
] ++ (if stdenv.isDarwin then [ |
||||
OpenGL |
||||
] else [ |
||||
libGL |
||||
libGLU |
||||
]); |
||||
|
||||
configureFlags = [ "--with-ft-prefix=${lib.getDev freetype}" ]; |
||||
configureFlags = [ |
||||
"--with-ft-prefix=${lib.getDev freetype}" |
||||
]; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
meta = { |
||||
meta = with lib; { |
||||
homepage = "https://sourceforge.net/apps/mediawiki/ftgl/"; |
||||
description = "Font rendering library for OpenGL applications"; |
||||
license = lib.licenses.gpl3Plus; |
||||
|
||||
longDescription = '' |
||||
FTGL is a free cross-platform Open Source C++ library that uses |
||||
Freetype2 to simplify rendering fonts in OpenGL applications. FTGL |
||||
supports bitmaps, pixmaps, texture maps, outlines, polygon mesh, |
||||
and extruded polygon rendering modes. |
||||
FTGL is a free cross-platform Open Source C++ library that uses Freetype2 |
||||
to simplify rendering fonts in OpenGL applications. FTGL supports bitmaps, |
||||
pixmaps, texture maps, outlines, polygon mesh, and extruded polygon |
||||
rendering modes. |
||||
''; |
||||
|
||||
platforms = lib.platforms.unix; |
||||
maintainers = []; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = with maintainers; [ AndersonTorres ]; |
||||
platforms = platforms.unix; |
||||
}; |
||||
} |
||||
|
@ -0,0 +1,38 @@ |
||||
{ lib |
||||
, stdenv |
||||
, fetchFromRepoOrCz |
||||
, cmake |
||||
, libGL |
||||
, libpng |
||||
, pkg-config |
||||
, zlib |
||||
}: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "glpng"; |
||||
version = "1.46"; |
||||
|
||||
src = fetchFromRepoOrCz { |
||||
repo = "glpng"; |
||||
rev = "v${version}"; |
||||
hash = "sha256-C7EHaBN0PE/HJB6zcIaYU63+o7/MEz4WU1xr/kIOanM="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
pkg-config |
||||
]; |
||||
buildInputs = [ |
||||
libGL |
||||
libpng |
||||
zlib |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
homepage = "https://repo.or.cz/glpng.git/blob_plain/HEAD:/glpng.htm"; |
||||
description = "PNG loader for OpenGL"; |
||||
license = licenses.mit; |
||||
maintainers = with maintainers; [ AndersonTorres ]; |
||||
platforms = platforms.unix; |
||||
}; |
||||
} |
@ -0,0 +1,59 @@ |
||||
{ lib |
||||
, stdenv |
||||
, fetchFromGitHub |
||||
, cmake |
||||
, pkg-config |
||||
}: |
||||
|
||||
stdenv.mkDerivation rec { |
||||
pname = "md4c"; |
||||
version = "0.4.7"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "mity"; |
||||
repo = pname; |
||||
rev = "release-${version}"; |
||||
hash = "sha256-nfMXUP1wu3ifn1QVTO/+XcfFRsThG8PlmYRv+b8AYlQ="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
pkg-config |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
homepage = "https://github.com/mity/md4c"; |
||||
description = "Markdown parser made in C"; |
||||
longDescription = '' |
||||
MD4C is Markdown parser implementation in C, with the following features: |
||||
|
||||
- Compliance: Generally, MD4C aims to be compliant to the latest version |
||||
of CommonMark specification. Currently, we are fully compliant to |
||||
CommonMark 0.29. |
||||
- Extensions: MD4C supports some commonly requested and accepted |
||||
extensions. See below. |
||||
- Performance: MD4C is very fast. |
||||
- Compactness: MD4C parser is implemented in one source file and one |
||||
header file. There are no dependencies other than standard C library. |
||||
- Embedding: MD4C parser is easy to reuse in other projects, its API is |
||||
very straightforward: There is actually just one function, md_parse(). |
||||
- Push model: MD4C parses the complete document and calls few callback |
||||
functions provided by the application to inform it about a start/end of |
||||
every block, a start/end of every span, and with any textual contents. |
||||
- Portability: MD4C builds and works on Windows and POSIX-compliant |
||||
OSes. (It should be simple to make it run also on most other platforms, |
||||
at least as long as the platform provides C standard library, including |
||||
a heap memory management.) |
||||
- Encoding: MD4C by default expects UTF-8 encoding of the input |
||||
document. But it can be compiled to recognize ASCII-only control |
||||
characters (i.e. to disable all Unicode-specific code), or (on Windows) |
||||
to expect UTF-16 (i.e. what is on Windows commonly called just |
||||
"Unicode"). See more details below. |
||||
- Permissive license: MD4C is available under the MIT license. |
||||
''; |
||||
license = licenses.mit; |
||||
maintainers = with maintainers; [ AndersonTorres ]; |
||||
platforms = platforms.all; |
||||
}; |
||||
} |
||||
# TODO: enable tests (needs Python) |
@ -0,0 +1,21 @@ |
||||
diff --git a/freestanding/Makefile b/freestanding/Makefile
|
||||
index f22d220d..4bb3ac57 100644
|
||||
--- a/freestanding/Makefile
|
||||
+++ b/freestanding/Makefile
|
||||
@@ -1,6 +1,4 @@
|
||||
-PKG_CONFIG_PATH := $(shell opam config var prefix)/lib/pkgconfig
|
||||
-
|
||||
-EXISTS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --exists ocaml-freestanding; echo $$?)
|
||||
+EXISTS := $(shell pkg-config --exists ocaml-freestanding; echo $$?)
|
||||
|
||||
.PHONY: all clean
|
||||
all: libtcpip_freestanding_stubs.a
|
||||
@@ -10,7 +8,7 @@ libtcpip_freestanding_stubs.a:
|
||||
touch $@
|
||||
else
|
||||
CC ?= cc
|
||||
-FREESTANDING_CFLAGS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --cflags ocaml-freestanding)
|
||||
+FREESTANDING_CFLAGS := $(shell pkg-config --cflags ocaml-freestanding)
|
||||
CFLAGS := $(FREESTANDING_CFLAGS)
|
||||
|
||||
OBJS=checksum_stubs.o
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue