feat(tools/eaglemode): add configuration wrapper script
Adds a new eaglemode.withConfig function that creates a specially wrapped Eagle Mode, in which a configuration script joins the user's configuration with the config passed in. This produces a fully working and configured Eagle Mode with custom stuff out of the box. Change-Id: I6282cafd0b1ac6e77bede90cc91d4ede19ee1d2f Reviewed-on: https://cl.tvl.fyi/c/depot/+/12369 Reviewed-by: azahi <azat@bahawi.net> Tested-by: BuildkiteCI Reviewed-by: emery <emery@dmz.rs>
This commit is contained in:
parent
8c8861cb3c
commit
c4654fe373
2 changed files with 171 additions and 0 deletions
|
|
@ -9,6 +9,13 @@ let
|
|||
mkDesc = d: lib.concatMapStringsSep "\n"
|
||||
(x: "# Descr =${x}")
|
||||
(builtins.filter (s: s != "") (lib.splitString "\n" d));
|
||||
|
||||
configWrapper = pkgs.runCommand "eaglemode-config-wrapper" { } ''
|
||||
cp ${./wrapper.go} wrapper.go
|
||||
export HOME=$PWD
|
||||
${pkgs.go}/bin/go build wrapper.go
|
||||
install -Dm755 wrapper $out/bin/wrapper
|
||||
'';
|
||||
in
|
||||
rec {
|
||||
# mkCommand creates an Eagle Mode command for the file browser.
|
||||
|
|
@ -71,4 +78,12 @@ rec {
|
|||
lib.concatMapStringsSep "\n" (s: "cp -rT ${s} $out/\nchmod -R u+rw $out/\n") ([ "${eaglemode}/etc"] ++ extraPaths)
|
||||
}
|
||||
'';
|
||||
|
||||
# withConfig creates an Eagle Mode wrapper that runs it with the given
|
||||
# configuration.
|
||||
withConfig = { eaglemode ? pkgs.eaglemode, config }: pkgs.writeShellScriptBin "eaglemode" ''
|
||||
set -ue
|
||||
${configWrapper}/bin/wrapper --em-config "${config}"
|
||||
exec ${eaglemode}/bin/eaglemode "$@"
|
||||
'';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue