Allow configurable BRIEFCASE env var for CI
These were hard-coded as $HOME/BRIEFCASE, which won't work in CI, since CI runs as the user buildkite-agent-socrates, whose $HOME directory doesn't exist.
This commit is contained in:
parent
8f46684c23
commit
e166e74c2c
2 changed files with 55 additions and 38 deletions
|
@ -1,16 +1,14 @@
|
||||||
{ briefcase, pkgs, ... }:
|
{ briefcase, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
elispLintSrc = builtins.fetchGit {
|
inherit (builtins) fetchGit path toJSON;
|
||||||
|
inherit (briefcase.emacs) initEl runScript;
|
||||||
|
|
||||||
|
elispLintSrc = fetchGit {
|
||||||
url = "https://github.com/gonewest818/elisp-lint";
|
url = "https://github.com/gonewest818/elisp-lint";
|
||||||
rev = "2b645266be8010a6a49c6d0ebf6a3ad5bd290ff4";
|
rev = "2b645266be8010a6a49c6d0ebf6a3ad5bd290ff4";
|
||||||
};
|
};
|
||||||
|
|
||||||
scriptEl = builtins.path {
|
|
||||||
path = ./script.el;
|
|
||||||
name = "script.el";
|
|
||||||
};
|
|
||||||
|
|
||||||
pipeline.steps = [
|
pipeline.steps = [
|
||||||
{
|
{
|
||||||
key = "lint-secrets";
|
key = "lint-secrets";
|
||||||
|
@ -27,16 +25,27 @@ let
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "init-emacs";
|
key = "init-emacs";
|
||||||
command = ''
|
command = let
|
||||||
${briefcase.emacs.runScript scriptEl} ${briefcase.emacs.initEl}
|
scriptEl = path {
|
||||||
'';
|
path = ./script.el;
|
||||||
|
name = "script.el";
|
||||||
|
};
|
||||||
|
runScriptEl = runScript {
|
||||||
|
script = scriptEl;
|
||||||
|
briefcasePath = "$(pwd)";
|
||||||
|
};
|
||||||
|
in "${runScriptEl} ${initEl}";
|
||||||
label = ":gnu: initialize Emacs";
|
label = ":gnu: initialize Emacs";
|
||||||
depends_on = "build-briefcase";
|
depends_on = "build-briefcase";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
key = "lint-emacs";
|
key = "lint-emacs";
|
||||||
command = ''
|
command = let
|
||||||
${briefcase.emacs.nixos}/bin/wpcarros-emacs \
|
nixosEmacs = briefcase.emacs.nixos {
|
||||||
|
briefcasePath = "$(pwd)";
|
||||||
|
};
|
||||||
|
in ''
|
||||||
|
${nixosEmacs}/bin/wpcarros-emacs \
|
||||||
--quick \
|
--quick \
|
||||||
--batch \
|
--batch \
|
||||||
--load ${elispLintSrc}/elisp-lint.el \
|
--load ${elispLintSrc}/elisp-lint.el \
|
||||||
|
@ -61,4 +70,4 @@ let
|
||||||
depends_on = "build-briefcase";
|
depends_on = "build-briefcase";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
in pkgs.writeText "pipeline.yaml" (builtins.toJSON pipeline)
|
in pkgs.writeText "pipeline.yaml" (toJSON pipeline)
|
||||||
|
|
|
@ -134,40 +134,48 @@ let
|
||||||
name = "init.el";
|
name = "init.el";
|
||||||
};
|
};
|
||||||
|
|
||||||
withEmacsPath = emacsBin: pkgs.writeShellScriptBin "wpcarros-emacs" ''
|
withEmacsPath = { emacsBin, briefcasePath }:
|
||||||
export XMODIFIERS=emacs
|
pkgs.writeShellScriptBin "wpcarros-emacs" ''
|
||||||
export BRIEFCASE=$HOME/briefcase
|
export XMODIFIERS=emacs
|
||||||
export PATH="${emacsBinPath}:$PATH"
|
export BRIEFCASE=${briefcasePath}
|
||||||
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
|
export PATH="${emacsBinPath}:$PATH"
|
||||||
exec ${emacsBin} \
|
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp:"
|
||||||
--debug-init \
|
exec ${emacsBin} \
|
||||||
--no-site-file \
|
--debug-init \
|
||||||
--no-site-lisp \
|
--no-site-file \
|
||||||
--load ${initEl} \
|
--no-site-lisp \
|
||||||
--no-init-file \
|
--load ${initEl} \
|
||||||
"$@"
|
--no-init-file \
|
||||||
'';
|
"$@"
|
||||||
|
'';
|
||||||
in {
|
in {
|
||||||
inherit initEl;
|
inherit initEl;
|
||||||
|
|
||||||
# I need to start my Emacs from CI without the call to `--load ${initEl}`.
|
# I need to start my Emacs from CI without the call to `--load ${initEl}`.
|
||||||
runScript = script: pkgs.writeShellScript "run-emacs-script" ''
|
runScript = { script, briefcasePath }:
|
||||||
export BRIEFCASE=$HOME/briefcase
|
pkgs.writeShellScript "run-emacs-script" ''
|
||||||
export PATH="${emacsBinPath}:$PATH"
|
export BRIEFCASE=${briefcasePath}
|
||||||
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
|
export PATH="${emacsBinPath}:$PATH"
|
||||||
exec ${wpcarrosEmacs}/bin/emacs \
|
export EMACSLOADPATH="${wpcDir}:${vendorDir}:${wpcarrosEmacs.deps}/share/emacs/site-lisp"
|
||||||
--no-site-file \
|
exec ${wpcarrosEmacs}/bin/emacs \
|
||||||
--no-site-lisp \
|
--no-site-file \
|
||||||
--no-init-file \
|
--no-site-lisp \
|
||||||
--script ${script} \
|
--no-init-file \
|
||||||
"$@"
|
--script ${script} \
|
||||||
'';
|
"$@"
|
||||||
|
'';
|
||||||
|
|
||||||
# Use `nix-env -f '<briefcase>' emacs.glinux` to install `wpcarro-emacs` on
|
# Use `nix-env -f '<briefcase>' emacs.glinux` to install `wpcarro-emacs` on
|
||||||
# gLinux machines. This will ensure that X and GL linkage behaves as expected.
|
# gLinux machines. This will ensure that X and GL linkage behaves as expected.
|
||||||
glinux = withEmacsPath "/usr/bin/google-emacs";
|
glinux = { briefcasePath ? "$HOME/briefcase" }: withEmacsPath {
|
||||||
|
inherit briefcasePath;
|
||||||
|
emacsBin = "/usr/bin/google-emacs";
|
||||||
|
};
|
||||||
|
|
||||||
# Use `nix-env -f '<briefcase>' emacs.nixos` to install `wpcarros-emacs` on
|
# Use `nix-env -f '<briefcase>' emacs.nixos` to install `wpcarros-emacs` on
|
||||||
# NixOS machines.
|
# NixOS machines.
|
||||||
nixos = withEmacsPath "${wpcarrosEmacs}/bin/emacs";
|
nixos = { briefcasePath ? "$HOME/briefcase" }: withEmacsPath {
|
||||||
|
inherit briefcasePath;
|
||||||
|
emacsBin = "${wpcarrosEmacs}/bin/emacs";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue