diff --git a/apps/docs/content/docs/modules/prelude.mdx b/apps/docs/content/docs/modules/prelude.mdx index 4f02cf0d..00fd5439 100644 --- a/apps/docs/content/docs/modules/prelude.mdx +++ b/apps/docs/content/docs/modules/prelude.mdx @@ -59,6 +59,8 @@ prelude = { | `prelude.prompt.enable` | `false` | Themed Starship (off until theme bridge) | | `prelude.settings` | `{ }` | Passthrough merged into flake-parts `prelude.*` | +> **Note:** Prelude’s Bash workspace is disabled under Stackpanel. Stackpanel owns MOTD, menu, and docs through its façade and clears Prelude’s `docs.pages`, which the Bash workspace requires. + ## Command catalogue façade Existing modules keep writing `stackpanel.motd.commands` / `features` / `hints`. Stackpanel maps those into `prelude.commands` (sanitized keys, first five on Getting Started). Live agent and aggregate health status still come from `stack motd --json` into Prelude’s MOTD status lights — there is **one** banner. diff --git a/flake.lock b/flake.lock index 19e410af..0956c4bc 100644 --- a/flake.lock +++ b/flake.lock @@ -2,18 +2,16 @@ "nodes": { "agenix": { "inputs": { - "darwin": "darwin", - "home-manager": "home-manager", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1790460690, - "narHash": "sha256-5T54NUBA0c1eo7a8MMT1GOuFYsDqqa91rLWp7l/xPC8=", + "lastModified": 1792507013, + "narHash": "sha256-8tKjSQajD3mUND1GaAuaWTcuyUpgcGsh5V+l4ibzC7U=", "owner": "ryantm", "repo": "agenix", - "rev": "654f73179924797b0d5307105398aedfcdc10800", + "rev": "5e5b88a0c8e56f291a108c2fe9934054d9745b2e", "type": "github" }, "original": { @@ -25,6 +23,7 @@ "agenix-rekey": { "inputs": { "devshell": "devshell", + "flake-compat": "flake-compat", "flake-parts": [ "flake-parts" ], @@ -37,11 +36,11 @@ ] }, "locked": { - "lastModified": 1774522439, - "narHash": "sha256-GvINrdGznE7mGlDNjW0/PMgOJlC+Nl9MkfxALB4QvWs=", + "lastModified": 1791547681, + "narHash": "sha256-UdHmeDLs0FyyJzkUZs9VEANFOt+3FZNT39Vyyoj4h/g=", "owner": "oddlama", "repo": "agenix-rekey", - "rev": "8b9c179bc1300ab130c90f2d25426bf0e7a2b58d", + "rev": "87e5d5f2ca5de294eb5386c2773b94d58ec9773b", "type": "github" }, "original": { @@ -58,11 +57,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1788342924, - "narHash": "sha256-Sfyygt2dL88+160d014gaXMlWTGIL2HGxlIzLGsGPvE=", + "lastModified": 1791920352, + "narHash": "sha256-Zbd0CGR2Dh9USbYglGXQ09FJXxxKkD5w5vi99nlz1yE=", "owner": "numtide", "repo": "blueprint", - "rev": "8be75245e274a789b87cc4df542abbcd8c5e7f93", + "rev": "2bf123541bd5024046f32299c9f8a6cc6bdd8a9f", "type": "github" }, "original": { @@ -109,11 +108,11 @@ "systems": "systems_3" }, "locked": { - "lastModified": 1790189016, - "narHash": "sha256-6YGyJyFq6i4ZQ8/4gEwRk5RNFqCfK3bAqSsGvH7CrKA=", + "lastModified": 1792936775, + "narHash": "sha256-eaU2pHtCYaICoKVZrE6kMvhjdW64i9LGgWUcfBjQAmU=", "owner": "zhaofengli", "repo": "colmena", - "rev": "4d2d652a81322c906b9d945c331715d6c088261f", + "rev": "3ec48100cdc024300b0c442fff34e7b3d5c8addb", "type": "github" }, "original": { @@ -122,28 +121,6 @@ "type": "github" } }, - "darwin": { - "inputs": { - "nixpkgs": [ - "agenix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1783744694, - "narHash": "sha256-2cp6N3rrwnGYLTx9l6N+NI+kwrCWxvJUbj5WJhvB29A=", - "owner": "nix-darwin", - "repo": "nix-darwin", - "rev": "c3e90c89649b07d1a96e4b9dd6cd0d6e44b91a74", - "type": "github" - }, - "original": { - "owner": "nix-darwin", - "ref": "nix-darwin-26.05", - "repo": "nix-darwin", - "type": "github" - } - }, "devshell": { "inputs": { "nixpkgs": [ @@ -172,11 +149,11 @@ ] }, "locked": { - "lastModified": 1789770686, - "narHash": "sha256-uZkBR7yHdIKUFB5SZdfgh1qkGfI3XmYmI/lTiquxbck=", + "lastModified": 1792526520, + "narHash": "sha256-3hSJlv8mUVnZPMWK2+CM7a9O+nR6Z4mCh27NfLCmTPc=", "owner": "nix-community", "repo": "disko", - "rev": "725ea35e410ad83be4931d1bff7e090eacaf3563", + "rev": "cedd626e11b635470fa6f9fdb8ad79b0075dd7f9", "type": "github" }, "original": { @@ -186,6 +163,22 @@ } }, "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1767039857, + "narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=", + "owner": "NixOS", + "repo": "flake-compat", + "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1696426674, @@ -201,7 +194,7 @@ "type": "github" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1767039857, @@ -222,11 +215,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1788450739, - "narHash": "sha256-glZLQlzIn1fXH6PazR2iUmTo7kzzyYSshrWhLS9TqCU=", + "lastModified": 1790898470, + "narHash": "sha256-zTwuwezD0w3hpga6a6P8emidzAZFyWqlNeRBlpWOOl8=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "31729ca8cbdb4fa927b34e5f4353e6a83f39e993", + "rev": "024633cd702b10285db5cb19b40ad48d2399ba60", "type": "github" }, "original": { @@ -240,12 +233,12 @@ "systems": "systems_4" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "revCount": 102, + "lastModified": 1791914995, + "narHash": "sha256-Zf/xfQEAasnwnmEfHqW/4hjDE/s44yn2hD4RuVIZRjA=", + "rev": "b7a79d3fea1e214f6d668d521cecec0c01e26544", + "revCount": 104, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.102%2Brev-11707dc2f618dd54ca8739b309ec4fc024de578b/0193276d-5b8f-7dbc-acf1-41cb7b54ad2e/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/numtide/flake-utils/0.1.104%2Brev-b7a79d3fea1e214f6d668d521cecec0c01e26544/01a13688-ab44-7252-9946-609183ce150d/source.tar.gz" }, "original": { "type": "tarball", @@ -254,18 +247,18 @@ }, "git-hooks": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1790091288, - "narHash": "sha256-2dUuLTiQrf2gUFVLlayDq/hgluitplAMv6Y9bYwQQ+c=", - "rev": "0d3997c4d3253505f77c9bcea63904bb575da3c5", - "revCount": 1243, + "lastModified": 1791909798, + "narHash": "sha256-VAhpCOmrun/KXimYfR8NM88bciKCui7CqHHhThSzgag=", + "rev": "1ba1dbfe28738c9a71c266be6efa5b89e75491a9", + "revCount": 1262, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1243%2Brev-0d3997c4d3253505f77c9bcea63904bb575da3c5/01a0ca31-fbaa-75f0-b2fd-9fe556b26272/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/cachix/git-hooks.nix/0.1.1262%2Brev-1ba1dbfe28738c9a71c266be6efa5b89e75491a9/01a1365c-ea95-7183-93b0-1dc6ae52e058/source.tar.gz" }, "original": { "type": "tarball", @@ -338,28 +331,6 @@ "type": "github" } }, - "home-manager": { - "inputs": { - "nixpkgs": [ - "agenix", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1790215976, - "narHash": "sha256-VkR1rMGyjU9jtw8ISFx5uqR9e+LEaOlhHwrseFkiIVk=", - "owner": "nix-community", - "repo": "home-manager", - "rev": "a6631107a83ceab5872f298a2ea710859c80c4cb", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "release-26.05", - "repo": "home-manager", - "type": "github" - } - }, "microvm": { "inputs": { "nixpkgs": [ @@ -368,11 +339,11 @@ "spectrum": "spectrum" }, "locked": { - "lastModified": 1790337272, - "narHash": "sha256-Gj7g9GkMZNj0u0VKvyN4uf2XUxdHd4JwKOsaSicGtAo=", + "lastModified": 1792810338, + "narHash": "sha256-0DS+A3BsygKRpKe0qmUWVDSfKqpIHZCpHJagAklE0o4=", "owner": "astro", "repo": "microvm.nix", - "rev": "68f2670367e03da7d0cceef0594a7b2c173849de", + "rev": "4876e2ae2de6ce225f4ccf664ae441128aa3f03a", "type": "github" }, "original": { @@ -433,11 +404,11 @@ ] }, "locked": { - "lastModified": 1790436535, - "narHash": "sha256-cB3ZNNZEUmUEKXxqBLA17JGC2I1gZZ6SFAxpRynq5OU=", + "lastModified": 1792225367, + "narHash": "sha256-Uz/SQyKSOQc/ZsIgLTOr+pWGqhzcemyEA2vBAL6KGZM=", "owner": "nlewo", "repo": "nix2container", - "rev": "7ac0ae4c39ce93357be85192350a92e077128bef", + "rev": "535166ecac3fcdff43787aa958dd7e954770581d", "type": "github" }, "original": { @@ -462,11 +433,11 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1788057806, - "narHash": "sha256-DTQSMxzDWmT0zhguthvegnVkn7CFqGCv4IHCzk5ZUpM=", + "lastModified": 1790477367, + "narHash": "sha256-oujbxmVKDhci2E4EM3KyAbRUgp5/IsCoiA/LfEF7OOk=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "596e2e3940e09b2abbeb03f75fa1828c57fcd72c", + "rev": "f7cd230690d9fc982d06129f9189b101fddcfa3b", "type": "github" }, "original": { @@ -477,11 +448,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1790448801, - "narHash": "sha256-nAq6wML4elZMHNi/29VVZSEnptPMSo9JwhacZnLVPZU=", + "lastModified": 1792842277, + "narHash": "sha256-pGPnZGi8y9d76xNeracniXO3dsYVROEmMkMc8jD0Ihc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "f9bce96a417afbb9c64725f8727e42efafeafc21", + "rev": "d3b13ad75cc492690728f9307e443dec9ef9a20e", "type": "github" }, "original": { @@ -508,7 +479,7 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "gitignore": "gitignore", "nixpkgs": [ "agenix-rekey", @@ -542,11 +513,11 @@ ] }, "locked": { - "lastModified": 1790170418, - "narHash": "sha256-1QKw82+s0f73/9ZeFHM8WMuP0M3rXxVm/+8LSc7U230=", + "lastModified": 1793009681, + "narHash": "sha256-1FSqvl3NPYEixYDnV9F3lbu15HGFIc/1BZYdGUNx/xo=", "owner": "darkmatter", "repo": "prelude", - "rev": "90ac25e51e0e6e0c28710f4ceddc465fe0c964b5", + "rev": "a140bb4d94bde26e24541ce1eb3e1855faa9268a", "type": "github" }, "original": { @@ -557,11 +528,11 @@ }, "process-compose-flake": { "locked": { - "lastModified": 1782060835, - "narHash": "sha256-Q8HH2t1l3MITtWCWY4ytcH5F/Q7aAHo3Iq/QTMAKTe0=", + "lastModified": 1791992503, + "narHash": "sha256-ak6baHPCy6SUTskWRfxdlgF5mtEfFx9kIMskKVPpaMY=", "owner": "Platonic-Systems", "repo": "process-compose-flake", - "rev": "464ff6880737f063c3f0d3d2c7781fda9190868f", + "rev": "8e27bc993c0156b5e033ad5889094d65fd27f623", "type": "github" }, "original": { @@ -612,11 +583,11 @@ }, "stable": { "locked": { - "lastModified": 1790117938, - "narHash": "sha256-KgxFEzwzcmyNe4mqlYtsZjzy40mLcNVKtaeoCf5tCGg=", + "lastModified": 1791836840, + "narHash": "sha256-3Ahbtge+KeRUBrpfGA9kNnXwuKC8n9dG+FBlf5jfVO4=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bd495b825e5c4365131f9b744cce923d42c06158", + "rev": "a869610ddd0c17e9c29f13e333bfca6eb8a5c3b4", "type": "github" }, "original": { @@ -693,12 +664,12 @@ ] }, "locked": { - "lastModified": 1786901030, - "narHash": "sha256-WSFCsDSE5ffgD2MqzkM2CYjeFiKhRF/dJUN8uedb6YE=", - "rev": "27b3b12a8e6375f28ebe122f07d230ca5459bbfa", - "revCount": 557, + "lastModified": 1791885023, + "narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=", + "rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c", + "revCount": 684, "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/numtide/treefmt-nix/0.1.557%2Brev-27b3b12a8e6375f28ebe122f07d230ca5459bbfa/01a00ba7-ea6f-7822-ab05-cbad971fc7ca/source.tar.gz" + "url": "https://api.flakehub.com/f/pinned/numtide/treefmt-nix/0.1.684%2Brev-0d6d739a833ba9a9c93034862e4a7b061a062a1c/01a1365c-d9b4-72b0-aadd-ca40080e575b/source.tar.gz" }, "original": { "type": "tarball", diff --git a/flake.nix b/flake.nix index faf3ba0c..9dad78bd 100644 --- a/flake.nix +++ b/flake.nix @@ -102,6 +102,7 @@ lib templates flakeModules + devenvModules nixosModules ; # Re-export the pinned Prelude input for power users who want diff --git a/nix/flake/README.md b/nix/flake/README.md index b58d8a71..51ec57d0 100644 --- a/nix/flake/README.md +++ b/nix/flake/README.md @@ -87,6 +87,32 @@ Wrapped [numtide/blueprint](https://github.com/numtide/blueprint). Callers do no } ``` +### `devenvModules.default` + +For projects that use [devenv](https://devenv.sh) instead of `mkFlake`. The module reads `.stack/` from `devenv.root` and adds the stackpanel shell's packages, env, and shell hook to the devenv shell. + +devenv CLI (`devenv shell`): + +```yaml +# devenv.yaml +inputs: + stackpanel: + url: github:darkmatter/stackpanel + # Optional: build on Stackpanel's pinned nixpkgs (binary cache hits). + nixpkgs: + follows: stackpanel/nixpkgs +``` + +```nix +# devenv.nix +{ inputs, ... }: +{ + imports = [ inputs.stackpanel.devenvModules.default ]; +} +``` + +devenv's flake-parts module (`nix develop --no-pure-eval`, a devenv requirement) works the same way via `devenv.shells.default.imports`; a `devenv.shells.default` replaces the stackpanel `devShells.default`. + ### `templates` Project templates for bootstrapping new projects: @@ -115,5 +141,5 @@ Configuration lives in `.stack/config.nix` and is loaded automatically. See indi ## Legacy Notes -- `devenvModules` and `lib.wrapDevenv` were removed as part of the flake-parts migration. Use `stackpanel.lib.mkFlake` or `stackpanel.flakeModules.default` instead. -- The `devenv` standalone template and `devenv.shells.*` configuration are no longer provided. +- `lib.wrapDevenv` was removed as part of the flake-parts migration. Use `stackpanel.lib.mkFlake`, `stackpanel.flakeModules.default`, or `stackpanel.devenvModules.default` instead. +- The `devenv` standalone template is no longer provided. diff --git a/nix/flake/default.nix b/nix/flake/default.nix index b3099f28..4f114bad 100644 --- a/nix/flake/default.nix +++ b/nix/flake/default.nix @@ -23,27 +23,11 @@ let includeRootOutputs = config.stackpanel.includeRootOutputs or false; primarySystem = builtins.head config.systems; - discoveredStackpanelImports = - if builtins.pathExists (self + "/.stack/modules") then - [ (self + "/.stack/modules") ] - else if builtins.pathExists (self + "/.stack/nix") then - [ (self + "/.stack/nix") ] - else if builtins.pathExists (self + "/.stackpanel/modules") then - [ (self + "/.stackpanel/modules") ] - else if builtins.pathExists (self + "/.stackpanel/nix") then - [ (self + "/.stackpanel/nix") ] - else - [ ]; - - # Flake-level adoption offers (templates/_addons) join module-contributed - # offers under stackpanel.addons so `stack setup` sees one list. - flakeAddonsModule = { - stackpanel.addons = (import ./addons.nix { inherit lib; }).initAddons; + stackpanelImports = import ./stackpanel-imports.nix { + inherit lib self; + extraImports = config.stackpanel.imports or [ ]; }; - stackpanelImports = - discoveredStackpanelImports ++ (config.stackpanel.imports or [ ]) ++ [ flakeAddonsModule ]; - registry = import ./integrations { inherit localFlake diff --git a/nix/flake/devenv-module.nix b/nix/flake/devenv-module.nix new file mode 100644 index 00000000..2f39bdbb --- /dev/null +++ b/nix/flake/devenv-module.nix @@ -0,0 +1,63 @@ +# ============================================================================== +# devenv-module.nix — Stackpanel as a devenv module (devenvModules.default) +# +# Evaluates the project's .stack config with the same eval/shell code as the +# flake module, then maps the finished shell onto devenv options. Works with +# the devenv CLI (stackpanel as a devenv.yaml input, imported in devenv.nix) +# and with devenv.flakeModule shells (devenv.shells..imports). +# ============================================================================== +{ + localFlake, + localInputs, +}: +{ + config, + lib, + pkgs, + inputs, + ... +}: +let + # devenv.root is the live project directory, so .stack/ is read in place + # instead of copying the project into the store. + self = /. + config.devenv.root; + + stackpanelPkgs = pkgs.appendOverlays (import ./overlays.nix { inherit localInputs; }); + + eval = import ./per-system/eval.nix { + inherit + lib + self + inputs + localFlake + ; + pkgs = stackpanelPkgs; + stackpanelImports = import ./stackpanel-imports.nix { inherit lib self; }; + flakeLevelStackpanelConfig = { }; + perSystemStackpanelConfig = { }; + }; + + registry = import ./integrations { + inherit + localFlake + localInputs + inputs + lib + ; + }; + + shell = import ./per-system/shell.nix { + inherit lib eval; + pkgs = stackpanelPkgs; + extraPackages = registry.extraShellPackages { + inherit lib self eval; + inherit (eval) spConfig loadedConfig; + pkgs = stackpanelPkgs; + }; + }; +in +lib.mkIf (eval.spConfig.enable or false) { + packages = shell.nativeBuildInputs ++ shell.buildInputs; + env.STACKPANEL_SHELL_HOOK_PATH = shell.STACKPANEL_SHELL_HOOK_PATH; + enterShell = shell.shellHook; +} diff --git a/nix/flake/exports.nix b/nix/flake/exports.nix index e668a932..be6cd5f5 100644 --- a/nix/flake/exports.nix +++ b/nix/flake/exports.nix @@ -112,6 +112,16 @@ let }; }; + # ========================================================================== + # DEVENV MODULES (for devenv CLI / devenv.flakeModule users) + # ========================================================================== + devenvModules = { + default = import ./devenv-module.nix { + localFlake = stackpanelInputs.self; + localInputs = stackpanelInputs; + }; + }; + # ========================================================================== # LIBRARY FUNCTIONS # ========================================================================== diff --git a/nix/flake/integrations/prelude/flake-module.nix b/nix/flake/integrations/prelude/flake-module.nix index 701e9968..8f535d9c 100644 --- a/nix/flake/integrations/prelude/flake-module.nix +++ b/nix/flake/integrations/prelude/flake-module.nix @@ -29,6 +29,9 @@ links = lib.mkForce [ ]; }; docs.pages = lib.mkForce [ ]; + # Workspace asserts non-empty docs.pages; stackpanel's own façade supplies + # docs/MOTD, so the Prelude workspace is unused here. + workspace.enable = lib.mkForce false; sort.groups = [ "develop" "database" diff --git a/nix/flake/per-system/eval.nix b/nix/flake/per-system/eval.nix index 28865a2b..48b6e61a 100644 --- a/nix/flake/per-system/eval.nix +++ b/nix/flake/per-system/eval.nix @@ -19,6 +19,14 @@ let configLoader = import ../load-config.nix { inherit self inputs; }; stackpanelConfigModule = configLoader.mkStackpanelModule { inherit lib pkgs; }; + # Stackpanel modules read Prelude (process-compose themes) from `inputs`; + # fall back to Stackpanel's own pin so consumers need not add the input. + moduleInputs = + lib.optionalAttrs (localFlake != null && localFlake ? inputs.prelude) { + inherit (localFlake.inputs) prelude; + } + // inputs; + effectiveRoot = if (flakeLevelStackpanelConfig.projectRoot or null) != null then flakeLevelStackpanelConfig.projectRoot @@ -45,10 +53,10 @@ let inherit pkgs lib - inputs self localFlake ; + inputs = moduleInputs; }; }; diff --git a/nix/flake/per-system/outputs.nix b/nix/flake/per-system/outputs.nix index d8353340..02d50728 100644 --- a/nix/flake/per-system/outputs.nix +++ b/nix/flake/per-system/outputs.nix @@ -61,8 +61,9 @@ lib.mkMerge [ }; } + # mkDefault so a devenv.flakeModule `devenv.shells.default` can take over. (lib.mkIf (spConfig.enable or false) { - devShells.default = lib.mkForce shell; + devShells.default = lib.mkDefault shell; }) (lib.mkIf (spConfig.enable or false) ( diff --git a/nix/flake/stackpanel-imports.nix b/nix/flake/stackpanel-imports.nix new file mode 100644 index 00000000..c8f3bcbd --- /dev/null +++ b/nix/flake/stackpanel-imports.nix @@ -0,0 +1,31 @@ +# ============================================================================== +# stackpanel-imports.nix — Project-local stackpanel modules + flake addons +# +# Shared by the flake module (default.nix) and the devenv module +# (devenv-module.nix) so both evaluate the same module set. +# ============================================================================== +{ + lib, + self, + extraImports ? [ ], +}: +let + discoveredStackpanelImports = + if builtins.pathExists (self + "/.stack/modules") then + [ (self + "/.stack/modules") ] + else if builtins.pathExists (self + "/.stack/nix") then + [ (self + "/.stack/nix") ] + else if builtins.pathExists (self + "/.stackpanel/modules") then + [ (self + "/.stackpanel/modules") ] + else if builtins.pathExists (self + "/.stackpanel/nix") then + [ (self + "/.stackpanel/nix") ] + else + [ ]; + + # Flake-level adoption offers (templates/_addons) join module-contributed + # offers under stackpanel.addons so `stack setup` sees one list. + flakeAddonsModule = { + stackpanel.addons = (import ./addons.nix { inherit lib; }).initAddons; + }; +in +discoveredStackpanelImports ++ extraImports ++ [ flakeAddonsModule ]