Skip to content

Commit

Permalink
chore(deps): lock file maintenance (#414)
Browse files Browse the repository at this point in the history
* chore(deps): lock file maintenance

* chore: replace deprecated if-let/when-let functions

* fix: typo in racket-mode use-package definition

* feat: use twist lib to byte compile init files

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Terje Larsen <terlar@gmail.com>
  • Loading branch information
renovate[bot] and terlar authored Oct 28, 2024
1 parent 771c2dd commit d149c21
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 120 deletions.
46 changes: 21 additions & 25 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
lib,
stdenv,
trivialBuild,
buildElispPackage,
elispInputs,
emacs-all-the-icons-fonts,
emacsPackages,
iosevka-bin,
Expand All @@ -11,41 +12,36 @@
let
tree-sitter = emacsPackages.treesit-grammars.with-all-grammars;

init = trivialBuild {
pname = "config-init";
version = "1";
init = buildElispPackage {
ename = "config-init";

src = lib.sourceByRegex ./. [ "init.org" ];
files = [ "init.org" ];
lispFiles = [
"early-init.el"
"init.el"
];

inherit elispInputs;
nativeCompileAhead = true;
wantExtraOutputs = false;
errorOnWarn = true;
doTangle = false;

preBuild = ''
export HOME="$NIX_BUILD_TOP/.home"
mkdir -p "$HOME/.config/emacs"
emacs --batch --quick \
--load org \
*.org \
--funcall org-babel-tangle
'';

buildPhase = ''
runHook preBuild
export HOME="$(mktemp -d)"
rm *.org
mkdir -p "$HOME/.emacs.d"
ln -s ${tree-sitter}/lib "$HOME/.emacs.d/tree-sitter"
emacs --batch --quick \
--eval '(setq byte-compile-error-on-warn t)' \
--funcall batch-byte-compile \
*.el
runHook postBuild
ln -s ${tree-sitter}/lib "$HOME/.config/emacs/tree-sitter"
'';

# Temporary hack because the Emacs native load path is not respected.
fixupPhase = ''
if [ -d "$HOME/.emacs.d/eln-cache" ]; then
mv $HOME/.emacs.d/eln-cache/* $out/share/emacs/native-lisp
fi
'';
meta = { };
};
in
stdenv.mkDerivation {
Expand Down
75 changes: 34 additions & 41 deletions dev/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 24 additions & 24 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 7 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,14 @@
);

emacs-config = prev.callPackage inputs.self {
trivialBuild = final.emacsPackages.trivialBuild.override {
emacs = final.emacs-env.overrideScope (
_: tprev: { inherit (tprev.emacs) meta withNativeCompilation; }
);
buildElispPackage = (inputs.twist.lib.buildElispPackage final).override {
emacs = emacsPackage;
};

elispInputs = prev.lib.pipe final.emacs-env.elispPackages [
builtins.attrValues
(builtins.filter prev.lib.isDerivation)
];
};
}
)
Expand Down
7 changes: 4 additions & 3 deletions init.org
Original file line number Diff line number Diff line change
Expand Up @@ -1661,8 +1661,8 @@ Descriptive buffer names or project relative paths for buffer names.
(shell-mode-hook . epithet-rename-buffer)
:config
(defun epithet-relative-project-name ()
(when-let ((project (project-current))
(buffer-file-name (buffer-file-name)))
(when-let* ((project (project-current))
(buffer-file-name (buffer-file-name)))
(let* ((project-root (expand-file-name (project-root project)))
(prefix (file-name-directory (directory-file-name project-root)))
(buffer (expand-file-name buffer-file-name)))
Expand Down Expand Up @@ -2926,7 +2926,7 @@ Add faces to =outline-minor-mode= in order to make the headings stand out.
(defun clojure-repl ()
"Open a Clojure REPL."
(interactive)
(if-let ((repl-buffer (cider-current-repl)))
(if-let* ((repl-buffer (cider-current-repl)))
(pop-to-buffer repl-buffer)
(cider-jack-in-clj nil)))

Expand Down Expand Up @@ -3503,6 +3503,7 @@ Pretty check-boxes
(use-package racket-mode
:ensure t
:mode "\\.rkt[dl]?\\'"
:bind
(:map racket-mode-map
("M-g k" . racket-doc)
("C-. t" . racket-test))
Expand Down
Loading

0 comments on commit d149c21

Please sign in to comment.