emacs server

This commit is contained in:
Philipp Hochkamp 2022-09-05 21:30:29 +02:00
parent 8af7ea5958
commit 0378909589
4 changed files with 112 additions and 84 deletions

View file

@ -1,7 +1,7 @@
{ inputs, config, lib, pkgs, ... }: { inputs, config, lib, pkgs, ... }:
{ {
home.stateVersion = lib.mkDefault "21.05"; home.stateVersion = lib.mkDefault "22.05";
home.packages = with pkgs; [ home.packages = with pkgs; [
my.scripts my.scripts
@ -46,34 +46,34 @@
}; };
programs = { programs = {
gpg = { # gpg = {
enable = true; # enable = true;
settings = { # settings = {
cert-digest-algo = "SHA512"; # cert-digest-algo = "SHA512";
charset = "utf-8"; # charset = "utf-8";
default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed"; # default-preference-list = "SHA512 SHA384 SHA256 AES256 AES192 AES ZLIB BZIP2 ZIP Uncompressed";
auto-key-retrieve = true; # auto-key-retrieve = true;
fixed-list-mode = true; # fixed-list-mode = true;
keyserver = "hkps://keyserver.ubuntu.com:443"; # keyserver = "hkps://keyserver.ubuntu.com:443";
list-options = [ "show-uid-validity" "show-unusable-subkeys" ]; # list-options = [ "show-uid-validity" "show-unusable-subkeys" ];
no-comments = true; # no-comments = true;
no-emit-version = true; # no-emit-version = true;
no-greeting = true; # no-greeting = true;
no-symkey-cache = true; # no-symkey-cache = true;
personal-cipher-preferences = "AES256 AES192 AES"; # personal-cipher-preferences = "AES256 AES192 AES";
personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed"; # personal-compress-preferences = "ZLIB BZIP2 ZIP Uncompressed";
personal-digest-preferences = "SHA512 SHA384 SHA256"; # personal-digest-preferences = "SHA512 SHA384 SHA256";
require-cross-certification = true; # require-cross-certification = true;
s2k-cipher-algo = "AES256"; # s2k-cipher-algo = "AES256";
s2k-digest-algo = "SHA512"; # s2k-digest-algo = "SHA512";
throw-keyids = true; # throw-keyids = true;
use-agent = true; # use-agent = true;
verbose = true; # verbose = true;
verify-options = "show-uid-validity"; # verify-options = "show-uid-validity";
with-fingerprint = true; # with-fingerprint = true;
with-key-origin = true; # with-key-origin = true;
}; # };
}; # };
bat = { bat = {
enable = true; enable = true;
config.theme = "gruvbox-dark"; config.theme = "gruvbox-dark";

View file

@ -47,3 +47,9 @@ n ()
rm -f "$NNN_TMPFILE" > /dev/null rm -f "$NNN_TMPFILE" > /dev/null
fi fi
} }
ORIGTMPDIR=$TMPDIR # nix-shell overrides tmpdir, but we want to save it
emacsclient ()
{
command emacsclient -s $ORIGTMPDIR/emacs$(id -u)/server "$@"
}

View file

@ -1,12 +1,18 @@
{ pkgs, inputs, lib, ... }: { pkgs, inputs, lib, ... }:
with lib; with lib;
with lib.my; with lib.my;
let
myEmacs = pkgs.emacsNativeComp;
in
{ {
users.users.ragon = { users.users.ragon = {
name = "ragon"; name = "ragon";
home = "/Users/ragon"; home = "/Users/ragon";
}; };
environment.systemPackages = [
myEmacs
];
homebrew = { homebrew = {
enable = true; enable = true;
@ -42,16 +48,30 @@ with lib.my;
#}; #};
}; };
launchd.user.agents.emacsdaemon = {
script = "${myEmacs}/Applications/Emacs.app/Contents/MacOS/Emacs --daemon";
serviceConfig.RunAtLoad = true;
serviceConfig.UserName = "ragon";
serviceConfig.KeepAlive = true;
serviceConfig.WorkingDirectory = "/Users/ragon";
};
programs.gnupg.agent.enable = true; programs.gnupg.agent.enable = true;
home-manager.users.ragon = { pkgs, lib, inputs, config, ... }: { home-manager.users.ragon = { pkgs, lib, inputs, config, ... }:
home.file.".hammerspoon/init.lua".source = ./hammerspoon.lua; {
home.file.".hammerspoon/init.lua".source =
pkgs.substituteAll {
src = ./hammerspoon.lua; inherit myEmacs; };
programs.home-manager.enable = true; programs.home-manager.enable = true;
home.stateVersion = "21.11"; home.stateVersion = "21.11";
home.shellAliases = {
v = lib.mkForce "emacsclient -t";
vv = lib.mkForce "emacsclient -c";
};
home.sessionVariables = { home.sessionVariables = {
EDITOR = "nvim"; EDITOR = "emacsclient -t";
VISUAL = "nvim"; VISUAL = "emacsclient -c";
PATH = "$PATH:$HOME/go/bin:$HOME/development/flutter/bin:/Applications/Android Studio.app/Contents/bin/:/Applications/Docker.app/Contents/Resources/bin:/Applications/Android Studio.app/Contents/jre/Contents/Home/bin"; PATH = "$PATH:$HOME/go/bin:$HOME/development/flutter/bin:/Applications/Android Studio.app/Contents/bin/:/Applications/Docker.app/Contents/Resources/bin:/Applications/Android Studio.app/Contents/jre/Contents/Home/bin";
JAVA_HOME = "/Applications/Android Studio.app/Contents/jre/Contents/Home/"; JAVA_HOME = "/Applications/Android Studio.app/Contents/jre/Contents/Home/";
}; };
@ -59,7 +79,6 @@ with lib.my;
terraform-ls terraform-ls
terraform terraform
emacsNativeComp
cmake cmake
pandoc pandoc

View file

@ -88,9 +88,12 @@ function showHideBundleId(bundleId)
end end
local hyperModifier = {"cmd", "shift", "ctrl", "alt"} local hyperModifier = {"cmd", "shift", "ctrl", "alt"}
local cmdShiftModifier = {"cmd", "shift"}
hs.hotkey.bind(hyperModifier, "b", function() showHideBundleId("com.bitwarden.desktop") end) hs.hotkey.bind(hyperModifier, "b", function() showHideBundleId("com.bitwarden.desktop") end)
hs.hotkey.bind(hyperModifier, "p", function() showHideBundleId("com.timeular.zei") end) hs.hotkey.bind(hyperModifier, "p", function() showHideBundleId("com.timeular.zei") end)
hs.hotkey.bind(hyperModifier, "l", function() showHideBundleId("com.electron.logseq") end) hs.hotkey.bind(hyperModifier, "l", function() showHideBundleId("com.electron.logseq") end)
hs.hotkey.bind(hyperModifier, "e", function() hs.task.new("@myEmacs@/bin/emacsclient", nil, function() return false end, {"-c"}):start() end)
hs.hotkey.bind(hyperModifier, "i", function() hs.task.new("@myEmacs@/bin/emacsclient", nil, function() return false end, {"--eval", "(emacs-everywhere)"}):start() end)
---------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------
-- Tiling -- Tiling