5 Commits

9 changed files with 147 additions and 19515 deletions
-45
View File
@@ -1,45 +0,0 @@
####
# Target definitions
####
# Disable echoing of target recipe commands
# Comment this for debugging
.SILENT:
# Run target recipes in one shell invocation
.ONESHELL:
# Since all targets are phony, all targets should be listed here
# One target per line
.PHONY: boot-vm \
build-vm \
clean \
format-nix-files \
help
# Show the help text
help:
egrep -h '\s##\s' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
format-nix-files: ## Format nix files using the nixpkgs-fmt tool
find . -name "*.nix" -exec nixpkgs-fmt {} \;
clean: ## Clean build artifacts and shutdown running virtual machines
rm result > /dev/null 2>&1
rm nixos.qcow2 > /dev/null 2>&1
pkill qemu
exit 0
build-vm: clean ## Build virtual machine for testing
nix build ".#nixosConfigurations.test.config.system.build.vm"
boot-vm: ## Run virtual machine in current terminal
QEMU_KERNEL_PARAMS=console=ttyS0 \
QEMU_NET_OPTS=hostfwd=tcp::8080-:80 \
QEMU_OPTS=-nographic \
./result/bin/run-nixos-vm
reset
-13
View File
@@ -1,13 +0,0 @@
diff --git a/app/Console/Commands/CreateAccount.php b/app/Console/Commands/CreateAccount.php
index 228f8e8283..1ff3c54a61 100644
--- a/app/Console/Commands/CreateAccount.php
+++ b/app/Console/Commands/CreateAccount.php
@@ -79,7 +79,7 @@ class CreateAccount extends Command
$company->save();
$account->default_company_id = $company->id;
- $account->set_react_as_default_ap = true;
+ $account->set_react_as_default_ap = false;
$account->save();
$email = $this->option('email') ?? 'admin@example.com';
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
description = "An Invoice Ninja package and module."; description = "An Invoice Ninja package and module.";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
outputs = outputs =
{ self, nixpkgs, nix, }: { self, nixpkgs, nix, }:
+33
View File
@@ -0,0 +1,33 @@
set quiet := true
# Passed to QEMU in boot-vm
export QEMU_KERNEL_PARAMS := "console=ttyS0"
export QEMU_NET_OPTS := "hostfwd=tcp::8080-:80"
export QEMU_OPTS := "-nographic"
[private]
_default:
just --list
[doc('Clean build artifacts and shutdown running virtual machines')]
[group('maintenance')]
clean:
#!/usr/bin/env bash
rm result > /dev/null 2>&1
rm nixos.qcow2 > /dev/null 2>&1
pkill qemu
exit 0
[doc('Build virtual machine for testing')]
[group('main')]
build-vm: clean
nom build ".#nixosConfigurations.test.config.system.build.vm"
[doc('Run virtual machine in current terminal')]
[group('main')]
boot-vm:
#!/usr/bin/env bash
[ -x result/bin/run-nixos-vm ] && \
./result/bin/run-nixos-vm
reset
+30 -17
View File
@@ -498,28 +498,42 @@ in
addSSL = lib.mkForce (if (cfg.hostname == "localhost") then false else true); addSSL = lib.mkForce (if (cfg.hostname == "localhost") then false else true);
enableACME = lib.mkForce (if (cfg.hostname == "localhost") then false else true); enableACME = lib.mkForce (if (cfg.hostname == "localhost") then false else true);
locations = { locations = {
# Handle Laravel Routes
"/".tryFiles = "$uri $uri/ /index.php?$query_string"; "/".tryFiles = "$uri $uri/ /index.php?$query_string";
"/".extraConfig = ''
if (!-e $request_filename) { # PHP Processing
rewrite ^(.+)$ /index.php?q=$1 last; "~ \\.php$".extraConfig = ''
} include ${config.services.nginx.package}/conf/fastcgi_params;
add_header 'Access-Control-Allow-Origin' '*'; fastcgi_param SCRIPT_FILENAME $request_filename;
add_header 'Access-Control-Allow-Methods' '*'; fastcgi_split_path_info ^(.+\.php)(/.+)$;
add_header 'Access-Control-Max-Age' 0;
add_header 'Content-Length' 0;
add_header 'Access-Control-Allow-Headers' 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Disposition,Content-Type,Range,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
add_header 'Access-Control-Expose-Headers' 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
add_header 'Access-Control-Allow-Credentials' false;
'';
"~ \\.php$".extraConfig = "return 403;";
"= /index.php".extraConfig = ''
fastcgi_pass unix:${config.services.phpfpm.pools.invoiceninja.socket}; fastcgi_pass unix:${config.services.phpfpm.pools.invoiceninja.socket};
fastcgi_index index.php;
''; '';
# Security: Deny access to hidden files
"~ /\\.ht".extraConfig = "deny all;"; "~ /\\.ht".extraConfig = "deny all;";
# Static Files Caching
"~* \\.(jpg|jpeg|png|gif|ico|css|js)$".extraConfig = ''
expires 1y;
add_header Cache-Control "public, immutable";
'';
}; };
extraConfig = '' extraConfig = ''
index index.html index.htm index.php; index index.php index.html index.htm;
error_page 404 /index.php; error_page 404 /index.php;
if (!-e $request_filename) {
rewrite ^(.+)$ /index.php?q= last;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header 'Access-Control-Max-Age' 0;
add_header 'Content-Length' 0;
add_header 'Access-Control-Allow-Headers' 'X-API-COMPANY-KEY,X-API-SECRET,X-API-TOKEN,X-API-PASSWORD,DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Disposition,Content-Type,Range,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
add_header 'Access-Control-Expose-Headers' 'X-APP-VERSION,X-MINIMUM-CLIENT-VERSION,X-CSRF-TOKEN,X-XSRF-TOKEN,X-LIVEWIRE';
add_header 'Access-Control-Allow-Credentials' false;
''; '';
} }
(lib.mkIf (cfg.hostname != "localhost") { (lib.mkIf (cfg.hostname != "localhost") {
@@ -553,9 +567,8 @@ in
hostName = lib.mkForce proto_hostname; hostName = lib.mkForce proto_hostname;
extraConfig = '' extraConfig = ''
encode zstd gzip encode zstd gzip
root * ${invoiceninja}/public root ${invoiceninja}/public
php_fastcgi unix/${config.services.phpfpm.pools.invoiceninja.socket} php_fastcgi unix/${config.services.phpfpm.pools.invoiceninja.socket}
try_files {path} /index.html
header { header {
Access-Control-Allow-Origin "*" Access-Control-Allow-Origin "*"
Access-Control-Allow-Methods "*" Access-Control-Allow-Methods "*"
-19198
View File
File diff suppressed because it is too large Load Diff
-194
View File
@@ -1,194 +0,0 @@
{
"name": "@invoiceninja/ui",
"version": "03.05.2026.1",
"private": true,
"dependencies": {
"@azure/msal-browser": "^3.28.1",
"@docuninja/builder2.0": "^0.0.90",
"@emotion/styled": "^11.14.0",
"@excalidraw/excalidraw": "^0.18.0",
"@fontsource/alex-brush": "^5.2.6",
"@fontsource/dancing-script": "^5.2.6",
"@fontsource/great-vibes": "^5.2.6",
"@fontsource/pacifico": "^5.2.6",
"@fontsource/satisfy": "^5.2.6",
"@fortawesome/fontawesome-free": "^7.0.1",
"@headlessui/react": "^1.7.19",
"@headlessui/tailwindcss": "^0.2.2",
"@hello-pangea/dnd": "^16.6.0",
"@monaco-editor/react": "^4.7.0",
"@react-oauth/google": "^0.12.1",
"@reduxjs/toolkit": "^1.9.7",
"@sentry/react": "^7.120.3",
"@sentry/tracing": "^7.120.3",
"@stripe/stripe-js": "^4.10.0",
"@tinymce/tinymce-react": "^5.1.1",
"@tippyjs/react": "^4.2.6",
"@tiptap/extension-color": "^3.11.1",
"@tiptap/extension-font-family": "^3.11.1",
"@tiptap/extension-highlight": "^3.11.1",
"@tiptap/extension-image": "^3.12.1",
"@tiptap/extension-link": "^3.11.1",
"@tiptap/extension-placeholder": "^3.11.1",
"@tiptap/extension-strike": "^3.11.1",
"@tiptap/extension-subscript": "^3.11.1",
"@tiptap/extension-superscript": "^3.11.1",
"@tiptap/extension-table": "^3.11.1",
"@tiptap/extension-table-cell": "^3.11.1",
"@tiptap/extension-table-header": "^3.11.1",
"@tiptap/extension-table-row": "^3.11.1",
"@tiptap/extension-task-item": "^3.11.1",
"@tiptap/extension-task-list": "^3.11.1",
"@tiptap/extension-text-align": "^3.11.1",
"@tiptap/extension-underline": "^3.11.1",
"@tiptap/react": "^3.11.1",
"@tiptap/starter-kit": "^3.11.1",
"@types/js-beautify": "^1.14.3",
"antd": "^5.24.3",
"array-move": "^4.0.0",
"axios": "^1.8.3",
"classnames": "^2.5.1",
"collect.js": "^4.36.1",
"currency.js": "^2.0.4",
"dayjs": "^1.11.13",
"deep-object-diff": "^1.1.9",
"dompurify": "^3.2.4",
"dotenv": "^16.4.7",
"driver.js": "^1.4.0",
"font-awesome": "^4.7.0",
"formik": "^2.4.6",
"grapesjs": "^0.22.13",
"grapesjs-blocks-basic": "^1.0.2",
"grapesjs-parser-postcss": "^1.0.3",
"grapesjs-plugin-export": "^1.0.12",
"grapesjs-preset-webpage": "^1.0.3",
"grapesjs-style-bg": "^2.0.2",
"grapesjs-tui-image-editor": "^1.0.2",
"hex-color-regex": "^1.1.0",
"history": "^5.3.0",
"i18next": "^22.5.1",
"jotai": "^2.12.2",
"js-beautify": "^1.15.4",
"js-sha256": "^0.11.0",
"katex": "^0.16.22",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
"mitt": "^3.0.1",
"monaco-editor": "^0.53.0",
"papaparse": "^5.5.2",
"playwright": "^1.59.0",
"pretty-bytes": "^6.1.1",
"pusher-js": "^8.4.0",
"randexp": "^0.5.3",
"react": "^18.3.1",
"react-apple-signin-auth": "^1.1.0",
"react-colorful": "^5.6.1",
"react-date-range": "^1.4.0",
"react-datepicker": "^4.25.0",
"react-day-picker": "^9.10.0",
"react-debounce-input": "^3.3.0",
"react-dom": "^18.3.1",
"react-dropzone": "^14.3.8",
"react-feather": "^2.0.10",
"react-hot-toast": "^2.5.2",
"react-i18next": "^12.3.1",
"react-icons": "^4.12.0",
"react-image-crop": "^11.0.10",
"react-json-tree": "^0.20.0",
"react-markdown": "^10.1.0",
"react-number-format": "^5.4.3",
"react-phone-number-input": "^3.4.12",
"react-qr-code": "^2.0.15",
"react-query": "^3.39.3",
"react-redux": "^8.1.3",
"react-resizable-panels": "^2.1.7",
"react-responsive": "^9.0.2",
"react-router-dom": "^6.30.0",
"react-select": "^5.10.1",
"react-string-replace": "^1.1.1",
"react-turnstile": "^1.1.4",
"react-use": "^17.6.0",
"react-verification-input": "^3.3.1",
"recharts": "^2.15.1",
"rehype-raw": "^7.0.0",
"remove": "^0.1.5",
"sha256": "^0.2.0",
"signature_pad": "^5.0.10",
"socket.io-client": "^4.8.3",
"styled-components": "^6.1.15",
"tailwind-scrollbar": "^3.1.0",
"tiptap-extension-font-size": "^1.2.0",
"uuid": "^11.1.0",
"v": "^0.3.0",
"y-websocket": "^3.0.0",
"zustand": "^5.0.8"
},
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"format": "prettier --write src/",
"lint": "eslint src --max-warnings=0",
"test": "vitest run",
"test:watch": "vitest",
"prepare": "husky install",
"preview": "vite build && vite preview"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"@eslint/js": "^9.22.0",
"@faker-js/faker": "^9.0.0",
"@playwright/test": "^1.58.2",
"@tailwindcss/forms": "^0.5.10",
"@tailwindcss/typography": "^0.5.16",
"@types/dompurify": "^3.2.0",
"@types/hex-color-regex": "^1.1.3",
"@types/lodash": "^4.17.16",
"@types/lodash-es": "^4.17.12",
"@types/node": "^22.19.11",
"@types/papaparse": "^5.3.15",
"@types/prettier": "^2.7.3",
"@types/react": "^18.3.18",
"@types/react-date-range": "^1.4.10",
"@types/react-datepicker": "^4.19.6",
"@types/react-dom": "^18.3.5",
"@types/uuid": "^9.0.8",
"@vitejs/plugin-react": "^5.1.0",
"autoprefixer": "^10.4.21",
"eslint": "^9.22.0",
"eslint-plugin-react": "^7.37.4",
"eslint-plugin-unused-imports": "^4.1.4",
"globals": "^16.0.0",
"husky": "^8.0.3",
"postcss": "^8.5.3",
"prettier": "^2.8.8",
"tailwindcss": "^3.4.17",
"typescript": "^5.8.2",
"typescript-eslint": "^8.26.1",
"vite": "^7.3.1",
"vite-tsconfig-paths": "^6.1.0",
"vitest": "^4.0.18"
},
"engines": {
"node": ">=22"
},
"engineStrict": true,
"type": "module",
"overrides": {
"@docuninja/builder2.0": {
"react": "$react",
"react-dom": "$react-dom"
},
"socket.io-parser": "^4.2.6"
}
}
+79 -44
View File
@@ -1,46 +1,44 @@
{ buildNpmPackage { buildNpmPackage
, npmHooks
, fetchFromGitHub , fetchFromGitHub
, importNpmLock , fetchNpmDeps
, lib
, openssl
, php82 , php82
, nodejs_22 , nodejs_22
, symlinkJoin , npm-lockfile-fix
, writers
, dataDir ? "/var/lib/invoiceninja" , dataDir ? "/var/lib/invoiceninja"
, runtimeDir ? "/run/invoiceninja" , runtimeDir ? "/run/invoiceninja"
}: }:
let let
pname = "invoiceninja"; pname = "invoiceninja";
version = "5.13.19"; version = "5.13.19";
uiVersion = "03.05.2026.1";
src = fetchFromGitHub { src = fetchFromGitHub {
name = "${pname}";
owner = pname; owner = pname;
repo = pname; repo = pname;
rev = "v${version}"; rev = "v${version}";
hash = "sha256-PlFu9MQ4nZ2oHgSwOLffqERpZPIWkpgZ/qTqru63a9Y="; hash = "sha256-pvZNTiGGX6OqOEqcDrDqqpLD1Ohc/TA4nIRjm2jEp74=";
postFetch = ''
# add missing integrity fields to lockfile
${npm-lockfile-fix}/bin/npm-lockfile-fix $out/package-lock.json
'';
}; };
uiVersion = "03.05.2026.1";
uiSrc = fetchFromGitHub { uiSrc = fetchFromGitHub {
name = "${pname}-ui";
owner = pname; owner = pname;
repo = "ui"; repo = "ui";
tag = uiVersion; tag = uiVersion;
hash = "sha256-aEqYX/YNUV5UR631X4zQyqoXSSuUqvILplV8Mm557Bc="; hash = "sha256-BTaWNHTE+9NvavUYs56DdJHmqXy36N5k/crj3rU2Npg=";
postFetch = ''
# add missing integrity fields to lockfile
${npm-lockfile-fix}/bin/npm-lockfile-fix $out/package-lock.json
'';
}; };
# PHP composer
composer = php82.buildComposerProject (finalAttrs: {
inherit src version;
pname = "${pname}-composer";
vendorHash = "sha256-2CyWKlyCyoCt/WdY7Ta0oEXW2KIkGwhilHtzpBJ5Wnk=";
# Upstream composer.json has invalid license, webpatser/laravel-countries package is pointing
# to commit-ref, and php required in require and require-dev
composerStrictValidation = false;
postInstall = ''mv "$out/share/php/${finalAttrs.pname}"/* $out'';
});
# React frontend # React frontend
ui = buildNpmPackage { ui = buildNpmPackage {
@@ -50,35 +48,72 @@ let
nodejs = nodejs_22; nodejs = nodejs_22;
#npmDepsHash = "sha256-T2/0POKcr4x98cy3rfeNyTIBZrHuLfqpC1J6nymGcys="; npmDepsHash = "sha256-JA5TfXeg7iHVjQdjeU6SSD2JFSLISad8hPowaR1roQw=";
#npmPackFlags = [ "--ignore-scripts" ]; preConfigure = ''
#npmInstallFlags = [ "--omit=dev" ];
npmConfigHook = importNpmLock.npmConfigHook;
#npmDeps = importNpmLock {
# package = builtins.readFile ./. + "/package.json";
# packageLock = builtins.readFile ./. + "/package-lock.json";
#};
npmDeps = importNpmLock { npmRoot = ./.; };
prePatch = ''
sed -i 's/VITE_IS_TEST=true/VITE_IS_TEST=false/' .env.example sed -i 's/VITE_IS_TEST=true/VITE_IS_TEST=false/' .env.example
cp .env.example .env cp .env.example .env
cp ${src}/vite.config.ts.react ./vite.config.js
'';
# This will make the build output a single bundle file (bundle.[hash].js) installPhase = ''
cp ${composer}/vite.config.ts.react ./vite.config.js runHook preInstall
#${npm-lockfile-fix}/bin/npm-lockfile-fix ./package-lock.json mkdir $out
cp -a * $out
runHook postInstall
''; '';
}; };
in
invoiceNinja = symlinkJoin { php82.buildComposerProject (finalAttrs: {
name = "invoiceninja"; inherit src version;
paths = [ pname = "${pname}-composer";
composer
ui nativeBuildInputs = [
]; nodejs_22
npmHooks.npmConfigHook
npmHooks.npmBuildHook
];
vendorHash = "sha256-2CyWKlyCyoCt/WdY7Ta0oEXW2KIkGwhilHtzpBJ5Wnk=";
# Upstream composer.json has invalid license, webpatser/laravel-countries package is pointing
# to commit-ref, and php required in require and require-dev
composerStrictValidation = false;
CYPRESS_INSTALL_BINARY = 0;
npmDeps = fetchNpmDeps {
name = "${pname}-${version}-npm-deps";
inherit src;
hash = "sha256-WCadsQVj9eusYWJEOaEp5DIkVcbmPFGe6bmKi9NZDDg=";
}; };
in ui
preConfigure = ''
cp -r ${ui}/dist/* public/
cp public/index.html resources/views/react/index.blade.php
'';
postInstall = ''
mv "$out/share/php/${finalAttrs.pname}"/* $out
# Remove JS/CSS build artifacts
rm -rf $out/node_modules
rm -r $out/bootstrap/cache
rm -rf $out/public/storage
# Move static contents for the NixOS module to pick it up, if needed.
mv $out/bootstrap $out/bootstrap-static
mv $out/storage $out/storage-static
# Link NixOS module files to derivation output
ln -s ${dataDir}/.env $out/.env
ln -s ${dataDir}/storage $out/
ln -s ${dataDir}/storage/app/public $out/public/storage
ln -s ${runtimeDir} $out/bootstrap
'';
})
+4 -3
View File
@@ -1,4 +1,4 @@
{ modulesPath, ... }: { pkgs, modulesPath, ... }:
{ {
imports = [ imports = [
@@ -6,7 +6,7 @@
../nixos-module/invoiceninja.nix ../nixos-module/invoiceninja.nix
]; ];
system.stateVersion = "24.11"; system.stateVersion = "25.11";
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
@@ -18,9 +18,10 @@
services.invoiceninja = { services.invoiceninja = {
enable = true; enable = true;
proxy.server = "caddy"; proxy.server = "nginx";
adminAccount.passwordFile = ./invoice_ninja_test_password; adminAccount.passwordFile = ./invoice_ninja_test_password;
secretFile = ./test.env; secretFile = ./test.env;
settings.APP_DEBUG = true;
}; };
networking.firewall.enable = false; networking.firewall.enable = false;