Skip to content

Add environment variable for JSON config #17075

@eljamm

Description

@eljamm

Summary

Add an environment variable for the JSON config, similar to MISSKEY_CONFIG_YML. Alternatively, a MISSKEY_CONFIG_DIR can be added, which could point to where the converted JSON file should be saved at runtime (e.g. a writable directory like /var/lib/misskey).

Purpose

In Misskey 2025.12.2, the compile_config.js script attempts to convert the YAML config to JSON and write it to the built/ directory. However, in NixOS, this directory resides is in the Nix store, which is read-only, causing the service to fail.

NixOS test logs

machine: waiting for TCP port 61812 on localhost
machine # [   16.379990] misskey[1027]: > misskey@2025.12.2 migrateandstart /nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data
machine # [   16.383356] misskey[1027]: > pnpm migrate && pnpm start
machine # [   17.312643] misskey[1052]: > misskey@2025.12.2 migrate /nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data
machine # [   17.314738] misskey[1052]: > cd packages/backend && pnpm migrate
machine # [   18.114541] misskey[1073]: > backend@ migrate /nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/packages/backend
machine # [   18.117371] misskey[1073]: > pnpm compile-config && pnpm typeorm migration:run -d ormconfig.js
machine # [   18.906617] misskey[1091]: > backend@ compile-config /nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/packages/backend
machine # [   18.908940] misskey[1091]: > node ./scripts/compile_config.js
machine # [   19.040916] misskey[1112]: /nix/store/d2xl5n9aq8x165wbg82nbb8v00fzzl6k-misskey-config.yml → /nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/built/.config.json
machine # [   19.052904] misskey[1112]: node:fs:2415
machine # [   19.054264] misskey[1112]:     return binding.writeFileUtf8(
machine # [   19.055710] misskey[1112]:                    ^
machine # [   19.057220] misskey[1112]: Error: EROFS: read-only file system, open '/nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/built/.config.json'
machine # [   19.060095] misskey[1112]:     at Object.writeFileSync (node:fs:2415:20)
machine # [   19.061792] misskey[1112]:     at yamlToJson (file:///nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/packages/backend/scripts/compile_config.js:41:5)
machine # [   19.064862] misskey[1112]:     at file:///nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/packages/backend/scripts/compile_config.js:49:2
machine # [   19.068225] misskey[1112]:     at ModuleJob.run (node:internal/modules/esm/module_job:413:25)
machine # [   19.069809] misskey[1112]:     at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:660:26)
machine # [   19.071740] misskey[1112]:     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5) {
machine # [   19.073570] misskey[1112]:   errno: -30,
machine # [   19.075337] misskey[1112]:   code: 'EROFS',
machine # [   19.076230] misskey[1112]:   syscall: 'open',
machine # [   19.077175] misskey[1112]:   path: '/nix/store/gk1mzks8h785bi2dypkvhrhm596vw6h8-misskey-2025.12.2/data/built/.config.json'
machine # [   19.079199] misskey[1112]: }
machine # [   19.079907] misskey[1112]: Node.js v24.12.0
machine # [   19.086967] misskey[1091]:  ELIFECYCLE  Command failed with exit code 1.
machine # [   19.110718] misskey[1073]:  ELIFECYCLE  Command failed with exit code 1.
machine # [   19.135796] misskey[1052]:  ELIFECYCLE  Command failed with exit code 1.
machine # [   19.161594] misskey[1027]:  ELIFECYCLE  Command failed with exit code 1.
machine # [   19.180936] systemd[1]: misskey.service: Main process exited, code=exited, status=1/FAILURE
machine # [   19.183338] systemd[1]: misskey.service: Failed with result 'exit-code'.

Do you want to implement this feature yourself?

  • Yes, I will implement this by myself and send a pull request

Metadata

Metadata

Assignees

No one assigned

    Labels

    ✨FeatureThis adds/improves/enhances a feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions