feat(tools/eaglemode): add function for creating etc dir
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>
This commit is contained in:
parent
4a4c21482b
commit
8c8861cb3c
1 changed files with 17 additions and 0 deletions
|
@ -54,4 +54,21 @@ rec {
|
||||||
then builtins.readFile code
|
then builtins.readFile code
|
||||||
else throw "code must be a string (literal code) or path to file")}
|
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)
|
||||||
|
}
|
||||||
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue