Switch to buildEnv instead of symlinkJoin for better control over the joining process.
This commit is contained in:
parent
d3ea8b3667
commit
054e056d00
@ -6,42 +6,43 @@
|
|||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
plainmacs = pkgs.writeShellScriptBin "plainmacs" ''
|
plainmacs =
|
||||||
INIT_SCRIPT=$(cat <<EOF
|
emacs_package:
|
||||||
(progn
|
pkgs.writeShellScriptBin "plainmacs" ''
|
||||||
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
|
INIT_SCRIPT=$(cat <<EOF
|
||||||
(load-theme 'tango-dark t)
|
(progn
|
||||||
(set-face-attribute 'default nil :background "black")
|
(setq make-backup-files nil auto-save-default nil create-lockfiles nil)
|
||||||
;; Bright yellow highlighting for selected region
|
(load-theme 'tango-dark t)
|
||||||
(set-face-attribute 'region nil :background "#ffff50" :foreground "black")
|
(set-face-attribute 'default nil :background "black")
|
||||||
;; Bright green cursor to distinguish from yellow region
|
;; Bright yellow highlighting for selected region
|
||||||
(set-cursor-color "#ccff66")
|
(set-face-attribute 'region nil :background "#ffff50" :foreground "black")
|
||||||
;; Hightlight the current line
|
;; Bright green cursor to distinguish from yellow region
|
||||||
(set-face-attribute 'line-number-current-line nil :foreground "white")
|
(set-cursor-color "#ccff66")
|
||||||
;; Set default font
|
;; Hightlight the current line
|
||||||
(set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono")
|
(set-face-attribute 'line-number-current-line nil :foreground "white")
|
||||||
;; Set fallback font for unicode glyphs
|
;; Set default font
|
||||||
(when (display-graphic-p)
|
(set-face-attribute 'default nil :height 100 :width 'regular :weight 'regular :family "Cascadia Mono")
|
||||||
(set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji")))
|
;; Set fallback font for unicode glyphs
|
||||||
(menu-bar-mode -1)
|
(when (display-graphic-p)
|
||||||
(when (fboundp 'tool-bar-mode)
|
(set-fontset-font "fontset-default" nil (font-spec :name "Noto Color Emoji")))
|
||||||
(tool-bar-mode -1))
|
(menu-bar-mode -1)
|
||||||
(when ( fboundp 'scroll-bar-mode)
|
(when (fboundp 'tool-bar-mode)
|
||||||
(scroll-bar-mode -1))
|
(tool-bar-mode -1))
|
||||||
(pixel-scroll-precision-mode)
|
(when ( fboundp 'scroll-bar-mode)
|
||||||
(setq frame-resize-pixelwise t)
|
(scroll-bar-mode -1))
|
||||||
|
(pixel-scroll-precision-mode)
|
||||||
|
(setq frame-resize-pixelwise t)
|
||||||
|
)
|
||||||
|
EOF
|
||||||
)
|
)
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
exec ${pkgs.emacs29-pgtk}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
|
exec ${emacs_package}/bin/emacs -q --eval "$INIT_SCRIPT" "''${@}"
|
||||||
'';
|
'';
|
||||||
e_shorthand = pkgs.writeShellScriptBin "e" ''
|
e_shorthand =
|
||||||
exec ${pkgs.emacs_full}/bin/emacs "''${@}"
|
emacs_package:
|
||||||
'';
|
pkgs.writeShellScriptBin "e" ''
|
||||||
plain_e_shorthand = pkgs.writeShellScriptBin "e" ''
|
exec ${emacs_package}/bin/emacs "''${@}"
|
||||||
exec ${pkgs.emacs29-pgtk}/bin/emacs "''${@}"
|
'';
|
||||||
'';
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
imports = [ ];
|
imports = [ ];
|
||||||
@ -58,94 +59,93 @@ in
|
|||||||
description = "What flavor of emacs to set up.";
|
description = "What flavor of emacs to set up.";
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = lib.mkIf (config.me.emacs_flavor != null) (
|
||||||
lib.mkIf config.me.emacs_flavor != null (
|
lib.mkMerge [
|
||||||
lib.mkMerge [
|
{
|
||||||
(lib.mkIf (config.me.emacs_flavor == "full") {
|
environment.systemPackages = with pkgs; [
|
||||||
environment.systemPackages = with pkgs; [
|
emacs29-pgtk
|
||||||
plainmacs
|
(plainmacs emacs29-pgtk)
|
||||||
e_shorthand
|
(e_shorthand emacs29-pgtk)
|
||||||
emacs_full
|
];
|
||||||
];
|
|
||||||
|
|
||||||
nixpkgs.overlays = [
|
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
||||||
(final: prev: {
|
hideMounts = true;
|
||||||
emacs_full = pkgs.symlinkJoin {
|
users.talexander = {
|
||||||
name = "emacs_full";
|
directories = [
|
||||||
paths = [ pkgs.emacs29-pgtk ];
|
".config/emacs/eln-cache" # Installed packages
|
||||||
buildInputs = [ pkgs.makeWrapper ];
|
".config/emacs/elpa" # Installed packages
|
||||||
postBuild = ''
|
".config/emacs/private" # For recentf
|
||||||
wrapProgram $out/bin/emacs --prefix PATH : ${
|
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
|
||||||
lib.makeBinPath [
|
];
|
||||||
(pkgs.aspellWithDicts (
|
files = [
|
||||||
dicts: with dicts; [
|
".config/emacs/history" # For savehist
|
||||||
en
|
".config/emacs/.last-package-update-day" # For use-package
|
||||||
en-computers
|
];
|
||||||
]
|
};
|
||||||
))
|
};
|
||||||
pkgs.nixd # nix language server
|
|
||||||
pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd
|
|
||||||
pkgs.clang # To compile tree-sitter grammars
|
|
||||||
pkgs.shellcheck
|
|
||||||
]
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
})
|
|
||||||
];
|
|
||||||
|
|
||||||
home-manager.users.talexander =
|
environment.variables.EDITOR = "${pkgs.emacs29-pgtk}/bin/plainmacs";
|
||||||
{ pkgs, ... }:
|
}
|
||||||
{
|
(lib.mkIf (config.me.emacs_flavor == "full") {
|
||||||
home.file.".config/emacs" = {
|
nixpkgs.overlays = [
|
||||||
source = ./files/emacs;
|
(final: prev: {
|
||||||
recursive = true;
|
emacs29-pgtk = pkgs.buildEnv {
|
||||||
};
|
name = prev.emacs29-pgtk.name;
|
||||||
|
paths = with prev; [
|
||||||
|
emacs29-pgtk
|
||||||
|
];
|
||||||
|
extraOutputsToInstall = [
|
||||||
|
"man"
|
||||||
|
"doc"
|
||||||
|
"info"
|
||||||
|
];
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
postBuild = ''
|
||||||
|
wrapProgram $out/bin/emacs --prefix PATH : ${
|
||||||
|
lib.makeBinPath [
|
||||||
|
(pkgs.aspellWithDicts (
|
||||||
|
dicts: with dicts; [
|
||||||
|
en
|
||||||
|
en-computers
|
||||||
|
]
|
||||||
|
))
|
||||||
|
pkgs.nixd # nix language server
|
||||||
|
pkgs.nixfmt-rfc-style # auto-formatting nix files through nixd
|
||||||
|
pkgs.clang # To compile tree-sitter grammars
|
||||||
|
pkgs.shellcheck
|
||||||
|
]
|
||||||
|
}
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
home-manager.users.talexander =
|
||||||
hideMounts = true;
|
{ pkgs, ... }:
|
||||||
users.talexander = {
|
{
|
||||||
directories = [
|
home.file.".config/emacs" = {
|
||||||
".config/emacs/eln-cache" # Installed packages
|
source = ./files/emacs;
|
||||||
".config/emacs/elpa" # Installed packages
|
recursive = true;
|
||||||
".config/emacs/private" # For recentf
|
|
||||||
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
|
|
||||||
];
|
|
||||||
files = [
|
|
||||||
".config/emacs/history" # For savehist
|
|
||||||
".config/emacs/.last-package-update-day" # For use-package
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
})
|
||||||
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
|
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
|
||||||
})
|
nixpkgs.overlays = [
|
||||||
(lib.mkIf (config.me.emacs_flavor == "plainmacs") {
|
(final: prev: {
|
||||||
environment.systemPackages = with pkgs; [
|
emacs29-pgtk = pkgs.buildEnv {
|
||||||
emacs29-pgtk
|
name = prev.emacs29-pgtk.name;
|
||||||
plainmacs
|
paths = with prev; [
|
||||||
plain_e_shorthand
|
emacs29-pgtk
|
||||||
];
|
|
||||||
|
|
||||||
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) {
|
|
||||||
hideMounts = true;
|
|
||||||
users.talexander = {
|
|
||||||
directories = [
|
|
||||||
".config/emacs/eln-cache" # Installed packages
|
|
||||||
".config/emacs/elpa" # Installed packages
|
|
||||||
".config/emacs/private" # For recentf
|
|
||||||
".config/emacs/tree-sitter" # Compiled tree-sitter grammars
|
|
||||||
];
|
];
|
||||||
files = [
|
extraOutputsToInstall = [
|
||||||
".config/emacs/history" # For savehist
|
"man"
|
||||||
".config/emacs/.last-package-update-day" # For use-package
|
"doc"
|
||||||
|
"info"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
})
|
||||||
|
];
|
||||||
environment.variables.EDITOR = "${plainmacs}/bin/plainmacs";
|
})
|
||||||
})
|
]
|
||||||
]
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user