-
Notifications
You must be signed in to change notification settings - Fork 0
/
posimacs.nix
85 lines (75 loc) · 2.78 KB
/
posimacs.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
{ emacs-jinx, emacs-vterm, rust, emacs-overlay, emacs29-src }:
{ config, pkgs, lib, ... }:
let
cfg = config.posimacs;
in {
options.posimacs = {
aliases = lib.mkOption {
default = pkgs.stdenv.isLinux;
example = true;
description = "Succinct shortcuts";
type = lib.types.bool;
};
};
# import modules within modules for composition / dependency
imports = [
emacs-jinx
emacs-vterm
rust
];
config = {
# customizing the build or version of an Emacs package
nixpkgs.overlays = [
emacs-overlay.overlays.default
(final : prev: {
emacs29 = prev.emacsGit.overrideAttrs (old: {
name = "emacs29";
version = emacs29-src.shortRev;
src = emacs29-src;
});
})
];
# Install packages from the top level package set if your module depends on them
home.packages = with pkgs; [
ripgrep # projectile-ripgrep function relies on this
roboto
roboto-mono
roboto-slab
symbola # Emacs can use this font to override symbols
];
programs.emacs = {
package = pkgs.emacs29;
enable = true;
};
# Fontconfig will ensure that fonts installed in home.packages
# are available
fonts.fontconfig.enable = true;
programs.bash.shellAliases = lib.mkIf cfg.aliases (if config.services.emacs.enable then {
"nano" = "emacsclient --create-frame"; # How to break a nano habit
# "nano" = "emacsclient -nw --create-frame"; # Terminal version of above
"emacs" = "emacsclient --create-frame"; # Don't re-use frames
"vi" = "emacsclient --create-frame";
"vim" = "emacsclient --create-frame";
} else {
"nano" = "emacs";
"vi" = "emacs";
"vim" = "emacs";
});
home.sessionVariables = lib.mkIf cfg.aliases (if config.services.emacs.enable then {
# Use a new client window and fall back to terminal standalone if client fails
EDITOR = "emacsclient --create-frame";
ALTERNATE_EDITOR = "TERM=xterm-256color emacs -nw";
} else {
# Use standalone GUI emacs and fall back to terminal if GUI cannot load
EDITOR = "emacs";
ALTERNATE_EDITOR = "TERM=xterm-256color emacs -nw";
});
# pre-install fonts for all-the-icons
home.file.".local/share/fonts/all-the-icons.ttf".source = ./fonts/all-the-icons.ttf;
home.file.".local/share/fonts/file-icons.ttf".source = ./fonts/file-icons.ttf;
home.file.".local/share/fonts/fontawesome.ttf".source = ./fonts/fontawesome.ttf;
home.file.".local/share/fonts/material-design-icons.ttf".source = ./fonts/material-design-icons.ttf;
home.file.".local/share/fonts/octicons.ttf".source = ./fonts/octicons.ttf;
home.file.".local/share/fonts/weathericons.ttf".source = ./fonts/weathericons.ttf;
};
}