diff options
author | Vincent Ambo <tazjin@tvl.su> | 2024-08-28T00·04+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2024-08-30T13·30+0000 |
commit | 8c8861cb3caaaed938675595dccb0cf88a654319 (patch) | |
tree | c378dc0205710c122a1d7e04217e62c594668037 /tools/eaglemode | |
parent | 4a4c21482b4856da069cb7163262db5cf9c6221e (diff) |
feat(tools/eaglemode): add function for creating etc dir r/8616
Adds an eaglemode.etcDir function which creates a directory structure suitable for use with EM_USER_CONFIG_DIR. The catch is that Eagle Mode requires this to be always writable, so it isn't possible to just point the environment variable at the Nix store and launch it from there. The idea of this function is to make it possible to reuse it in a wrapper script, a home manager module, a NixOS module or whatever that would make it possible to provide the result to Eagle Mode in a mutable location. Change-Id: I95c8b16c6c6fe8510ce9759c9d9b9e36e836e290 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12368 Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su> Reviewed-by: azahi <azat@bahawi.net>
Diffstat (limited to 'tools/eaglemode')
-rw-r--r-- | tools/eaglemode/default.nix | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tools/eaglemode/default.nix b/tools/eaglemode/default.nix index 32f117c9bf5f..5bab3155da1e 100644 --- a/tools/eaglemode/default.nix +++ b/tools/eaglemode/default.nix @@ -54,4 +54,21 @@ rec { then builtins.readFile code else throw "code must be a string (literal code) or path to file")} ''); + + # etcDir creates a directory layout suitable for use in the EM_USER_CONFIG_DIR + # environment variable. + # + # Note that Eagle Mode requires the value of that variable to be mutable at + # runtime (it is the same place where it persists all of its user-controlled + # state), so the results of this function can not be used directly. + etcDir = + { eaglemode ? pkgs.eaglemode + , extraPaths ? [ ] + }: pkgs.runCommand "eaglemode-config" { } '' + mkdir $out + + ${ + lib.concatMapStringsSep "\n" (s: "cp -rT ${s} $out/\nchmod -R u+rw $out/\n") ([ "${eaglemode}/etc"] ++ extraPaths) + } + ''; } |