mirror of
https://github.com/nexu-io/open-design.git
synced 2026-05-31 19:04:39 +07:00
fix: set writable OD_DATA_DIR default for nix run (#1159)
Fixes #1157 When running via 'nix run github:nexu-io/open-design', the daemon attempted to create runtime state under the Nix store package path: /nix/store/.../lib/open-design/.od/projects The Nix store is read-only at runtime, causing startup to fail with ENOENT when mkdir() tried to create the projects directory. This commit updates the nix run wrapper to export OD_DATA_DIR with a writable default ($HOME/.od) when the variable is unset. Users can still override it by setting OD_DATA_DIR before running. The Home Manager and NixOS modules already set OD_DATA_DIR, so they are unaffected by this change.
This commit is contained in:
parent
d3b1804523
commit
2838a28585
1 changed files with 5 additions and 0 deletions
|
|
@ -62,9 +62,14 @@
|
||||||
# Wrap `od` with `--no-open` for `nix run`: the daemon package
|
# Wrap `od` with `--no-open` for `nix run`: the daemon package
|
||||||
# builds the daemon workspace only, not `apps/web/out/`, so the
|
# builds the daemon workspace only, not `apps/web/out/`, so the
|
||||||
# browser would otherwise auto-open onto an empty static dir.
|
# browser would otherwise auto-open onto an empty static dir.
|
||||||
|
#
|
||||||
|
# Set OD_DATA_DIR to a writable location when unset. The Nix store
|
||||||
|
# is read-only at runtime, so the daemon cannot write to its default
|
||||||
|
# `<projectRoot>/.od` location under `nix run`.
|
||||||
apps.default = {
|
apps.default = {
|
||||||
type = "app";
|
type = "app";
|
||||||
program = "${pkgs.writeShellScript "od-nix-run" ''
|
program = "${pkgs.writeShellScript "od-nix-run" ''
|
||||||
|
export OD_DATA_DIR="''${OD_DATA_DIR:-$HOME/.od}"
|
||||||
exec ${daemon}/bin/od --no-open "$@"
|
exec ${daemon}/bin/od --no-open "$@"
|
||||||
''}";
|
''}";
|
||||||
meta.description = "Open Design local daemon (`od`)";
|
meta.description = "Open Design local daemon (`od`)";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue