commit
a3b39a4e16
Can't render this file because it has a wrong number of fields in line 72.
|
@ -0,0 +1,493 @@ |
||||
{ config, lib, pkgs, ... }: |
||||
|
||||
with lib; |
||||
|
||||
let |
||||
cfg = config.services.snipe-it; |
||||
snipe-it = pkgs.snipe-it.override { |
||||
dataDir = cfg.dataDir; |
||||
}; |
||||
db = cfg.database; |
||||
mail = cfg.mail; |
||||
|
||||
user = cfg.user; |
||||
group = cfg.group; |
||||
|
||||
tlsEnabled = cfg.nginx.addSSL || cfg.nginx.forceSSL || cfg.nginx.onlySSL || cfg.nginx.enableACME; |
||||
|
||||
# shell script for local administration |
||||
artisan = pkgs.writeScriptBin "snipe-it" '' |
||||
#! ${pkgs.runtimeShell} |
||||
cd ${snipe-it} |
||||
sudo=exec |
||||
if [[ "$USER" != ${user} ]]; then |
||||
sudo='exec /run/wrappers/bin/sudo -u ${user}' |
||||
fi |
||||
$sudo ${pkgs.php}/bin/php artisan $* |
||||
''; |
||||
in { |
||||
options.services.snipe-it = { |
||||
|
||||
enable = mkEnableOption "A free open source IT asset/license management system"; |
||||
|
||||
user = mkOption { |
||||
default = "snipeit"; |
||||
description = "User snipe-it runs as."; |
||||
type = types.str; |
||||
}; |
||||
|
||||
group = mkOption { |
||||
default = "snipeit"; |
||||
description = "Group snipe-it runs as."; |
||||
type = types.str; |
||||
}; |
||||
|
||||
appKeyFile = mkOption { |
||||
description = '' |
||||
A file containing the Laravel APP_KEY - a 32 character long, |
||||
base64 encoded key used for encryption where needed. Can be |
||||
generated with <code>head -c 32 /dev/urandom | base64</code>. |
||||
''; |
||||
example = "/run/keys/snipe-it/appkey"; |
||||
type = types.path; |
||||
}; |
||||
|
||||
hostName = lib.mkOption { |
||||
type = lib.types.str; |
||||
default = if config.networking.domain != null then |
||||
config.networking.fqdn |
||||
else |
||||
config.networking.hostName; |
||||
defaultText = lib.literalExpression "config.networking.fqdn"; |
||||
example = "snipe-it.example.com"; |
||||
description = '' |
||||
The hostname to serve Snipe-IT on. |
||||
''; |
||||
}; |
||||
|
||||
appURL = mkOption { |
||||
description = '' |
||||
The root URL that you want to host Snipe-IT on. All URLs in Snipe-IT 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>snipe-it snipe-it:update-url https://old.example.com https://new.example.com</code> |
||||
''; |
||||
default = "http${lib.optionalString tlsEnabled "s"}://${cfg.hostName}"; |
||||
defaultText = '' |
||||
http''${lib.optionalString tlsEnabled "s"}://''${cfg.hostName} |
||||
''; |
||||
example = "https://example.com"; |
||||
type = types.str; |
||||
}; |
||||
|
||||
dataDir = mkOption { |
||||
description = "snipe-it data directory"; |
||||
default = "/var/lib/snipe-it"; |
||||
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 = "snipeit"; |
||||
description = "Database name."; |
||||
}; |
||||
user = mkOption { |
||||
type = types.str; |
||||
default = user; |
||||
defaultText = literalExpression "user"; |
||||
description = "Database username."; |
||||
}; |
||||
passwordFile = mkOption { |
||||
type = with types; nullOr path; |
||||
default = null; |
||||
example = "/run/keys/snipe-it/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."; |
||||
}; |
||||
encryption = mkOption { |
||||
type = with types; nullOr (enum [ "tls" "ssl" ]); |
||||
default = null; |
||||
description = "SMTP encryption mechanism to use."; |
||||
}; |
||||
user = mkOption { |
||||
type = with types; nullOr str; |
||||
default = null; |
||||
example = "snipeit"; |
||||
description = "Mail username."; |
||||
}; |
||||
passwordFile = mkOption { |
||||
type = with types; nullOr path; |
||||
default = null; |
||||
example = "/run/keys/snipe-it/mailpassword"; |
||||
description = '' |
||||
A file containing the password corresponding to |
||||
<option>mail.user</option>. |
||||
''; |
||||
}; |
||||
backupNotificationAddress = mkOption { |
||||
type = types.str; |
||||
default = "backup@example.com"; |
||||
description = "Email Address to send Backup Notifications to."; |
||||
}; |
||||
from = { |
||||
name = mkOption { |
||||
type = types.str; |
||||
default = "Snipe-IT Asset Management"; |
||||
description = "Mail \"from\" name."; |
||||
}; |
||||
address = mkOption { |
||||
type = types.str; |
||||
default = "mail@example.com"; |
||||
description = "Mail \"from\" address."; |
||||
}; |
||||
}; |
||||
replyTo = { |
||||
name = mkOption { |
||||
type = types.str; |
||||
default = "Snipe-IT Asset Management"; |
||||
description = "Mail \"reply-to\" name."; |
||||
}; |
||||
address = mkOption { |
||||
type = types.str; |
||||
default = "mail@example.com"; |
||||
description = "Mail \"reply-to\" address."; |
||||
}; |
||||
}; |
||||
}; |
||||
|
||||
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 snipe-it 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 = literalExpression '' |
||||
{ |
||||
serverAliases = [ |
||||
"snipe-it.''${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. |
||||
''; |
||||
}; |
||||
|
||||
config = mkOption { |
||||
type = with types; |
||||
attrsOf |
||||
(nullOr |
||||
(either |
||||
(oneOf [ |
||||
bool |
||||
int |
||||
port |
||||
path |
||||
str |
||||
]) |
||||
(submodule { |
||||
options = { |
||||
_secret = mkOption { |
||||
type = nullOr (oneOf [ str path ]); |
||||
description = '' |
||||
The path to a file containing the value the |
||||
option should be set to in the final |
||||
configuration file. |
||||
''; |
||||
}; |
||||
}; |
||||
}))); |
||||
default = {}; |
||||
example = literalExpression '' |
||||
{ |
||||
ALLOWED_IFRAME_HOSTS = "https://example.com"; |
||||
WKHTMLTOPDF = "''${pkgs.wkhtmltopdf}/bin/wkhtmltopdf"; |
||||
AUTH_METHOD = "oidc"; |
||||
OIDC_NAME = "MyLogin"; |
||||
OIDC_DISPLAY_NAME_CLAIMS = "name"; |
||||
OIDC_CLIENT_ID = "snipe-it"; |
||||
OIDC_CLIENT_SECRET = {_secret = "/run/keys/oidc_secret"}; |
||||
OIDC_ISSUER = "https://keycloak.example.com/auth/realms/My%20Realm"; |
||||
OIDC_ISSUER_DISCOVER = true; |
||||
} |
||||
''; |
||||
description = '' |
||||
Snipe-IT configuration options to set in the |
||||
<filename>.env</filename> file. |
||||
Refer to <link xlink:href="https://snipe-it.readme.io/docs/configuration"/> |
||||
for details on supported values. |
||||
|
||||
Settings containing secret data should be set to an attribute |
||||
set containing the attribute <literal>_secret</literal> - a |
||||
string pointing to a file containing the value the option |
||||
should be set to. See the example to get a better picture of |
||||
this: in the resulting <filename>.env</filename> file, the |
||||
<literal>OIDC_CLIENT_SECRET</literal> key will be set to the |
||||
contents of the <filename>/run/keys/oidc_secret</filename> |
||||
file. |
||||
''; |
||||
}; |
||||
}; |
||||
|
||||
config = mkIf cfg.enable { |
||||
|
||||
assertions = [ |
||||
{ assertion = db.createLocally -> db.user == user; |
||||
message = "services.snipe-it.database.user must be set to ${user} if services.snipe-it.database.createLocally is set true."; |
||||
} |
||||
{ assertion = db.createLocally -> db.passwordFile == null; |
||||
message = "services.snipe-it.database.passwordFile cannot be specified if services.snipe-it.database.createLocally is set to true."; |
||||
} |
||||
]; |
||||
|
||||
environment.systemPackages = [ artisan ]; |
||||
|
||||
services.snipe-it.config = { |
||||
APP_ENV = "production"; |
||||
APP_KEY._secret = cfg.appKeyFile; |
||||
APP_URL = cfg.appURL; |
||||
DB_HOST = db.host; |
||||
DB_PORT = db.port; |
||||
DB_DATABASE = db.name; |
||||
DB_USERNAME = db.user; |
||||
DB_PASSWORD._secret = db.passwordFile; |
||||
MAIL_DRIVER = mail.driver; |
||||
MAIL_FROM_NAME = mail.from.name; |
||||
MAIL_FROM_ADDR = mail.from.address; |
||||
MAIL_REPLYTO_NAME = mail.from.name; |
||||
MAIL_REPLYTO_ADDR = mail.from.address; |
||||
MAIL_BACKUP_NOTIFICATION_ADDRESS = mail.backupNotificationAddress; |
||||
MAIL_HOST = mail.host; |
||||
MAIL_PORT = mail.port; |
||||
MAIL_USERNAME = mail.user; |
||||
MAIL_ENCRYPTION = mail.encryption; |
||||
MAIL_PASSWORD._secret = mail.passwordFile; |
||||
APP_SERVICES_CACHE = "/run/snipe-it/cache/services.php"; |
||||
APP_PACKAGES_CACHE = "/run/snipe-it/cache/packages.php"; |
||||
APP_CONFIG_CACHE = "/run/snipe-it/cache/config.php"; |
||||
APP_ROUTES_CACHE = "/run/snipe-it/cache/routes-v7.php"; |
||||
APP_EVENTS_CACHE = "/run/snipe-it/cache/events.php"; |
||||
SESSION_SECURE_COOKIE = tlsEnabled; |
||||
}; |
||||
|
||||
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.snipe-it = { |
||||
inherit user group; |
||||
phpPackage = pkgs.php74; |
||||
phpOptions = '' |
||||
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."${cfg.hostName}" = mkMerge [ cfg.nginx { |
||||
root = mkForce "${snipe-it}/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 ${config.services.nginx.package}/conf/fastcgi_params; |
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; |
||||
fastcgi_param REDIRECT_STATUS 200; |
||||
fastcgi_pass unix:${config.services.phpfpm.pools."snipe-it".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.snipe-it-setup = { |
||||
description = "Preperation tasks for snipe-it"; |
||||
before = [ "phpfpm-snipe-it.service" ]; |
||||
after = optional db.createLocally "mysql.service"; |
||||
wantedBy = [ "multi-user.target" ]; |
||||
serviceConfig = { |
||||
Type = "oneshot"; |
||||
RemainAfterExit = true; |
||||
User = user; |
||||
WorkingDirectory = snipe-it; |
||||
RuntimeDirectory = "snipe-it/cache"; |
||||
RuntimeDirectoryMode = 0700; |
||||
}; |
||||
path = [ pkgs.replace-secret ]; |
||||
script = |
||||
let |
||||
isSecret = v: isAttrs v && v ? _secret && (isString v._secret || builtins.isPath v._secret); |
||||
snipeITEnvVars = lib.generators.toKeyValue { |
||||
mkKeyValue = lib.flip lib.generators.mkKeyValueDefault "=" { |
||||
mkValueString = v: with builtins; |
||||
if isInt v then toString v |
||||
else if isString v then "\"${v}\"" |
||||
else if true == v then "true" |
||||
else if false == v then "false" |
||||
else if isSecret v then |
||||
if (isString v._secret) then |
||||
hashString "sha256" v._secret |
||||
else |
||||
hashString "sha256" (builtins.readFile v._secret) |
||||
else throw "unsupported type ${typeOf v}: ${(lib.generators.toPretty {}) v}"; |
||||
}; |
||||
}; |
||||
secretPaths = lib.mapAttrsToList (_: v: v._secret) (lib.filterAttrs (_: isSecret) cfg.config); |
||||
mkSecretReplacement = file: '' |
||||
replace-secret ${escapeShellArgs [ |
||||
( |
||||
if (isString file) then |
||||
builtins.hashString "sha256" file |
||||
else |
||||
builtins.hashString "sha256" (builtins.readFile file) |
||||
) |
||||
file |
||||
"${cfg.dataDir}/.env" |
||||
]} |
||||
''; |
||||
secretReplacements = lib.concatMapStrings mkSecretReplacement secretPaths; |
||||
filteredConfig = lib.converge (lib.filterAttrsRecursive (_: v: ! elem v [ {} null ])) cfg.config; |
||||
snipeITEnv = pkgs.writeText "snipeIT.env" (snipeITEnvVars filteredConfig); |
||||
in '' |
||||
# error handling |
||||
set -euo pipefail |
||||
|
||||
# set permissions |
||||
umask 077 |
||||
|
||||
# create .env file |
||||
install -T -m 0600 -o ${user} ${snipeITEnv} "${cfg.dataDir}/.env" |
||||
|
||||
# replace secrets |
||||
${secretReplacements} |
||||
|
||||
# prepend `base64:` if it does not exist in APP_KEY |
||||
if ! grep 'APP_KEY=base64:' "${cfg.dataDir}/.env" >/dev/null; then |
||||
sed -i 's/APP_KEY=/APP_KEY=base64:/' "${cfg.dataDir}/.env" |
||||
fi |
||||
|
||||
# purge cache |
||||
rm "${cfg.dataDir}"/bootstrap/cache/*.php || true |
||||
|
||||
# migrate db |
||||
${pkgs.php}/bin/php artisan migrate --force |
||||
''; |
||||
}; |
||||
|
||||
systemd.tmpfiles.rules = [ |
||||
"d ${cfg.dataDir} 0710 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/bootstrap 0750 ${user} ${group} - -" |
||||
"d ${cfg.dataDir}/bootstrap/cache 0750 ${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 == "snipeit") { |
||||
snipeit = { |
||||
inherit group; |
||||
isSystemUser = true; |
||||
}; |
||||
"${config.services.nginx.user}".extraGroups = [ group ]; |
||||
}; |
||||
groups = mkIf (group == "snipeit") { |
||||
snipeit = {}; |
||||
}; |
||||
}; |
||||
|
||||
}; |
||||
|
||||
meta.maintainers = with maintainers; [ yayayayaka ]; |
||||
} |
@ -0,0 +1,56 @@ |
||||
{ lib |
||||
, mkDerivation |
||||
, fetchFromGitLab |
||||
, cmake |
||||
, extra-cmake-modules |
||||
, applet-window-buttons |
||||
, karchive |
||||
, kcoreaddons |
||||
, ki18n |
||||
, kio |
||||
, kirigami2 |
||||
, mauikit |
||||
, mauikit-filebrowsing |
||||
, mauikit-texteditor |
||||
, qtmultimedia |
||||
, qtquickcontrols2 |
||||
}: |
||||
|
||||
mkDerivation rec { |
||||
pname = "nota"; |
||||
version = "2.1.1"; |
||||
|
||||
src = fetchFromGitLab { |
||||
domain = "invent.kde.org"; |
||||
owner = "maui"; |
||||
repo = "nota"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256-Sgpm5njhQDe9ohAVFcN5iPNC6v9+QZnGRPYxuLvUno8="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
extra-cmake-modules |
||||
]; |
||||
|
||||
buildInputs = [ |
||||
applet-window-buttons |
||||
karchive |
||||
kcoreaddons |
||||
ki18n |
||||
kio |
||||
kirigami2 |
||||
mauikit |
||||
mauikit-filebrowsing |
||||
mauikit-texteditor |
||||
qtmultimedia |
||||
qtquickcontrols2 |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
description = "Multi-platform text editor"; |
||||
homepage = "https://invent.kde.org/maui/nota"; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = with maintainers; [ onny ]; |
||||
}; |
||||
} |
@ -1,59 +0,0 @@ |
||||
{ lib, fetchFromGitHub, fetchurl, python2Packages, curl }: |
||||
|
||||
let |
||||
getmodel = name: sha256: { |
||||
inherit name; |
||||
src = fetchurl { |
||||
url = "http://www.tmbdev.net/ocropy/${name}"; |
||||
inherit sha256; |
||||
}; |
||||
}; |
||||
|
||||
models = [ |
||||
(getmodel "en-default.pyrnn.gz" |
||||
"1xyi3k3p81mfw0491gb1haisazfyi2i18f1wjs1m34ak39qfqjdp") |
||||
(getmodel "fraktur.pyrnn.gz" |
||||
"1wlwvxn91ilgmlri1hj81arl3mbzxc24ycdnkf5icq4hdi4c6y8b") |
||||
]; |
||||
|
||||
in |
||||
python2Packages.buildPythonApplication rec { |
||||
pname = "ocropus"; |
||||
version = "1.3.3"; |
||||
|
||||
src = fetchFromGitHub { |
||||
sha256 = "02p1334mic5cfhvpfphfrbim4036yfd8s2zzpwm0xmm829z71nr7"; |
||||
rev = "v${version}"; |
||||
repo = "ocropy"; |
||||
owner = "tmbdev"; |
||||
}; |
||||
|
||||
propagatedBuildInputs = with python2Packages; [ curl numpy scipy pillow |
||||
matplotlib beautifulsoup4 pygtk lxml ]; |
||||
|
||||
enableParallelBuilding = true; |
||||
|
||||
preConfigure = with lib; '' |
||||
${concatStrings (map (x: "cp -R ${x.src} models/`basename ${x.name}`;") |
||||
models)} |
||||
|
||||
substituteInPlace ocrolib/common.py --replace /usr/local $out |
||||
substituteInPlace ocrolib/default.py --replace /usr/local $out |
||||
''; |
||||
|
||||
doCheck = false; # fails |
||||
checkPhase = '' |
||||
patchShebangs . |
||||
substituteInPlace ./run-test \ |
||||
--replace 'ocropus-rpred' 'ocropus-rpred -Q $NIX_BUILD_CORES' |
||||
PATH=".:$PATH" ./run-test |
||||
''; |
||||
|
||||
meta = with lib; { |
||||
description = "Open source document analysis and OCR system"; |
||||
license = licenses.asl20; |
||||
homepage = "https://github.com/tmbdev/ocropy/"; |
||||
maintainers = with maintainers; [ domenkozar ]; |
||||
platforms = platforms.linux; |
||||
}; |
||||
} |
@ -0,0 +1,59 @@ |
||||
{ lib |
||||
, mkDerivation |
||||
, fetchFromGitLab |
||||
, cmake |
||||
, extra-cmake-modules |
||||
, applet-window-buttons |
||||
, karchive |
||||
, kcoreaddons |
||||
, ki18n |
||||
, kio |
||||
, kirigami2 |
||||
, mauikit |
||||
, mauikit-accounts |
||||
, mauikit-filebrowsing |
||||
, qtmultimedia |
||||
, qtquickcontrols2 |
||||
, taglib |
||||
}: |
||||
|
||||
mkDerivation rec { |
||||
pname = "vvave"; |
||||
version = "2.1.1"; |
||||
|
||||
src = fetchFromGitLab { |
||||
domain = "invent.kde.org"; |
||||
owner = "maui"; |
||||
repo = "vvave"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256-ykX1kd3106KTDTJQIGk6miSgbj+oROiXQl/nkCjTphE="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
extra-cmake-modules |
||||
]; |
||||
|
||||
buildInputs = [ |
||||
applet-window-buttons |
||||
karchive |
||||
kcoreaddons |
||||
ki18n |
||||
kio |
||||
kirigami2 |
||||
mauikit |
||||
mauikit-accounts |
||||
mauikit-filebrowsing |
||||
qtmultimedia |
||||
qtquickcontrols2 |
||||
taglib |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
description = "Multi-platform media player"; |
||||
homepage = "https://invent.kde.org/maui/vvave"; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = with maintainers; [ onny ]; |
||||
}; |
||||
} |
||||
|
@ -1,6 +1,6 @@ |
||||
{ |
||||
"commit": "08ae12813ead00810e00ffe9dae284fcafe6a08a", |
||||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/08ae12813ead00810e00ffe9dae284fcafe6a08a.tar.gz", |
||||
"sha256": "00jc08pifnp791s1scscdhgwlf75v9682a7vjis1djnhj3y5s3ny", |
||||
"msg": "Update from Hackage at 2022-05-01T06:09:30Z" |
||||
"commit": "78324aa49909392e169c86bbfd204694523907e8", |
||||
"url": "https://github.com/commercialhaskell/all-cabal-hashes/archive/78324aa49909392e169c86bbfd204694523907e8.tar.gz", |
||||
"sha256": "15k5ag36asswwv8yazq53lkj9blnz4hzlq23cznvvk5pkjpdm0ni", |
||||
"msg": "Update from Hackage at 2022-05-05T15:07:55Z" |
||||
} |
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,61 @@ |
||||
{ lib |
||||
, stdenv |
||||
, fetchFromGitHub |
||||
, cmake |
||||
, zlib |
||||
, libpng |
||||
, libjpeg |
||||
, libGL |
||||
, libX11 |
||||
, libXxf86vm |
||||
, withTouchSupport ? false |
||||
, libXi |
||||
, libXext |
||||
, Cocoa |
||||
, Kernel |
||||
}: |
||||
stdenv.mkDerivation rec { |
||||
pname = "irrlichtmt"; |
||||
version = "1.9.0mt4"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "minetest"; |
||||
repo = "irrlicht"; |
||||
rev = version; |
||||
sha256 = "sha256-YlXn9LrfGkjdb8+zQGDgrInolUYj9nVSF2AXWFpEEkw="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
]; |
||||
|
||||
# https://github.com/minetest/minetest/pull/10729 |
||||
postPatch = lib.optionalString withTouchSupport '' |
||||
substituteInPlace include/IrrCompileConfig.h \ |
||||
--replace '//#define _IRR_LINUX_X11_XINPUT2_' '#define _IRR_LINUX_X11_XINPUT2_' |
||||
''; |
||||
|
||||
buildInputs = [ |
||||
zlib |
||||
libpng |
||||
libjpeg |
||||
libGL |
||||
libX11 |
||||
libXxf86vm |
||||
] ++ lib.optionals withTouchSupport [ |
||||
libXi |
||||
libXext |
||||
] ++ lib.optionals stdenv.isDarwin [ |
||||
Cocoa |
||||
Kernel |
||||
]; |
||||
|
||||
outputs = [ "out" "dev" ]; |
||||
|
||||
meta = { |
||||
homepage = "https://github.com/minetest/irrlicht"; |
||||
license = lib.licenses.zlib; |
||||
maintainers = with lib.maintainers; [ DeeUnderscore ]; |
||||
description = "Minetest project's fork of Irrlicht, a realtime 3D engine written in C++"; |
||||
}; |
||||
} |
@ -0,0 +1,244 @@ |
||||
# This file originates from composer2nix |
||||
|
||||
{ stdenv, lib, writeTextFile, fetchurl, php, unzip, phpPackages }: |
||||
|
||||
let |
||||
inherit (phpPackages) composer; |
||||
|
||||
filterSrc = src: |
||||
builtins.filterSource (path: type: type != "directory" || (baseNameOf path != ".git" && baseNameOf path != ".git" && baseNameOf path != ".svn")) src; |
||||
|
||||
buildZipPackage = { name, src }: |
||||
stdenv.mkDerivation { |
||||
inherit name src; |
||||
nativeBuildInputs = [ unzip ]; |
||||
buildCommand = '' |
||||
shopt -s dotglob |
||||
unzip $src |
||||
baseDir=$(find . -type d -mindepth 1 -maxdepth 1) |
||||
cd $baseDir |
||||
mkdir -p $out |
||||
mv * $out |
||||
''; |
||||
}; |
||||
|
||||
buildPackage = |
||||
{ name |
||||
, src |
||||
, packages ? {} |
||||
, devPackages ? {} |
||||
, buildInputs ? [] |
||||
, symlinkDependencies ? false |
||||
, executable ? false |
||||
, removeComposerArtifacts ? false |
||||
, postInstall ? "" |
||||
, noDev ? false |
||||
, composerExtraArgs ? "" |
||||
, unpackPhase ? "true" |
||||
, buildPhase ? "true" |
||||
, ...}@args: |
||||
|
||||
let |
||||
reconstructInstalled = writeTextFile { |
||||
name = "reconstructinstalled.php"; |
||||
executable = true; |
||||
text = '' |
||||
#! ${php}/bin/php |
||||
<?php |
||||
if(file_exists($argv[1])) |
||||
{ |
||||
$composerLockStr = file_get_contents($argv[1]); |
||||
|
||||
if($composerLockStr === false) |
||||
{ |
||||
fwrite(STDERR, "Cannot open composer.lock contents\n"); |
||||
exit(1); |
||||
} |
||||
else |
||||
{ |
||||
$config = json_decode($composerLockStr, true); |
||||
|
||||
if(array_key_exists("packages", $config)) |
||||
$allPackages = $config["packages"]; |
||||
else |
||||
$allPackages = array(); |
||||
|
||||
${lib.optionalString (!noDev) '' |
||||
if(array_key_exists("packages-dev", $config)) |
||||
$allPackages = array_merge($allPackages, $config["packages-dev"]); |
||||
''} |
||||
|
||||
$packagesStr = json_encode($allPackages, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); |
||||
print($packagesStr); |
||||
} |
||||
} |
||||
else |
||||
print("[]"); |
||||
?> |
||||
''; |
||||
}; |
||||
|
||||
constructBin = writeTextFile { |
||||
name = "constructbin.php"; |
||||
executable = true; |
||||
text = '' |
||||
#! ${php}/bin/php |
||||
<?php |
||||
$composerJSONStr = file_get_contents($argv[1]); |
||||
|
||||
if($composerJSONStr === false) |
||||
{ |
||||
fwrite(STDERR, "Cannot open composer.json contents\n"); |
||||
exit(1); |
||||
} |
||||
else |
||||
{ |
||||
$config = json_decode($composerJSONStr, true); |
||||
|
||||
if(array_key_exists("bin-dir", $config)) |
||||
$binDir = $config["bin-dir"]; |
||||
else |
||||
$binDir = "bin"; |
||||
|
||||
if(array_key_exists("bin", $config)) |
||||
{ |
||||
if(!file_exists("vendor/".$binDir)) |
||||
mkdir("vendor/".$binDir); |
||||
|
||||
foreach($config["bin"] as $bin) |
||||
symlink("../../".$bin, "vendor/".$binDir."/".basename($bin)); |
||||
} |
||||
} |
||||
?> |
||||
''; |
||||
}; |
||||
|
||||
bundleDependencies = dependencies: |
||||
lib.concatMapStrings (dependencyName: |
||||
let |
||||
dependency = dependencies.${dependencyName}; |
||||
in |
||||
'' |
||||
${if dependency.targetDir == "" then '' |
||||
vendorDir="$(dirname ${dependencyName})" |
||||
mkdir -p "$vendorDir" |
||||
${if symlinkDependencies then |
||||
''ln -s "${dependency.src}" "$vendorDir/$(basename "${dependencyName}")"'' |
||||
else |
||||
''cp -av "${dependency.src}" "$vendorDir/$(basename "${dependencyName}")"'' |
||||
} |
||||
'' else '' |
||||
namespaceDir="${dependencyName}/$(dirname "${dependency.targetDir}")" |
||||
mkdir -p "$namespaceDir" |
||||
${if symlinkDependencies then |
||||
''ln -s "${dependency.src}" "$namespaceDir/$(basename "${dependency.targetDir}")"'' |
||||
else |
||||
''cp -av "${dependency.src}" "$namespaceDir/$(basename "${dependency.targetDir}")"'' |
||||
} |
||||
''} |
||||
'') (builtins.attrNames dependencies); |
||||
|
||||
extraArgs = removeAttrs args [ "packages" "devPackages" "buildInputs" ]; |
||||
in |
||||
stdenv.mkDerivation ({ |
||||
buildInputs = [ php composer ] ++ buildInputs; |
||||
|
||||
inherit unpackPhase buildPhase; |
||||
|
||||
installPhase = '' |
||||
${if executable then '' |
||||
mkdir -p $out/share/php |
||||
cp -av $src $out/share/php/$name |
||||
chmod -R u+w $out/share/php/$name |
||||
cd $out/share/php/$name |
||||
'' else '' |
||||
cp -av $src $out |
||||
chmod -R u+w $out |
||||
cd $out |
||||
''} |
||||
|
||||
# Remove unwanted files |
||||
rm -f *.nix |
||||
|
||||
export HOME=$TMPDIR |
||||
|
||||
# Remove the provided vendor folder if it exists |
||||
rm -Rf vendor |
||||
|
||||
# If there is no composer.lock file, compose a dummy file. |
||||
# Otherwise, composer attempts to download the package.json file from |
||||
# the registry which we do not want. |
||||
if [ ! -f composer.lock ] |
||||
then |
||||
cat > composer.lock <<EOF |
||||
{ |
||||
"packages": [] |
||||
} |
||||
EOF |
||||
fi |
||||
|
||||
# Reconstruct the installed.json file from the lock file |
||||
mkdir -p vendor/composer |
||||
${php}/bin/php ${reconstructInstalled} composer.lock > vendor/composer/installed.json |
||||
|
||||
# Copy or symlink the provided dependencies |
||||
cd vendor |
||||
${bundleDependencies packages} |
||||
${lib.optionalString (!noDev) (bundleDependencies devPackages)} |
||||
cd .. |
||||
|
||||
# Reconstruct autoload scripts |
||||
# We use the optimize feature because Nix packages cannot change after they have been built |
||||
# Using the dynamic loader for a Nix package is useless since there is nothing to dynamically reload. |
||||
composer dump-autoload --optimize ${lib.optionalString noDev "--no-dev"} ${composerExtraArgs} |
||||
|
||||
# Run the install step as a validation to confirm that everything works out as expected |
||||
composer install --optimize-autoloader ${lib.optionalString noDev "--no-dev"} ${composerExtraArgs} |
||||
|
||||
${lib.optionalString executable '' |
||||
# Reconstruct the bin/ folder if we deploy an executable project |
||||
${php}/bin/php ${constructBin} composer.json |
||||
ln -s $(pwd)/vendor/bin $out/bin |
||||
''} |
||||
|
||||
${lib.optionalString (!symlinkDependencies) '' |
||||
# Patch the shebangs if possible |
||||
if [ -d $(pwd)/vendor/bin ] |
||||
then |
||||
# Look for all executables in bin/ |
||||
for i in $(pwd)/vendor/bin/* |
||||
do |
||||
# Look for their location |
||||
realFile=$(readlink -f "$i") |
||||
|
||||
# Restore write permissions |
||||
chmod u+wx "$(dirname "$realFile")" |
||||
chmod u+w "$realFile" |
||||
|
||||
# Patch shebang |
||||
sed -e "s|#!/usr/bin/php|#!${php}/bin/php|" \ |
||||
-e "s|#!/usr/bin/env php|#!${php}/bin/php|" \ |
||||
"$realFile" > tmp |
||||
mv tmp "$realFile" |
||||
chmod u+x "$realFile" |
||||
done |
||||
fi |
||||
''} |
||||
|
||||
if [ "$removeComposerArtifacts" = "1" ] |
||||
then |
||||
# Remove composer stuff |
||||
rm -f composer.json composer.lock |
||||
fi |
||||
|
||||
# Execute post install hook |
||||
runHook postInstall |
||||
''; |
||||
} // extraArgs); |
||||
in |
||||
{ |
||||
inherit filterSrc; |
||||
composer = lib.makeOverridable composer; |
||||
buildZipPackage = lib.makeOverridable buildZipPackage; |
||||
buildPackage = lib.makeOverridable buildPackage; |
||||
} |
@ -0,0 +1,15 @@ |
||||
{pkgs ? import <nixpkgs> { |
||||
inherit system; |
||||
}, system ? builtins.currentSystem, noDev ? false, php ? pkgs.php, phpPackages ? pkgs.phpPackages}: |
||||
|
||||
let |
||||
composerEnv = import ./composer-env.nix { |
||||
inherit (pkgs) stdenv lib writeTextFile fetchurl unzip; |
||||
inherit php phpPackages; |
||||
}; |
||||
in |
||||
import ./php-packages.nix { |
||||
inherit composerEnv noDev; |
||||
inherit (pkgs) fetchurl fetchgit fetchhg fetchsvn; |
||||
} |
||||
|
@ -0,0 +1,47 @@ |
||||
{ pkgs, stdenv, lib, fetchFromGitHub, dataDir ? "/var/lib/snipe-it" }: |
||||
|
||||
let |
||||
package = (import ./composition.nix { |
||||
inherit pkgs; |
||||
inherit (stdenv.hostPlatform) system; |
||||
noDev = true; # Disable development dependencies |
||||
# Requires PHP >= 7.4 and PHP < 8.0 as of v5.4.3 |
||||
# https://snipe-it.readme.io/docs/requirements |
||||
php = pkgs.php74; |
||||
phpPackages = pkgs.php74Packages; |
||||
}).overrideAttrs (attrs : { |
||||
installPhase = attrs.installPhase + '' |
||||
rm -R $out/storage $out/public/uploads $out/bootstrap/cache |
||||
ln -s ${dataDir}/.env $out/.env |
||||
ln -s ${dataDir}/storage $out/ |
||||
ln -s ${dataDir}/public/uploads $out/public/uploads |
||||
ln -s ${dataDir}/bootstrap/cache $out/bootstrap/cache |
||||
chmod +x $out/artisan |
||||
''; |
||||
}); |
||||
|
||||
in package.override rec { |
||||
pname = "snipe-it"; |
||||
version = "5.4.3"; |
||||
|
||||
src = fetchFromGitHub { |
||||
owner = "snipe"; |
||||
repo = pname; |
||||
rev = "v${version}"; |
||||
sha256 = "053cm5vb0806sj61g0zf0xqqzlchgkdj8zwkry07mhjdbp1k8k7n"; |
||||
}; |
||||
|
||||
meta = with lib; { |
||||
description = "A free open source IT asset/license management system "; |
||||
longDescription = '' |
||||
Snipe-IT was made for IT asset management, to enable IT departments to track |
||||
who has which laptop, when it was purchased, which software licenses and accessories |
||||
are available, and so on. |
||||
Details for snipe-it can be found on the official website at https://snipeitapp.com/. |
||||
''; |
||||
homepage = "https://snipeitapp.com/"; |
||||
license = licenses.agpl3Only; |
||||
maintainers = with maintainers; [ yayayayaka ]; |
||||
platforms = platforms.linux; |
||||
}; |
||||
} |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,50 @@ |
||||
#!/usr/bin/env nix-shell |
||||
#! nix-shell -i bash -p nix curl jq nix-update |
||||
|
||||
# check if composer2nix is installed |
||||
if ! command -v composer2nix &> /dev/null; then |
||||
echo "Please install composer2nix (https://github.com/svanderburg/composer2nix) to run this script." |
||||
exit 1 |
||||
fi |
||||
|
||||
CURRENT_VERSION=$(nix eval --raw '(with import ../../../.. {}; snipe-it.version)') |
||||
TARGET_VERSION_REMOTE=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/snipe/snipe-it/releases/latest | jq -r ".tag_name") |
||||
TARGET_VERSION=${TARGET_VERSION_REMOTE:1} |
||||
SNIPE_IT=https://github.com/snipe/snipe-it/raw/$TARGET_VERSION_REMOTE |
||||
SHA256=$(nix-prefetch-url --unpack "https://github.com/snipe/snipe-it/archive/v$TARGET_VERSION/snipe-it.tar.gz") |
||||
|
||||
if [[ "$CURRENT_VERSION" == "$TARGET_VERSION" ]]; then |
||||
echo "snipe-it is up-to-date: ${CURRENT_VERSION}" |
||||
exit 0 |
||||
fi |
||||
|
||||
curl -LO "$SNIPE_IT/composer.json" |
||||
curl -LO "$SNIPE_IT/composer.lock" |
||||
|
||||
composer2nix --name "snipe-it" \ |
||||
--composition=composition.nix \ |
||||
--no-dev |
||||
rm composer.json composer.lock |
||||
|
||||
# change version number |
||||
sed -e "s/version =.*;/version = \"$TARGET_VERSION\";/g" \ |
||||
-e "s/sha256 =.*;/sha256 = \"$SHA256\";/g" \ |
||||
-i ./default.nix |
||||
|
||||
# fix composer-env.nix |
||||
sed -e "s/stdenv\.lib/lib/g" \ |
||||
-e '3s/stdenv, writeTextFile/stdenv, lib, writeTextFile/' \ |
||||
-i ./composer-env.nix |
||||
|
||||
# fix composition.nix |
||||
sed -e '7s/stdenv writeTextFile/stdenv lib writeTextFile/' \ |
||||
-i composition.nix |
||||
|
||||
# fix missing newline |
||||
echo "" >> composition.nix |
||||
echo "" >> php-packages.nix |
||||
|
||||
cd ../../../.. |
||||
nix-build -A snipe-it |
||||
|
||||
exit $? |
@ -0,0 +1,67 @@ |
||||
{ lib |
||||
, mkDerivation |
||||
, fetchFromGitLab |
||||
, cmake |
||||
, extra-cmake-modules |
||||
, applet-window-buttons |
||||
, karchive |
||||
, kcoreaddons |
||||
, ki18n |
||||
, kio |
||||
, kirigami2 |
||||
, mauikit |
||||
, mauikit-accounts |
||||
, mauikit-filebrowsing |
||||
, mauikit-texteditor |
||||
, qtmultimedia |
||||
, qtquickcontrols2 |
||||
, kpeople |
||||
, kcontacts |
||||
}: |
||||
|
||||
mkDerivation rec { |
||||
pname = "communicator"; |
||||
version = "2.1.1"; |
||||
|
||||
src = fetchFromGitLab { |
||||
domain = "invent.kde.org"; |
||||
owner = "maui"; |
||||
repo = "communicator"; |
||||
rev = "v${version}"; |
||||
sha256 = "sha256-tHuFQgssZ6bohELx8tHrd4vvnrWixTyqCqK8WKJEdRE="; |
||||
}; |
||||
|
||||
nativeBuildInputs = [ |
||||
cmake |
||||
extra-cmake-modules |
||||
]; |
||||
|
||||
postPatch = '' |
||||
substituteInPlace CMakeLists.txt \ |
||||
--replace "/usr/share/maui-accounts/manifests" "$out/usr/share/maui-accounts/manifests" |
||||
''; |
||||
|
||||
buildInputs = [ |
||||
applet-window-buttons |
||||
karchive |
||||
kcoreaddons |
||||
ki18n |
||||
kio |
||||
kirigami2 |
||||
mauikit |
||||
mauikit-accounts |
||||
mauikit-filebrowsing |
||||
mauikit-texteditor |
||||
qtmultimedia |
||||
qtquickcontrols2 |
||||
kpeople |
||||
kcontacts |
||||
]; |
||||
|
||||
meta = with lib; { |
||||
description = "Contacts and dialer application"; |
||||
homepage = "https://invent.kde.org/maui/communicator"; |
||||
license = licenses.gpl3Plus; |
||||
maintainers = with maintainers; [ onny ]; |
||||
}; |
||||
} |
Loading…
Reference in new issue