From 2e39db1b95be4e5aa0e9a2c725483bace0ff2d0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20M=C3=A4urer?= Date: Thu, 2 Mar 2023 09:06:34 +0100 Subject: [PATCH 01/22] fix: Use regex replace pattern as empty is not supported --- .github/workflows/publish_docs_to_wiki.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml index 27b7f9a..f79a4c6 100644 --- a/.github/workflows/publish_docs_to_wiki.yml +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -16,8 +16,8 @@ jobs: - name: Replace .md for wiki compatibility uses: jacobtomlinson/gha-find-replace@v3 with: - find: "\\.md" - replace: "" + find: "/\\.md/" + replace: "$1" regex: true include: "docs/*.md" - name: Upload Docs to Wiki From 35ad88084e536b584e221147672d29bfc8d00be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20M=C3=A4urer?= Date: Thu, 2 Mar 2023 13:28:10 +0100 Subject: [PATCH 02/22] refactor: Guard only for publishing process in pipeline thus other steps are tested --- .github/workflows/publish_docs_to_wiki.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml index f79a4c6..2abd459 100644 --- a/.github/workflows/publish_docs_to_wiki.yml +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -5,8 +5,6 @@ on: paths: - docs/** - .github/workflows/publish_docs_to_wiki.yml - branches: - - main jobs: publish_docs_to_wiki: @@ -21,6 +19,7 @@ jobs: regex: true include: "docs/*.md" - name: Upload Docs to Wiki + if: github.ref_name == 'main' uses: docker://decathlon/wiki-page-creator-action:latest env: GH_PAT: ${{ secrets.WIKI_ACTION_TOKEN_ServiceUser }} From 740ab81aa4752f69b709451c477cf6007687c93f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sven=20M=C3=A4urer?= Date: Thu, 2 Mar 2023 14:43:14 +0100 Subject: [PATCH 03/22] fix: Adapt regex tested with act --- .github/workflows/publish_docs_to_wiki.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish_docs_to_wiki.yml b/.github/workflows/publish_docs_to_wiki.yml index 2abd459..e191794 100644 --- a/.github/workflows/publish_docs_to_wiki.yml +++ b/.github/workflows/publish_docs_to_wiki.yml @@ -14,7 +14,7 @@ jobs: - name: Replace .md for wiki compatibility uses: jacobtomlinson/gha-find-replace@v3 with: - find: "/\\.md/" + find: "\\.md" replace: "$1" regex: true include: "docs/*.md" From c2e047f58a6f337389c4fe3230b91fc387697d2e Mon Sep 17 00:00:00 2001 From: Jochen Manz Date: Thu, 2 Mar 2023 14:52:18 +0100 Subject: [PATCH 04/22] feat: Update .envrc files to devenv 0.6 --- .envrc | 7 ++----- examples/sw5/.envrc | 7 ++----- examples/sw6/.envrc | 7 ++----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/.envrc b/.envrc index 5ba4e1d..647ffc6 100644 --- a/.envrc +++ b/.envrc @@ -1,8 +1,5 @@ export NIXPKGS_ALLOW_UNFREE=1 -watch_file devenv.nix -watch_file devenv.yaml -watch_file devenv.lock -watch_file devenv.local.nix +source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" -eval "$(devenv print-dev-env)" +use devenv diff --git a/examples/sw5/.envrc b/examples/sw5/.envrc index 5ba4e1d..647ffc6 100644 --- a/examples/sw5/.envrc +++ b/examples/sw5/.envrc @@ -1,8 +1,5 @@ export NIXPKGS_ALLOW_UNFREE=1 -watch_file devenv.nix -watch_file devenv.yaml -watch_file devenv.lock -watch_file devenv.local.nix +source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" -eval "$(devenv print-dev-env)" +use devenv diff --git a/examples/sw6/.envrc b/examples/sw6/.envrc index 5ba4e1d..647ffc6 100644 --- a/examples/sw6/.envrc +++ b/examples/sw6/.envrc @@ -1,8 +1,5 @@ export NIXPKGS_ALLOW_UNFREE=1 -watch_file devenv.nix -watch_file devenv.yaml -watch_file devenv.lock -watch_file devenv.local.nix +source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" -eval "$(devenv print-dev-env)" +use devenv From 4f2060b61e9eebd60fd1305ab9ef6da2ff169e93 Mon Sep 17 00:00:00 2001 From: Jochen Manz Date: Thu, 2 Mar 2023 15:22:31 +0100 Subject: [PATCH 05/22] feat: move allow unfree to devenv.yml --- .editorconfig | 3 +++ .envrc | 2 -- devenv.yaml | 2 +- examples/sw5/.envrc | 2 -- examples/sw5/devenv.yaml | 19 ++++++++++--------- examples/sw6/.envrc | 2 -- examples/sw6/devenv.yaml | 1 + 7 files changed, 15 insertions(+), 16 deletions(-) diff --git a/.editorconfig b/.editorconfig index 67f7804..15f4603 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,6 +15,9 @@ insert_final_newline = true [*.yml] indent_size = 2 +[*.yaml] +indent_size = 2 + [*.nix] indent_size = 2 trim_trailing_whitespace = true diff --git a/.envrc b/.envrc index 647ffc6..bc011da 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1,3 @@ -export NIXPKGS_ALLOW_UNFREE=1 - source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" use devenv diff --git a/devenv.yaml b/devenv.yaml index 89709c7..4500117 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -1,3 +1,4 @@ +allowUnfree: true inputs: nixpkgs: url: github:NixOS/nixpkgs/nixos-unstable @@ -6,4 +7,3 @@ inputs: inputs: nixpkgs: follows: nixpkgs - diff --git a/examples/sw5/.envrc b/examples/sw5/.envrc index 647ffc6..bc011da 100644 --- a/examples/sw5/.envrc +++ b/examples/sw5/.envrc @@ -1,5 +1,3 @@ -export NIXPKGS_ALLOW_UNFREE=1 - source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" use devenv diff --git a/examples/sw5/devenv.yaml b/examples/sw5/devenv.yaml index abb05c5..cd5b5c7 100644 --- a/examples/sw5/devenv.yaml +++ b/examples/sw5/devenv.yaml @@ -1,12 +1,13 @@ +allowUnfree: true inputs: - kellerkinder: - url: git+https://github.com/kellerkinderDE/devenv-shopware - flake: false - phps: - url: github:fossar/nix-phps - inputs: - nixpkgs: - follows: nixpkgs -imports: + kellerkinder: + url: git+https://github.com/kellerkinderDE/devenv-shopware + flake: false + phps: + url: github:fossar/nix-phps + inputs: + nixpkgs: + follows: nixpkgs + imports: - kellerkinder diff --git a/examples/sw6/.envrc b/examples/sw6/.envrc index 647ffc6..bc011da 100644 --- a/examples/sw6/.envrc +++ b/examples/sw6/.envrc @@ -1,5 +1,3 @@ -export NIXPKGS_ALLOW_UNFREE=1 - source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" use devenv diff --git a/examples/sw6/devenv.yaml b/examples/sw6/devenv.yaml index 0bef97c..216a225 100644 --- a/examples/sw6/devenv.yaml +++ b/examples/sw6/devenv.yaml @@ -1,3 +1,4 @@ +allowUnfree: true inputs: kellerkinder: url: git+https://github.com/kellerkinderDE/devenv-shopware From 7dce400947315c31473f958b8fdc2879d102e95a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= <25648755+M-arcus@users.noreply.github.com> Date: Thu, 9 Mar 2023 19:55:24 +0100 Subject: [PATCH 06/22] Adds option to include packages not related to php --- devenv.nix | 9 ++++++++- docs/Options.md | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index 9e763db..3ed22f6 100644 --- a/devenv.nix +++ b/devenv.nix @@ -244,13 +244,20 @@ in { default = ""; description = ''Fallback redirect URL for media not found on local storage. Best for CDN purposes without downloading them.''; }; + + additionalPackages = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + example = [ pkgs.jpegoptim pkgs.optipng pkgs.gifsicle ]; + description = "Additional packages to be installed"; + }; }; config = lib.mkIf cfg.enable { packages = [ pkgs.jq pkgs.gnupatch - ]; + ] ++ cfg.additionalPackages; languages.javascript = { enable = lib.mkDefault true; diff --git a/docs/Options.md b/docs/Options.md index 3172189..3638c60 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -116,3 +116,11 @@ Fallback redirect URL for media not found on local storage. Best for CDN purpose ``` kellerkinder.fallbackRedirectMediaUrl = "https://my-cool-cdn-in-public-staging.example-cdn.com"; ``` + +# kellerkinder.additionalPackages +Define additional PHP extensions that are included in the devenv environment. + +*_Example_* +``` +kellerkinder.additionalPackages = [ pkgs.jpegoptim pkgs.optipng pkgs.gifsicle ]; +``` From ff7c7e86e344fea9a15697a48e30be1899693618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcus=20M=C3=BCller?= <25648755+M-arcus@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:46:44 +0200 Subject: [PATCH 07/22] Add REDIS_DSN to env vars if enabled --- devenv.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devenv.nix b/devenv.nix index 9e763db..4feffa7 100644 --- a/devenv.nix +++ b/devenv.nix @@ -422,6 +422,9 @@ in { (lib.mkIf config.services.rabbitmq.enable { RABBITMQ_NODENAME = "rabbit@localhost"; # 127.0.0.1 can't be used as rabbitmq can't set short node name }) + (lib.mkIf config.services.redis.enable { + REDIS_DSN = "redis://127.0.0.1:6379"; + }) ]; # Processes From 1dedc5cbf08aecb53dae03218838f68ffe5658d4 Mon Sep 17 00:00:00 2001 From: Jochen Manz Date: Tue, 28 Mar 2023 09:26:10 +0200 Subject: [PATCH 08/22] [NOTICKET] restructure files and wip caddy certificate handling --- .gitignore | 1 + devenv.lock | 30 ++-- devenv.nix | 333 ++------------------------------------- examples/sw5/devenv.yaml | 4 +- modules/caddy.nix | 98 ++++++++++++ modules/mysql.nix | 42 +++++ modules/php.nix | 91 +++++++++++ modules/scripts.nix | 142 +++++++++++++++++ 8 files changed, 403 insertions(+), 338 deletions(-) create mode 100644 modules/caddy.nix create mode 100644 modules/mysql.nix create mode 100644 modules/php.nix create mode 100644 modules/scripts.nix diff --git a/.gitignore b/.gitignore index 6506a66..6724501 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ # Devenv .devenv* +.direnv devenv.local.nix diff --git a/devenv.lock b/devenv.lock index ea072d0..67fcbe5 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1677721981, - "narHash": "sha256-vIXNwm98F2u5z9CLfWP72MJxaseVDBqnGhQGAFyxbLA=", + "lastModified": 1679514134, + "narHash": "sha256-x6wKyiOuJJW2phDbCpmSYjRlCe4Yva4r2nkqc7aNFsI=", "owner": "cachix", "repo": "devenv", - "rev": "8454b85158482d93dcc3f20b77fef5272313d127", + "rev": "a02418232d775e99ca349e1c8f71400aa1dd903c", "type": "github" }, "original": { @@ -103,11 +103,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1673800717, - "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { @@ -126,11 +126,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1677386056, - "narHash": "sha256-7zjqCeKW7YWjqR6EsUOqd2JzyCioYGVbbqmTgHTytBs=", + "lastModified": 1679508805, + "narHash": "sha256-WVByX40SpuNeOsELMoaqkhlj3VtJXv6oavv70uAJLvs=", "owner": "fossar", "repo": "nix-phps", - "rev": "98c16af0f9c329de8d62ef4817a5356c7685fffb", + "rev": "89a661b5450afa0633235347cc19b64e859d1cc7", "type": "github" }, "original": { @@ -150,11 +150,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1677722096, - "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=", + "lastModified": 1678976941, + "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b", + "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "type": "github" }, "original": { @@ -173,11 +173,11 @@ }, "utils": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { diff --git a/devenv.nix b/devenv.nix index 9e763db..da822d0 100644 --- a/devenv.nix +++ b/devenv.nix @@ -3,157 +3,14 @@ let cfg = config.kellerkinder; - phpConfig = lib.strings.concatStrings [ - '' - memory_limit = 2G - pdo_mysql.default_socket = ''${MYSQL_UNIX_PORT} - mysqli.default_socket = ''${MYSQL_UNIX_PORT} - blackfire.agent_socket = "${config.services.blackfire.socket}"; - realpath_cache_ttl = 3600 - session.gc_probability = 0 - display_errors = On - display_startup_errors = true - error_reporting = E_ALL - html_errors = true - assert.active = 0 - zend.detect_unicode = 0 - opcache.memory_consumption = 256M - opcache.interned_strings_buffer = 20 - opcache.enable_file_override = 1 - opcache.enable_cli = 1 - opcache.enabled = 1 - zend.assertions = 0 - short_open_tag = 0 - xdebug.mode = "debug" - xdebug.start_with_request = "trigger" - xdebug.discover_client_host = 1 - xdebug.var_display_max_depth = -1 - xdebug.var_display_max_data = -1 - xdebug.var_display_max_children = -1 - '' - cfg.additionalPhpConfig - ]; - - phpVersion = if builtins.hasAttr "PHP_VERSION" config.env then config.env.PHP_VERSION else cfg.phpVersion; - package = inputs.phps.packages.${builtins.currentSystem}.${phpVersion}; - - phpPackage = package.buildEnv { - extensions = { all, enabled }: with all; enabled - ++ (lib.optional config.services.redis.enable redis) - ++ (lib.optional config.services.blackfire.enable blackfire) - ++ (lib.optional config.services.rabbitmq.enable amqp) - ++ lib.attrsets.attrValues (lib.attrsets.getAttrs cfg.additionalPhpExtensions package.extensions); - extraConfig = phpConfig; - }; - - phpXdebug = package.buildEnv { - extensions = { all, enabled }: with all; enabled - ++ [ xdebug ] - ++ (lib.optional config.services.redis.enable redis) - ++ (lib.optional config.services.rabbitmq.enable amqp) - ++ lib.attrsets.attrValues (lib.attrsets.getAttrs cfg.additionalPhpExtensions package.extensions); - extraConfig = phpConfig; - }; - - entryScript = pkgs.writeScript "entryScript" '' - set -euo pipefail - - if [ ! -f $DEVENV_PROFILE/bin/mysqladmin ]; then - echo -e "mysqladmin missing, skips further entryscript processing" - ${pkgs.coreutils}/bin/sleep infinity - fi - - while ! $DEVENV_PROFILE/bin/mysqladmin ping --silent; do - ${pkgs.coreutils}/bin/sleep 1 - done - - while ! [[ $($DEVENV_PROFILE/bin/mysql shopware -s -N -e 'SHOW DATABASES LIKE "shopware";') ]] ; do - ${pkgs.coreutils}/bin/sleep 1 - done - - TABLE=$(mysql shopware -s -N -e 'SHOW TABLES LIKE "system_config";') - - if [[ $TABLE == "" ]]; then - echo "Table system_config is missing. Run >updateSystemConfig< manually to ensure the dev status of your setup!" - ${pkgs.coreutils}/bin/sleep infinity - fi - - ${scriptUpdateConfig} - - echo -e "Startup completed" - ${pkgs.coreutils}/bin/sleep infinity - ''; - - systemConfigEntries = lib.mapAttrsToList (name: value: { inherit name value; }) cfg.systemConfig; - - scriptUpdateConfig = pkgs.writeScript "scriptUpdateConfig" '' - VENDOR=${config.env.DEVENV_ROOT}/vendor/autoload.php - CONSOLE=${config.env.DEVENV_ROOT}/bin/console - - echo "Updating system config" - - if [ ! -f "$VENDOR" ] || [ ! -f "$CONSOLE" ]; then - echo "Vendor folder or console not found. Please run composer install." - exit 1 - fi - - # additional config - ${lib.concatMapStrings ({ name, value }: '' - $CONSOLE system:config:set ${name} ${value} || exit 1 - echo "System config ${name} set to ${value}" - '') systemConfigEntries} - - # default config - $CONSOLE system:config:set core.mailerSettings.emailAgent "" || exit 1 - echo "System config core.mailerSettings.emailAgent set to '''" - ''; - - importDbHelper = pkgs.writeScript "importDbHelper" '' - if [[ "$1" == "" ]]; then - echo "Please set devenv configuration for kellerkinder.importDatabaseDumps" - exit - fi - - if ! $DEVENV_PROFILE/bin/mysqladmin ping > /dev/null 2>&1; then - echo "MySQL server is dead or has gone away! devenv up?" - exit - fi - - TARGETFOLDER="${config.env.DEVENV_STATE}/importdb" - - rm -rf "$TARGETFOLDER" - set -e - - if [[ "$1" == *.sql ]]; then - ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql" - elif [[ "$1" == *.gz ]]; then - ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql.gz" - ${pkgs.gzip}/bin/gunzip -q -c "$TARGETFOLDER/latest.sql.gz" > "$TARGETFOLDER/dump.sql" - elif [[ "$1" == *.zip ]]; then - ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql.zip" - ${pkgs.unzip}/bin/unzip -qq -j -o "$TARGETFOLDER/latest.sql.zip" '*.sql' -d "$TARGETFOLDER" - else - echo "Unsupported file type for file at $1" - exit - fi - - rm -f "$TARGETFOLDER/latest.sql.*" - - SQL_FILE=$(find "$TARGETFOLDER" -name "*.sql" | head -n 1) - - if [[ "$SQL_FILE" == "" ]]; then - echo "No SQL file found" - exit - fi - - LANG=C LC_CTYPE=C LC_ALL=C ${pkgs.gnused}/bin/sed -i -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' "$SQL_FILE" - LANG=C LC_CTYPE=C LC_ALL=C ${pkgs.gnused}/bin/sed -i 's/NO_AUTO_CREATE_USER//' "$SQL_FILE" - - $DEVENV_PROFILE/bin/mysql shopware -f < "$SQL_FILE" - - echo "Import $1 finished!" - ''; + listEntries = path: + map (name: path + "/${name}") (builtins.attrNames (builtins.readDir path)); in { + imports = [ + (lib.mkRenamedOptionModule [ "kellerkinder" "additionalServerAlias" ] [ "kellerkinder" "domains" ]) + (lib.mkRenamedOptionModule [ "kellerkinder" "fallbackRedirectMediaUrl" ] [ "kellerkinder" "fallbackMediaUrl" ]) + ] ++ (listEntries ./modules); + options.kellerkinder = { enable = lib.mkOption { type = lib.types.bool; @@ -198,9 +55,9 @@ in { description = "Additional vhost configuration"; }; - additionalServerAlias = lib.mkOption { + domains = lib.mkOption { type = lib.types.listOf lib.types.str; - description = "Additional server alias"; + description = "Domains to be used for the vhost"; default = [ ]; example = [ "example.com" ]; }; @@ -239,7 +96,7 @@ in { description = ''Sets the matcher paths to be "ignored" by caddy''; }; - fallbackRedirectMediaUrl = lib.mkOption { + fallbackMediaUrl = lib.mkOption { type = lib.types.str; default = ""; description = ''Fallback redirect URL for media not found on local storage. Best for CDN purposes without downloading them.''; @@ -247,7 +104,7 @@ in { }; config = lib.mkIf cfg.enable { - packages = [ + packages = lib.mkDefault [ pkgs.jq pkgs.gnupatch ]; @@ -257,131 +114,6 @@ in { package = lib.mkDefault pkgs.nodejs-16_x; }; - languages.php = { - enable = lib.mkDefault true; - package = lib.mkDefault phpPackage; - - fpm.pools.web = { - settings = { - "clear_env" = "no"; - "pm" = "dynamic"; - "pm.max_children" = 10; - "pm.start_servers" = 2; - "pm.min_spare_servers" = 1; - "pm.max_spare_servers" = 10; - }; - }; - fpm.pools.web.phpPackage = lib.mkDefault phpPackage; - - fpm.pools.xdebug = { - settings = { - "clear_env" = "no"; - "pm" = "dynamic"; - "pm.max_children" = 10; - "pm.start_servers" = 2; - "pm.min_spare_servers" = 1; - "pm.max_spare_servers" = 10; - }; - }; - fpm.pools.xdebug.phpPackage = lib.mkDefault phpXdebug; - }; - - services.caddy = { - enable = lib.mkDefault true; - config = '' - { - auto_https disable_redirects - } - ''; - virtualHosts."127.0.0.1:8000" = lib.mkDefault { - serverAliases = cfg.additionalServerAlias; - extraConfig = lib.strings.concatStrings [ - '' - @default { - not path ${cfg.staticFilePaths} - not expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) - } - @debugger { - not path ${cfg.staticFilePaths} - expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) - } - - tls internal - - root * ${cfg.documentRoot} - - encode zstd gzip - - handle /media/* { - ${lib.strings.optionalString (cfg.fallbackRedirectMediaUrl != "") '' - @notStatic not file - redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackRedirectMediaUrl}{path} - ''} - file_server - } - - handle_errors { - respond "{err.status_code} {err.status_text}" - } - - handle { - php_fastcgi @default unix/${config.languages.php.fpm.pools.web.socket} { - trusted_proxies private_ranges - } - - php_fastcgi @debugger unix/${config.languages.php.fpm.pools.xdebug.socket} { - trusted_proxies private_ranges - } - - file_server - } - - log { - output stderr - format console - level ERROR - } - '' - cfg.additionalVhostConfig - ]; - }; - }; - - services.mysql = { - enable = lib.mkDefault true; - initialDatabases = lib.mkDefault [{ name = "shopware"; }]; - ensureUsers = lib.mkDefault [{ - name = "shopware"; - password = "shopware"; - ensurePermissions = { "*.*" = "ALL PRIVILEGES"; }; - }]; - settings = { - mysqld = { - group_concat_max_len = 2048; - key_buffer_size = 16777216; - max_allowed_packet = 134217728; - sync_binlog = 0; - table_open_cache = 1024; - log_bin_trust_function_creators = 1; - }; - mysql = { - user = "shopware"; - password = "shopware"; - host = "127.0.0.1"; - }; - mysqldump = { - user = "shopware"; - password = "shopware"; - host = "127.0.0.1"; - }; - mysqladmin = { - user = "shopware"; - password = "shopware"; - host = "127.0.0.1"; - }; - }; - }; - services.redis.enable = lib.mkDefault true; services.adminer.enable = lib.mkDefault true; @@ -421,49 +153,8 @@ in { }) (lib.mkIf config.services.rabbitmq.enable { RABBITMQ_NODENAME = "rabbit@localhost"; # 127.0.0.1 can't be used as rabbitmq can't set short node name + MESSENGER_TRANSPORT_DSN = "amqp://guest:guest@localhost:5672/%2f"; }) ]; - - # Processes - processes.entryscript.exec = "${entryScript}"; - - # Config related scripts - scripts.updateSystemConfig.exec = '' - ${scriptUpdateConfig} - ''; - - # Symfony related scripts - scripts.cc.exec = '' - CONSOLE=${config.env.DEVENV_ROOT}/bin/console - - if test -f "$CONSOLE"; then - exec $CONSOLE cache:clear - fi - ''; - - scripts.uuid.exec = '' - ${pkgs.toybox}/bin/uuidgen | tr "[:upper:]" "[:lower:]" | sed 's/-//g' - ''; - - scripts.debug.exec = '' - XDEBUG_SESSION=1 ${phpXdebug}/bin/php "$@" - ''; - - scripts.importdb.exec = '' - echo "Are you sure you want to download SQL files and overwrite the existing database with their data (y/n)?" - read answer - - if [[ "$answer" != "y" ]]; then - echo "Alright, we will stop here." - exit - fi - - ${lib.concatMapStrings (dump: '' - echo "Importing ${dump}" - ${importDbHelper} ${dump} - '') cfg.importDatabaseDumps} - - ${scriptUpdateConfig} - ''; }; } diff --git a/examples/sw5/devenv.yaml b/examples/sw5/devenv.yaml index cd5b5c7..216a225 100644 --- a/examples/sw5/devenv.yaml +++ b/examples/sw5/devenv.yaml @@ -8,6 +8,6 @@ inputs: inputs: nixpkgs: follows: nixpkgs - imports: - - kellerkinder +imports: + - kellerkinder diff --git a/modules/caddy.nix b/modules/caddy.nix new file mode 100644 index 0000000..7a05aa1 --- /dev/null +++ b/modules/caddy.nix @@ -0,0 +1,98 @@ +{ pkgs, config, inputs, lib, ... }: + +let + cfg = config.kellerkinder; + + mappedHosts = lib.mapAttrsToList (name: value: { inherit name; }) cfg.domains; + + vhostDomains = cfg.domains ++ [ "127.0.0.1" ]; + + vhostConfig = lib.strings.concatStrings [ + '' + @default { + not path ${cfg.staticFilePaths} + not expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) + } + @debugger { + not path ${cfg.staticFilePaths} + expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) + } + + root * ${cfg.documentRoot} + + encode zstd gzip + + handle /media/* { + ${lib.strings.optionalString (cfg.fallbackMediaUrl != "") '' + @notStatic not file + redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackMediaUrl}{path} + ''} + file_server + } + + handle_errors { + respond "{err.status_code} {err.status_text}" + } + + handle { + php_fastcgi @default unix/${config.languages.php.fpm.pools.web.socket} { + trusted_proxies private_ranges + index shopware.php index.php + } + + php_fastcgi @debugger unix/${config.languages.php.fpm.pools.xdebug.socket} { + trusted_proxies private_ranges + index shopware.php index.php + } + + file_server + } + + log { + output stderr + format console + level ERROR + } + '' + cfg.additionalVhostConfig + ]; + + vhostConfigSSL = lib.strings.concatStrings [ + '' + tls ${config.env.DEVENV_STATE}/mkcert/%DOMAIN%.pem ${config.env.DEVENV_STATE}/mkcert/%DOMAIN%-key.pem + '' + vhostConfig + ]; +in { + config = lib.mkIf cfg.enable { + hosts = { + "example.com" = "127.0.0.1"; + }; + + certificates = [ "127.0.0.1" ] ++ cfg.domains; + + services.caddy = { + enable = lib.mkDefault true; + virtualHosts = lib.mkMerge [ + (lib.concatMapStrings + (domain: { + "${domain}:80" = lib.mkDefault { + enable = true; + extraConfig = vhostConfig; + }; + }) + vhostDomains + ) + (lib.concatMapStrings + (domain: { + "${domain}:443" = lib.mkDefault { + enable = true; + extraConfig = lib.replaceStrings [ "%DOMAIN%" domain ] vhostConfigSSL; + }; + }) + vhostDomains + ) + ]; + }; + }; +} diff --git a/modules/mysql.nix b/modules/mysql.nix new file mode 100644 index 0000000..570eea9 --- /dev/null +++ b/modules/mysql.nix @@ -0,0 +1,42 @@ +{ pkgs, config, inputs, lib, ... }: + +let + cfg = config.kellerkinder; +in { + config = lib.mkIf cfg.enable { + services.mysql = { + enable = lib.mkDefault true; + initialDatabases = lib.mkDefault [{ name = "shopware"; }]; + ensureUsers = lib.mkDefault [{ + name = "shopware"; + password = "shopware"; + ensurePermissions = { "*.*" = "ALL PRIVILEGES"; }; + }]; + settings = { + mysqld = { + group_concat_max_len = 2048; + key_buffer_size = 16777216; + max_allowed_packet = 134217728; + sync_binlog = 0; + table_open_cache = 1024; + log_bin_trust_function_creators = 1; + }; + mysql = { + user = "shopware"; + password = "shopware"; + host = "127.0.0.1"; + }; + mysqldump = { + user = "shopware"; + password = "shopware"; + host = "127.0.0.1"; + }; + mysqladmin = { + user = "shopware"; + password = "shopware"; + host = "127.0.0.1"; + }; + }; + }; + }; +} diff --git a/modules/php.nix b/modules/php.nix new file mode 100644 index 0000000..3037e7e --- /dev/null +++ b/modules/php.nix @@ -0,0 +1,91 @@ +{ pkgs, config, inputs, lib, ... }: + +let + cfg = config.kellerkinder; + + phpConfig = lib.strings.concatStrings [ + '' + memory_limit = 2G + pdo_mysql.default_socket = ''${MYSQL_UNIX_PORT} + mysqli.default_socket = ''${MYSQL_UNIX_PORT} + blackfire.agent_socket = "${config.services.blackfire.socket}"; + realpath_cache_ttl = 3600 + session.gc_probability = 0 + display_errors = On + display_startup_errors = true + error_reporting = E_ALL + html_errors = true + assert.active = 0 + zend.detect_unicode = 0 + opcache.memory_consumption = 256M + opcache.interned_strings_buffer = 20 + opcache.enable_cli = 1 + opcache.enabled = 1 + zend.assertions = 0 + short_open_tag = 0 + xdebug.mode = "debug" + xdebug.start_with_request = "trigger" + xdebug.discover_client_host = 1 + xdebug.var_display_max_depth = -1 + xdebug.var_display_max_data = -1 + xdebug.var_display_max_children = -1 + '' + cfg.additionalPhpConfig + ]; + + phpVersion = if builtins.hasAttr "PHP_VERSION" config.env then config.env.PHP_VERSION else cfg.phpVersion; + package = inputs.phps.packages.${builtins.currentSystem}.${phpVersion}; + + phpPackage = package.buildEnv { + extensions = { all, enabled }: with all; enabled + ++ (lib.optional config.services.redis.enable redis) + ++ (lib.optional config.services.blackfire.enable blackfire) + ++ (lib.optional config.services.rabbitmq.enable amqp) + ++ lib.attrsets.attrValues (lib.attrsets.getAttrs cfg.additionalPhpExtensions package.extensions); + extraConfig = phpConfig; + }; + + phpXdebug = package.buildEnv { + extensions = { all, enabled }: with all; enabled + ++ [ xdebug ] + ++ (lib.optional config.services.redis.enable redis) + ++ (lib.optional config.services.rabbitmq.enable amqp) + ++ lib.attrsets.attrValues (lib.attrsets.getAttrs cfg.additionalPhpExtensions package.extensions); + extraConfig = phpConfig; + }; +in { + config = lib.mkIf cfg.enable { + languages.php = { + enable = lib.mkDefault true; + package = lib.mkDefault phpPackage; + + fpm.pools.web = { + settings = { + "clear_env" = "no"; + "pm" = "dynamic"; + "pm.max_children" = 10; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 1; + "pm.max_spare_servers" = 10; + }; + }; + fpm.pools.web.phpPackage = lib.mkDefault phpPackage; + + fpm.pools.xdebug = { + settings = { + "clear_env" = "no"; + "pm" = "dynamic"; + "pm.max_children" = 10; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 1; + "pm.max_spare_servers" = 10; + }; + }; + fpm.pools.xdebug.phpPackage = lib.mkDefault phpXdebug; + }; + + scripts.debug.exec = '' + XDEBUG_SESSION=1 ${phpXdebug}/bin/php "$@" + ''; + }; +} diff --git a/modules/scripts.nix b/modules/scripts.nix new file mode 100644 index 0000000..def1af6 --- /dev/null +++ b/modules/scripts.nix @@ -0,0 +1,142 @@ +{ pkgs, config, inputs, lib, ... }: + +let + cfg = config.kellerkinder; + + entryScript = pkgs.writeScript "entryScript" '' + set -euo pipefail + + if [ ! -f $DEVENV_PROFILE/bin/mysqladmin ]; then + echo -e "mysqladmin missing, skips further entryscript processing" + ${pkgs.coreutils}/bin/sleep infinity + fi + + while ! $DEVENV_PROFILE/bin/mysqladmin ping --silent; do + ${pkgs.coreutils}/bin/sleep 1 + done + + while ! [[ $($DEVENV_PROFILE/bin/mysql shopware -s -N -e 'SHOW DATABASES LIKE "shopware";') ]] ; do + ${pkgs.coreutils}/bin/sleep 1 + done + + TABLE=$(mysql shopware -s -N -e 'SHOW TABLES LIKE "system_config";') + + if [[ $TABLE == "" ]]; then + echo "Table system_config is missing. Run >updateSystemConfig< manually to ensure the dev status of your setup!" + ${pkgs.coreutils}/bin/sleep infinity + fi + + ${scriptUpdateConfig} + + echo -e "Startup completed" + ${pkgs.coreutils}/bin/sleep infinity + ''; + + systemConfigEntries = lib.mapAttrsToList (name: value: { inherit name value; }) cfg.systemConfig; + + scriptUpdateConfig = pkgs.writeScript "scriptUpdateConfig" '' + VENDOR=${config.env.DEVENV_ROOT}/vendor/autoload.php + CONSOLE=${config.env.DEVENV_ROOT}/bin/console + + echo "Updating system config" + + if [ ! -f "$VENDOR" ] || [ ! -f "$CONSOLE" ]; then + echo "Vendor folder or console not found. Please run composer install." + exit 1 + fi + + # additional config + ${lib.concatMapStrings ({ name, value }: '' + $CONSOLE system:config:set ${name} ${value} || exit 1 + echo "System config ${name} set to ${value}" + '') systemConfigEntries} + + # default config + $CONSOLE system:config:set core.mailerSettings.emailAgent "" || exit 1 + echo "System config core.mailerSettings.emailAgent set to '''" + ''; + + importDbHelper = pkgs.writeScript "importDbHelper" '' + if [[ "$1" == "" ]]; then + echo "Please set devenv configuration for kellerkinder.importDatabaseDumps" + exit + fi + + if ! $DEVENV_PROFILE/bin/mysqladmin ping > /dev/null 2>&1; then + echo "MySQL server is dead or has gone away! devenv up?" + exit + fi + + TARGETFOLDER="${config.env.DEVENV_STATE}/importdb" + + rm -rf "$TARGETFOLDER" + set -e + + if [[ "$1" == *.sql ]]; then + ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql" + elif [[ "$1" == *.gz ]]; then + ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql.gz" + ${pkgs.gzip}/bin/gunzip -q -c "$TARGETFOLDER/latest.sql.gz" > "$TARGETFOLDER/dump.sql" + elif [[ "$1" == *.zip ]]; then + ${pkgs.curl}/bin/curl -s --create-dirs "$1" --output "$TARGETFOLDER/latest.sql.zip" + ${pkgs.unzip}/bin/unzip -qq -j -o "$TARGETFOLDER/latest.sql.zip" '*.sql' -d "$TARGETFOLDER" + else + echo "Unsupported file type for file at $1" + exit + fi + + rm -f "$TARGETFOLDER/latest.sql.*" + + SQL_FILE=$(find "$TARGETFOLDER" -name "*.sql" | head -n 1) + + if [[ "$SQL_FILE" == "" ]]; then + echo "No SQL file found" + exit + fi + + LANG=C LC_CTYPE=C LC_ALL=C ${pkgs.gnused}/bin/sed -i -e 's/DEFINER[ ]*=[ ]*[^*]*\*/\*/' "$SQL_FILE" + LANG=C LC_CTYPE=C LC_ALL=C ${pkgs.gnused}/bin/sed -i 's/NO_AUTO_CREATE_USER//' "$SQL_FILE" + + $DEVENV_PROFILE/bin/mysql shopware -f < "$SQL_FILE" + + echo "Import $1 finished!" + ''; +in { + # Config related scripts + scripts.updateSystemConfig.exec = '' + ${scriptUpdateConfig} + ''; + + # Symfony related scripts + scripts.cc.exec = '' + CONSOLE=${config.env.DEVENV_ROOT}/bin/console + + if test -f "$CONSOLE"; then + exec $CONSOLE cache:clear + fi + ''; + + scripts.uuid.exec = '' + ${pkgs.toybox}/bin/uuidgen | tr "[:upper:]" "[:lower:]" | sed 's/-//g' + ''; + + scripts.importdb.exec = '' + echo "Are you sure you want to download SQL files and overwrite the existing database with their data (y/n)?" + read answer + + if [[ "$answer" != "y" ]]; then + echo "Alright, we will stop here." + exit + fi + + ${lib.concatMapStrings (dump: '' + echo "Importing ${dump}" + ${importDbHelper} ${dump} + '') cfg.importDatabaseDumps} + + ${scriptUpdateConfig} + ''; + + # Processes + processes.entryscript.exec = "${entryScript}"; +} From 4b612451a08177d249b545d03f39e7592697bd2e Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Tue, 28 Mar 2023 09:44:04 +0200 Subject: [PATCH 09/22] feat: [noticket] Update devenv config to v0.6.2 * Add .direnv to ignored fiels * Adjusted editorconfig * Updated envrc * Updated lock file --- .editorconfig | 12 +----------- .envrc | 2 +- .gitignore | 3 ++- devenv.lock | 36 ++++++++++++++++++------------------ devenv.yaml | 1 + 5 files changed, 23 insertions(+), 31 deletions(-) diff --git a/.editorconfig b/.editorconfig index 15f4603..f9c618f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,20 +7,10 @@ root = true [*] end_of_line = lf indent_style = space -indent_size = 4 +indent_size = 2 charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true -[*.yml] -indent_size = 2 - -[*.yaml] -indent_size = 2 - -[*.nix] -indent_size = 2 -trim_trailing_whitespace = true - [*.md] trim_trailing_whitespace = false diff --git a/.envrc b/.envrc index bc011da..f7dc1eb 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,3 @@ -source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" +source_url "https://raw.githubusercontent.com/cachix/devenv/v0.6.2/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" use devenv diff --git a/.gitignore b/.gitignore index 6506a66..8229628 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .idea # Devenv -.devenv* +/.devenv* +/.direnv devenv.local.nix diff --git a/devenv.lock b/devenv.lock index ea072d0..ae43c0d 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1677721981, - "narHash": "sha256-vIXNwm98F2u5z9CLfWP72MJxaseVDBqnGhQGAFyxbLA=", + "lastModified": 1679700890, + "narHash": "sha256-u8GqQF/z57LaDf5x/O3IC5qtvwwhLtak+kWosp51F2w=", "owner": "cachix", "repo": "devenv", - "rev": "8454b85158482d93dcc3f20b77fef5272313d127", + "rev": "c9ff5bd489ca36a526e46440fec4d10a87988363", "type": "github" }, "original": { @@ -87,11 +87,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1677587185, - "narHash": "sha256-zYT66MAYwctAQqI5VBw3LbBXiSKdB8vuMAqCGG8onbE=", + "lastModified": 1679865578, + "narHash": "sha256-sYQmxxqIYL3QFsRYjW0AufhGur8qWfwoOGPGHRJZlGc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "68196a61c26748d3e53a6803de3d2f8c69f27831", + "rev": "4361baa782dc3d3b35fd455a1adc370681d9187c", "type": "github" }, "original": { @@ -103,11 +103,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1673800717, - "narHash": "sha256-SFHraUqLSu5cC6IxTprex/nTsI81ZQAtDvlBvGDWfnA=", + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "2f9fd351ec37f5d479556cd48be4ca340da59b8f", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", "type": "github" }, "original": { @@ -126,11 +126,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1677386056, - "narHash": "sha256-7zjqCeKW7YWjqR6EsUOqd2JzyCioYGVbbqmTgHTytBs=", + "lastModified": 1679845767, + "narHash": "sha256-TjSqtZCZlCAC/I97D0/gQw+tvGQj/b5EVAL50G+RnYo=", "owner": "fossar", "repo": "nix-phps", - "rev": "98c16af0f9c329de8d62ef4817a5356c7685fffb", + "rev": "a332e59b2868773143cf8db803de04077a84664b", "type": "github" }, "original": { @@ -150,11 +150,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1677722096, - "narHash": "sha256-7mjVMvCs9InnrRybBfr5ohqcOz+pyEX8m22C1XsDilg=", + "lastModified": 1678976941, + "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "61a3511668891c68ebd19d40122150b98dc2fe3b", + "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", "type": "github" }, "original": { @@ -173,11 +173,11 @@ }, "utils": { "locked": { - "lastModified": 1676283394, - "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "lastModified": 1678901627, + "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", "owner": "numtide", "repo": "flake-utils", - "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", "type": "github" }, "original": { diff --git a/devenv.yaml b/devenv.yaml index 4500117..672f3be 100644 --- a/devenv.yaml +++ b/devenv.yaml @@ -1,4 +1,5 @@ allowUnfree: true + inputs: nixpkgs: url: github:NixOS/nixpkgs/nixos-unstable From f01d0583fa4c28485513569fa551033e8f21c772 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Tue, 28 Mar 2023 09:56:55 +0200 Subject: [PATCH 10/22] feat: [noticket] Add multiple devenv files to watch --- .envrc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.envrc b/.envrc index f7dc1eb..dfffb56 100644 --- a/.envrc +++ b/.envrc @@ -1,3 +1,8 @@ source_url "https://raw.githubusercontent.com/cachix/devenv/v0.6.2/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" +nix_direnv_watch_file devenv.nix +nix_direnv_watch_file devenv.lock +nix_direnv_watch_file devenv.yaml +nix_direnv_watch_file devenv.local.nix + use devenv From 3ec7b48b1e360b4af14616bf1c79316d5c892009 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Tue, 28 Mar 2023 10:18:16 +0200 Subject: [PATCH 11/22] feat: [noticket] Update example files --- examples/sw5/.envrc | 7 ++++++- examples/sw5/devenv.yaml | 5 ++--- examples/sw6/.envrc | 7 ++++++- examples/sw6/devenv.yaml | 5 ++--- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/examples/sw5/.envrc b/examples/sw5/.envrc index bc011da..dfffb56 100644 --- a/examples/sw5/.envrc +++ b/examples/sw5/.envrc @@ -1,3 +1,8 @@ -source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" +source_url "https://raw.githubusercontent.com/cachix/devenv/v0.6.2/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" + +nix_direnv_watch_file devenv.nix +nix_direnv_watch_file devenv.lock +nix_direnv_watch_file devenv.yaml +nix_direnv_watch_file devenv.local.nix use devenv diff --git a/examples/sw5/devenv.yaml b/examples/sw5/devenv.yaml index cd5b5c7..2d1fee3 100644 --- a/examples/sw5/devenv.yaml +++ b/examples/sw5/devenv.yaml @@ -1,4 +1,6 @@ allowUnfree: true +imports: + - kellerkinder inputs: kellerkinder: url: git+https://github.com/kellerkinderDE/devenv-shopware @@ -8,6 +10,3 @@ inputs: inputs: nixpkgs: follows: nixpkgs - imports: - - kellerkinder - diff --git a/examples/sw6/.envrc b/examples/sw6/.envrc index bc011da..dfffb56 100644 --- a/examples/sw6/.envrc +++ b/examples/sw6/.envrc @@ -1,3 +1,8 @@ -source_url "https://raw.githubusercontent.com/cachix/devenv/5811f4817ba24da923506d134fff2610b8f95ff2/direnvrc" "sha256-IN2rc7pbaBxxjcdIpYOe9lkpiyjSr2V2AwF6KwlnWYQ=" +source_url "https://raw.githubusercontent.com/cachix/devenv/v0.6.2/direnvrc" "sha256-YBzqskFZxmNb3kYVoKD9ZixoPXJh1C9ZvTLGFRkauZ0=" + +nix_direnv_watch_file devenv.nix +nix_direnv_watch_file devenv.lock +nix_direnv_watch_file devenv.yaml +nix_direnv_watch_file devenv.local.nix use devenv diff --git a/examples/sw6/devenv.yaml b/examples/sw6/devenv.yaml index 216a225..2d1fee3 100644 --- a/examples/sw6/devenv.yaml +++ b/examples/sw6/devenv.yaml @@ -1,4 +1,6 @@ allowUnfree: true +imports: + - kellerkinder inputs: kellerkinder: url: git+https://github.com/kellerkinderDE/devenv-shopware @@ -8,6 +10,3 @@ inputs: inputs: nixpkgs: follows: nixpkgs -imports: - - kellerkinder - From 5328115d827ce33f5f29a93acf2b48c7e7946af3 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Wed, 29 Mar 2023 10:29:01 +0200 Subject: [PATCH 12/22] fix: [noticket] Straightening the structural adjustments to restore the runnability - Deposit of the last changes from main-usage - Update docs according to changes --- devenv.nix | 11 ++-- docs/Options.md | 4 +- modules/caddy.nix | 134 ++++++++++++++++++---------------------------- modules/php.nix | 1 + 4 files changed, 62 insertions(+), 88 deletions(-) diff --git a/devenv.nix b/devenv.nix index 125872b..1486320 100644 --- a/devenv.nix +++ b/devenv.nix @@ -120,18 +120,18 @@ in { package = lib.mkDefault pkgs.nodejs-16_x; }; - services.redis.enable = lib.mkDefault true; - services.adminer.enable = lib.mkDefault true; services.adminer.listen = lib.mkDefault "127.0.0.1:8010"; - services.mailhog.enable = true; - services.elasticsearch.enable = cfg.enableElasticsearch; + services.mailhog.enable = true; + services.rabbitmq.enable = cfg.enableRabbitMq; services.rabbitmq.managementPlugin.enable = cfg.enableRabbitMq; + services.redis.enable = lib.mkDefault true; + # Environment variables env = lib.mkMerge [ (lib.mkIf cfg.enable { @@ -161,6 +161,9 @@ in { RABBITMQ_NODENAME = "rabbit@localhost"; # 127.0.0.1 can't be used as rabbitmq can't set short node name MESSENGER_TRANSPORT_DSN = "amqp://guest:guest@localhost:5672/%2f"; }) + (lib.mkIf config.services.redis.enable { + REDIS_DSN = "redis://127.0.0.1:6379"; + }) ]; }; } diff --git a/docs/Options.md b/docs/Options.md index 3638c60..59e6679 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -41,7 +41,7 @@ Define additional server aliases that are added to caddy. *_Example_* ``` -kellerkinder.additionalServerAlias = [ +kellerkinder.domains = [ "example.com" ]; ``` @@ -114,7 +114,7 @@ Fallback redirect URL for media not found on local storage. Best for CDN purpose *_Example_* ``` -kellerkinder.fallbackRedirectMediaUrl = "https://my-cool-cdn-in-public-staging.example-cdn.com"; +kellerkinder.fallbackMediaUrl = "https://my-cool-cdn-in-public-staging.example-cdn.com"; ``` # kellerkinder.additionalPackages diff --git a/modules/caddy.nix b/modules/caddy.nix index 7a05aa1..47cb15f 100644 --- a/modules/caddy.nix +++ b/modules/caddy.nix @@ -2,97 +2,67 @@ let cfg = config.kellerkinder; +in { + config = lib.mkIf cfg.enable { + services.caddy = { + enable = lib.mkDefault true; + config = '' + { + auto_https disable_redirects + } + ''; + virtualHosts."127.0.0.1:8000" = lib.mkDefault { + serverAliases = cfg.domains; + extraConfig = lib.strings.concatStrings [ + '' + @default { + not path ${cfg.staticFilePaths} + not expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) + } + @debugger { + not path ${cfg.staticFilePaths} + expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) + } - mappedHosts = lib.mapAttrsToList (name: value: { inherit name; }) cfg.domains; - - vhostDomains = cfg.domains ++ [ "127.0.0.1" ]; - - vhostConfig = lib.strings.concatStrings [ - '' - @default { - not path ${cfg.staticFilePaths} - not expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) - } - @debugger { - not path ${cfg.staticFilePaths} - expression header_regexp('xdebug', 'Cookie', 'XDEBUG_SESSION') || query({'XDEBUG_SESSION': '*'}) - } - - root * ${cfg.documentRoot} - - encode zstd gzip - - handle /media/* { - ${lib.strings.optionalString (cfg.fallbackMediaUrl != "") '' - @notStatic not file - redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackMediaUrl}{path} - ''} - file_server - } + tls internal - handle_errors { - respond "{err.status_code} {err.status_text}" - } + root * ${cfg.documentRoot} - handle { - php_fastcgi @default unix/${config.languages.php.fpm.pools.web.socket} { - trusted_proxies private_ranges - index shopware.php index.php - } + encode zstd gzip - php_fastcgi @debugger unix/${config.languages.php.fpm.pools.xdebug.socket} { - trusted_proxies private_ranges - index shopware.php index.php - } + handle /media/* { + ${lib.strings.optionalString (cfg.fallbackRedirectMediaUrl != "") '' + @notStatic not file + redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackRedirectMediaUrl}{path} + ''} + file_server + } - file_server - } + handle_errors { + respond "{err.status_code} {err.status_text}" + } - log { - output stderr - format console - level ERROR - } - '' - cfg.additionalVhostConfig - ]; + handle { + php_fastcgi @default unix/${config.languages.php.fpm.pools.web.socket} { + trusted_proxies private_ranges + } - vhostConfigSSL = lib.strings.concatStrings [ - '' - tls ${config.env.DEVENV_STATE}/mkcert/%DOMAIN%.pem ${config.env.DEVENV_STATE}/mkcert/%DOMAIN%-key.pem - '' - vhostConfig - ]; -in { - config = lib.mkIf cfg.enable { - hosts = { - "example.com" = "127.0.0.1"; - }; + php_fastcgi @debugger unix/${config.languages.php.fpm.pools.xdebug.socket} { + trusted_proxies private_ranges + } - certificates = [ "127.0.0.1" ] ++ cfg.domains; + file_server + } - services.caddy = { - enable = lib.mkDefault true; - virtualHosts = lib.mkMerge [ - (lib.concatMapStrings - (domain: { - "${domain}:80" = lib.mkDefault { - enable = true; - extraConfig = vhostConfig; - }; - }) - vhostDomains - ) - (lib.concatMapStrings - (domain: { - "${domain}:443" = lib.mkDefault { - enable = true; - extraConfig = lib.replaceStrings [ "%DOMAIN%" domain ] vhostConfigSSL; - }; - }) - vhostDomains - ) - ]; + log { + output stderr + format console + level ERROR + } + '' + cfg.additionalVhostConfig + ]; + }; }; }; } diff --git a/modules/php.nix b/modules/php.nix index 3037e7e..42101ab 100644 --- a/modules/php.nix +++ b/modules/php.nix @@ -19,6 +19,7 @@ let zend.detect_unicode = 0 opcache.memory_consumption = 256M opcache.interned_strings_buffer = 20 + opcache.enable_file_override = 1 opcache.enable_cli = 1 opcache.enabled = 1 zend.assertions = 0 From 6689cd135abe9b1adc070ebd0a02fc8cb85c869b Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 4 May 2023 12:24:26 +0200 Subject: [PATCH 13/22] fix: Add fix for devenv usage outside of project folder --- devenv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index a01c795..d7255e4 100644 --- a/devenv.nix +++ b/devenv.nix @@ -94,7 +94,7 @@ let if [ ! -f "$VENDOR" ] || [ ! -f "$CONSOLE" ]; then echo "Vendor folder or console not found. Please run composer install." - exit 1 + ${pkgs.coreutils}/bin/sleep infinity fi # additional config From 97d6f990be3f0c7582a4a9b474fd6daa579f17ca Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Thu, 4 May 2023 13:05:44 +0200 Subject: [PATCH 14/22] feat: [noticket] Add option to define a custom project root - Add option to docs --- devenv.nix | 15 +++++++++++---- docs/Options.md | 8 ++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/devenv.nix b/devenv.nix index d7255e4..61a6bb5 100644 --- a/devenv.nix +++ b/devenv.nix @@ -87,14 +87,14 @@ let systemConfigEntries = lib.mapAttrsToList (name: value: { inherit name value; }) cfg.systemConfig; scriptUpdateConfig = pkgs.writeScript "scriptUpdateConfig" '' - VENDOR=${config.env.DEVENV_ROOT}/vendor/autoload.php - CONSOLE=${config.env.DEVENV_ROOT}/bin/console + VENDOR=${config.env.DEVENV_ROOT}/${cfg.projectRoot}/vendor/autoload.php + CONSOLE=${config.env.DEVENV_ROOT}/${cfg.projectRoot}/bin/console echo "Updating system config" if [ ! -f "$VENDOR" ] || [ ! -f "$CONSOLE" ]; then echo "Vendor folder or console not found. Please run composer install." - ${pkgs.coreutils}/bin/sleep infinity + exit 1 fi # additional config @@ -233,6 +233,13 @@ in { description = "Sets the docroot of caddy"; }; + projectRoot = lib.mkOption { + type = lib.types.str; + default = "."; + description = "Root of the project as path from the file devenv.nix"; + example = "project"; + }; + staticFilePaths = lib.mkOption { type = lib.types.str; default = "/theme/* /media/* /thumbnail/* /bundles/* /css/* /fonts/* /js/* /recovery/* /sitemap/*"; @@ -444,7 +451,7 @@ in { # Symfony related scripts scripts.cc.exec = '' - CONSOLE=${config.env.DEVENV_ROOT}/bin/console + CONSOLE=${config.env.DEVENV_ROOT}${cfg.projectRoot}/bin/console if test -f "$CONSOLE"; then exec $CONSOLE cache:clear diff --git a/docs/Options.md b/docs/Options.md index 3638c60..937e655 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -99,6 +99,14 @@ Changes the default document root (`public`) of caddy to the specified value kellerkinder.documentRoot = "."; ``` +# kellerkinder.projectRoot +Changes the default root of the project to the specified value + +*_Example for the current folder_* +``` +kellerkinder.documentRoot = "/project"; +``` + # kellerkinder.staticFilePaths Adjusts the defined matcher paths for caddy. You might want to adjust those to access/handle `*.php` files. From 75d907c25aee396a257265db8c41e72dbc8e8568 Mon Sep 17 00:00:00 2001 From: tinect Date: Thu, 4 May 2023 17:37:16 +0200 Subject: [PATCH 15/22] [NOTICKET] set mysql 8.0 as default database (#53) --- devenv.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/devenv.nix b/devenv.nix index a01c795..0ffaa59 100644 --- a/devenv.nix +++ b/devenv.nix @@ -356,6 +356,7 @@ in { services.mysql = { enable = lib.mkDefault true; + package = lib.mkDefault pkgs.mysql80; initialDatabases = lib.mkDefault [{ name = "shopware"; }]; ensureUsers = lib.mkDefault [{ name = "shopware"; From 3ca777006d60455aa0d7bb17a20319593483937b Mon Sep 17 00:00:00 2001 From: tinect Date: Mon, 8 May 2023 10:48:43 +0200 Subject: [PATCH 16/22] [NOTICKET] add shopware-cli to default packages --- README.md | 1 + devenv.nix | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index daec868..bdfd1b2 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ tightly tailored to the needs of our team members working on various projects wi - Enables Xdebug without a performance impact when not using it - Easily configurable PHP Version - Inherits all default devenv features and services +- Pre-installed [shopware-cli](https://sw-cli.fos.gg/) ## Setup & Usage A description about the setup and usage can be found in the [Wiki](https://github.com/kellerkinderDE/devenv-shopware/wiki). diff --git a/devenv.nix b/devenv.nix index 0ffaa59..fb9a5b8 100644 --- a/devenv.nix +++ b/devenv.nix @@ -257,6 +257,7 @@ in { packages = [ pkgs.jq pkgs.gnupatch + pkgs.pkgs.shopware-cli ] ++ cfg.additionalPackages; languages.javascript = { From 36d0a15a1368aa08968e5edf628cd2570071068b Mon Sep 17 00:00:00 2001 From: tinect Date: Mon, 8 May 2023 10:48:43 +0200 Subject: [PATCH 17/22] [NOTICKET] update devenv and correct package name shopware-cli --- devenv.lock | 48 +++++++++++++++++++++++++++++++++--------------- devenv.nix | 2 +- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/devenv.lock b/devenv.lock index ae43c0d..def919e 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,11 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1679700890, - "narHash": "sha256-u8GqQF/z57LaDf5x/O3IC5qtvwwhLtak+kWosp51F2w=", + "lastModified": 1683288106, + "narHash": "sha256-8/yuP6gWLhK8tRCtyqY5QnTq9GF7pCWpZyyZ08lXFwM=", "owner": "cachix", "repo": "devenv", - "rev": "c9ff5bd489ca36a526e46440fec4d10a87988363", + "rev": "c4006ccba1b3e4533de462cee5933e0ccf5f1d6a", "type": "github" }, "original": { @@ -87,11 +87,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1679865578, - "narHash": "sha256-sYQmxxqIYL3QFsRYjW0AufhGur8qWfwoOGPGHRJZlGc=", + "lastModified": 1683408522, + "narHash": "sha256-9kcPh6Uxo17a3kK3XCHhcWiV1Yu1kYj22RHiymUhMkU=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4361baa782dc3d3b35fd455a1adc370681d9187c", + "rev": "897876e4c484f1e8f92009fd11b7d988a121a4e7", "type": "github" }, "original": { @@ -126,11 +126,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1679845767, - "narHash": "sha256-TjSqtZCZlCAC/I97D0/gQw+tvGQj/b5EVAL50G+RnYo=", + "lastModified": 1683438100, + "narHash": "sha256-g8sONyuRLF/6XDIDYj2Oz8ZUu0Lk7wvYkd/rDPRrDys=", "owner": "fossar", "repo": "nix-phps", - "rev": "a332e59b2868773143cf8db803de04077a84664b", + "rev": "0340edc7634ac055070b28066a56ab5753d1dc55", "type": "github" }, "original": { @@ -150,11 +150,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1678976941, - "narHash": "sha256-skNr08frCwN9NO+7I77MjOHHAw+L410/37JknNld+W4=", + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "32b1dbedfd77892a6e375737ef04d8efba634e9e", + "rev": "fb58866e20af98779017134319b5663b8215d912", "type": "github" }, "original": { @@ -171,13 +171,31 @@ "pre-commit-hooks": "pre-commit-hooks" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "utils": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1678901627, - "narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", "owner": "numtide", "repo": "flake-utils", - "rev": "93a2b84fc4b70d9e089d029deacc3583435c2ed6", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { diff --git a/devenv.nix b/devenv.nix index fb9a5b8..4ea48d6 100644 --- a/devenv.nix +++ b/devenv.nix @@ -257,7 +257,7 @@ in { packages = [ pkgs.jq pkgs.gnupatch - pkgs.pkgs.shopware-cli + pkgs.shopware-cli ] ++ cfg.additionalPackages; languages.javascript = { From ced006bf0de539672e99f4a83d930f3d13570dca Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Mon, 8 May 2023 11:43:39 +0200 Subject: [PATCH 18/22] fix: documentation for project root option --- docs/Options.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Options.md b/docs/Options.md index 937e655..2d9c2e0 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -100,11 +100,11 @@ kellerkinder.documentRoot = "."; ``` # kellerkinder.projectRoot -Changes the default root of the project to the specified value +Changes the default root of the project to the specified value (no `/` as pre- or suffix required) -*_Example for the current folder_* +*_Example for a `project` folder inside the current folder_* ``` -kellerkinder.documentRoot = "/project"; +kellerkinder.projectRoot = "project"; ``` # kellerkinder.staticFilePaths From 43e536ca1d0923275e5090199319c8c3315544f9 Mon Sep 17 00:00:00 2001 From: "a.wink" Date: Mon, 8 May 2023 17:10:21 +0200 Subject: [PATCH 19/22] fix: [noticket] Add missing entry for projectRoot to root of caddy --- devenv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index de5c7f3..a5b2e8e 100644 --- a/devenv.nix +++ b/devenv.nix @@ -323,7 +323,7 @@ in { tls internal - root * ${cfg.documentRoot} + root * ${cfg.projectRoot}/${cfg.documentRoot} encode zstd gzip From 2f899955eedb47dbf962331fa2131eeef9995a50 Mon Sep 17 00:00:00 2001 From: Jochen Manz Date: Mon, 8 May 2023 20:20:26 +0200 Subject: [PATCH 20/22] feat: restructure debug script --- modules/caddy.nix | 6 ++++-- modules/php.nix | 4 ---- modules/scripts.nix | 4 ++++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/caddy.nix b/modules/caddy.nix index 47cb15f..9780299 100644 --- a/modules/caddy.nix +++ b/modules/caddy.nix @@ -31,9 +31,9 @@ in { encode zstd gzip handle /media/* { - ${lib.strings.optionalString (cfg.fallbackRedirectMediaUrl != "") '' + ${lib.strings.optionalString (cfg.fallbackMediaUrl != "") '' @notStatic not file - redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackRedirectMediaUrl}{path} + redir @notStatic ${lib.strings.removeSuffix "/" cfg.fallbackMediaUrl}{path} ''} file_server } @@ -45,10 +45,12 @@ in { handle { php_fastcgi @default unix/${config.languages.php.fpm.pools.web.socket} { trusted_proxies private_ranges + index shopware.php index.php } php_fastcgi @debugger unix/${config.languages.php.fpm.pools.xdebug.socket} { trusted_proxies private_ranges + index shopware.php index.php } file_server diff --git a/modules/php.nix b/modules/php.nix index 42101ab..9c0e4cd 100644 --- a/modules/php.nix +++ b/modules/php.nix @@ -84,9 +84,5 @@ in { }; fpm.pools.xdebug.phpPackage = lib.mkDefault phpXdebug; }; - - scripts.debug.exec = '' - XDEBUG_SESSION=1 ${phpXdebug}/bin/php "$@" - ''; }; } diff --git a/modules/scripts.nix b/modules/scripts.nix index def1af6..1b8600b 100644 --- a/modules/scripts.nix +++ b/modules/scripts.nix @@ -137,6 +137,10 @@ in { ${scriptUpdateConfig} ''; + scripts.debug.exec = '' + XDEBUG_SESSION=1 ${phpXdebug}/bin/php "$@" + ''; + # Processes processes.entryscript.exec = "${entryScript}"; } From 08fb3a68c61c4925823dc0c5c3c1d8f52b431488 Mon Sep 17 00:00:00 2001 From: tinect Date: Tue, 9 May 2023 14:51:04 +0200 Subject: [PATCH 21/22] fix: [NOTICKET] remove opcache.enable_file_override --- devenv.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index a5b2e8e..41f5b0e 100644 --- a/devenv.nix +++ b/devenv.nix @@ -19,7 +19,6 @@ let zend.detect_unicode = 0 opcache.memory_consumption = 256M opcache.interned_strings_buffer = 20 - opcache.enable_file_override = 1 opcache.enable_cli = 1 opcache.enabled = 1 zend.assertions = 0 From f84f433c1c99a75c9d4846cb5007215cf9446919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Wi=C3=9Fler?= Date: Wed, 7 Jun 2023 22:20:36 +0200 Subject: [PATCH 22/22] fix: Add missing directory separator in cc script --- devenv.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/devenv.nix b/devenv.nix index 41f5b0e..4088485 100644 --- a/devenv.nix +++ b/devenv.nix @@ -452,7 +452,7 @@ in { # Symfony related scripts scripts.cc.exec = '' - CONSOLE=${config.env.DEVENV_ROOT}${cfg.projectRoot}/bin/console + CONSOLE=${config.env.DEVENV_ROOT}/${cfg.projectRoot}/bin/console if test -f "$CONSOLE"; then exec $CONSOLE cache:clear