From 58eed80caccb9d301ce28d4914b21c2f3e514800 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Mon, 8 Nov 2021 07:13:09 +0100 Subject: [PATCH 01/16] Rename homes/{softwares => programs} --- homes/julm.nix | 4 ++-- homes/programs.nix | 22 +++++++++++++++++++ homes/{softwares => programs}/Xmodmap | 0 homes/{softwares => programs}/aria2c.nix | 0 homes/{softwares => programs}/bash.nix | 0 homes/{softwares => programs}/direnv.nix | 0 homes/{softwares => programs}/emacs.nix | 0 homes/{softwares => programs}/firefox.nix | 0 .../firefox/userChrome.css | 0 homes/{softwares => programs}/ghc.nix | 0 homes/{softwares => programs}/git.nix | 0 homes/{softwares => programs}/gnupg.nix | 0 .../gnupg/keyserver.pem | 0 homes/{softwares => programs}/htop.nix | 0 homes/{softwares => programs}/irssi.nix | 0 .../irssi/default.theme | 0 homes/{softwares => programs}/mcabberrc | 0 homes/{softwares => programs}/mpv.nix | 0 homes/{softwares => programs}/redshift.nix | 0 homes/{softwares => programs}/ssh.nix | 0 .../{softwares => programs}/stack/config.yaml | 0 homes/{softwares => programs}/tmux.conf | 0 homes/{softwares => programs}/tmux.nix | 0 homes/{softwares => programs}/urxvt.nix | 0 homes/{softwares => programs}/vim.nix | 0 .../vim/LanguageClient.vim | 0 homes/{softwares => programs}/vim/ale.vim | 0 .../vim/coc-settings.json | 0 homes/{softwares => programs}/vim/coc.vim | 0 homes/{softwares => programs}/vim/init.vim | 0 .../{softwares => programs}/vim/syntastic.vim | 0 homes/{softwares => programs}/xmonad.nix | 0 .../{softwares => programs}/xmonad/xmobar.hs | 0 .../{softwares => programs}/xmonad/xmonad.hs | 0 homes/{softwares => programs}/zsh.nix | 0 homes/sevy.nix | 2 +- homes/softwares.nix | 22 ------------------- 37 files changed, 25 insertions(+), 25 deletions(-) create mode 100644 homes/programs.nix rename homes/{softwares => programs}/Xmodmap (100%) rename homes/{softwares => programs}/aria2c.nix (100%) rename homes/{softwares => programs}/bash.nix (100%) rename homes/{softwares => programs}/direnv.nix (100%) rename homes/{softwares => programs}/emacs.nix (100%) rename homes/{softwares => programs}/firefox.nix (100%) rename homes/{softwares => programs}/firefox/userChrome.css (100%) rename homes/{softwares => programs}/ghc.nix (100%) rename homes/{softwares => programs}/git.nix (100%) rename homes/{softwares => programs}/gnupg.nix (100%) rename homes/{softwares => programs}/gnupg/keyserver.pem (100%) rename homes/{softwares => programs}/htop.nix (100%) rename homes/{softwares => programs}/irssi.nix (100%) rename homes/{softwares => programs}/irssi/default.theme (100%) rename homes/{softwares => programs}/mcabberrc (100%) rename homes/{softwares => programs}/mpv.nix (100%) rename homes/{softwares => programs}/redshift.nix (100%) rename homes/{softwares => programs}/ssh.nix (100%) rename homes/{softwares => programs}/stack/config.yaml (100%) rename homes/{softwares => programs}/tmux.conf (100%) rename homes/{softwares => programs}/tmux.nix (100%) rename homes/{softwares => programs}/urxvt.nix (100%) rename homes/{softwares => programs}/vim.nix (100%) rename homes/{softwares => programs}/vim/LanguageClient.vim (100%) rename homes/{softwares => programs}/vim/ale.vim (100%) rename homes/{softwares => programs}/vim/coc-settings.json (100%) rename homes/{softwares => programs}/vim/coc.vim (100%) rename homes/{softwares => programs}/vim/init.vim (100%) rename homes/{softwares => programs}/vim/syntastic.vim (100%) rename homes/{softwares => programs}/xmonad.nix (100%) rename homes/{softwares => programs}/xmonad/xmobar.hs (100%) rename homes/{softwares => programs}/xmonad/xmonad.hs (100%) rename homes/{softwares => programs}/zsh.nix (100%) delete mode 100644 homes/softwares.nix diff --git a/homes/julm.nix b/homes/julm.nix index e55ad14..b9fd357 100644 --- a/homes/julm.nix +++ b/homes/julm.nix @@ -1,7 +1,7 @@ { pkgs, lib, config, hostName, ... }: { imports = [ - ./softwares.nix + ./programs.nix ./options.nix julm/mutt.nix (import (julm/hosts + "/${hostName}.nix")) @@ -19,7 +19,7 @@ programs.firefox = { "security.identityblock.show_extended_validation" = true; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; }; - userChrome = builtins.readFile softwares/firefox/userChrome.css; + userChrome = builtins.readFile programs/firefox/userChrome.css; }; in { "rp4xy6ye.2021" = lib.mkMerge [defaultProfile { id = 0; diff --git a/homes/programs.nix b/homes/programs.nix new file mode 100644 index 0000000..881bde8 --- /dev/null +++ b/homes/programs.nix @@ -0,0 +1,22 @@ +{ +imports = [ + programs/aria2c.nix + programs/bash.nix + programs/direnv.nix + programs/emacs.nix + programs/firefox.nix + programs/ghc.nix + programs/git.nix + programs/gnupg.nix + programs/htop.nix + programs/irssi.nix + programs/mpv.nix + programs/redshift.nix + programs/ssh.nix + programs/tmux.nix + programs/urxvt.nix + programs/vim.nix + programs/xmonad.nix + programs/zsh.nix +]; +} diff --git a/homes/softwares/Xmodmap b/homes/programs/Xmodmap similarity index 100% rename from homes/softwares/Xmodmap rename to homes/programs/Xmodmap diff --git a/homes/softwares/aria2c.nix b/homes/programs/aria2c.nix similarity index 100% rename from homes/softwares/aria2c.nix rename to homes/programs/aria2c.nix diff --git a/homes/softwares/bash.nix b/homes/programs/bash.nix similarity index 100% rename from homes/softwares/bash.nix rename to homes/programs/bash.nix diff --git a/homes/softwares/direnv.nix b/homes/programs/direnv.nix similarity index 100% rename from homes/softwares/direnv.nix rename to homes/programs/direnv.nix diff --git a/homes/softwares/emacs.nix b/homes/programs/emacs.nix similarity index 100% rename from homes/softwares/emacs.nix rename to homes/programs/emacs.nix diff --git a/homes/softwares/firefox.nix b/homes/programs/firefox.nix similarity index 100% rename from homes/softwares/firefox.nix rename to homes/programs/firefox.nix diff --git a/homes/softwares/firefox/userChrome.css b/homes/programs/firefox/userChrome.css similarity index 100% rename from homes/softwares/firefox/userChrome.css rename to homes/programs/firefox/userChrome.css diff --git a/homes/softwares/ghc.nix b/homes/programs/ghc.nix similarity index 100% rename from homes/softwares/ghc.nix rename to homes/programs/ghc.nix diff --git a/homes/softwares/git.nix b/homes/programs/git.nix similarity index 100% rename from homes/softwares/git.nix rename to homes/programs/git.nix diff --git a/homes/softwares/gnupg.nix b/homes/programs/gnupg.nix similarity index 100% rename from homes/softwares/gnupg.nix rename to homes/programs/gnupg.nix diff --git a/homes/softwares/gnupg/keyserver.pem b/homes/programs/gnupg/keyserver.pem similarity index 100% rename from homes/softwares/gnupg/keyserver.pem rename to homes/programs/gnupg/keyserver.pem diff --git a/homes/softwares/htop.nix b/homes/programs/htop.nix similarity index 100% rename from homes/softwares/htop.nix rename to homes/programs/htop.nix diff --git a/homes/softwares/irssi.nix b/homes/programs/irssi.nix similarity index 100% rename from homes/softwares/irssi.nix rename to homes/programs/irssi.nix diff --git a/homes/softwares/irssi/default.theme b/homes/programs/irssi/default.theme similarity index 100% rename from homes/softwares/irssi/default.theme rename to homes/programs/irssi/default.theme diff --git a/homes/softwares/mcabberrc b/homes/programs/mcabberrc similarity index 100% rename from homes/softwares/mcabberrc rename to homes/programs/mcabberrc diff --git a/homes/softwares/mpv.nix b/homes/programs/mpv.nix similarity index 100% rename from homes/softwares/mpv.nix rename to homes/programs/mpv.nix diff --git a/homes/softwares/redshift.nix b/homes/programs/redshift.nix similarity index 100% rename from homes/softwares/redshift.nix rename to homes/programs/redshift.nix diff --git a/homes/softwares/ssh.nix b/homes/programs/ssh.nix similarity index 100% rename from homes/softwares/ssh.nix rename to homes/programs/ssh.nix diff --git a/homes/softwares/stack/config.yaml b/homes/programs/stack/config.yaml similarity index 100% rename from homes/softwares/stack/config.yaml rename to homes/programs/stack/config.yaml diff --git a/homes/softwares/tmux.conf b/homes/programs/tmux.conf similarity index 100% rename from homes/softwares/tmux.conf rename to homes/programs/tmux.conf diff --git a/homes/softwares/tmux.nix b/homes/programs/tmux.nix similarity index 100% rename from homes/softwares/tmux.nix rename to homes/programs/tmux.nix diff --git a/homes/softwares/urxvt.nix b/homes/programs/urxvt.nix similarity index 100% rename from homes/softwares/urxvt.nix rename to homes/programs/urxvt.nix diff --git a/homes/softwares/vim.nix b/homes/programs/vim.nix similarity index 100% rename from homes/softwares/vim.nix rename to homes/programs/vim.nix diff --git a/homes/softwares/vim/LanguageClient.vim b/homes/programs/vim/LanguageClient.vim similarity index 100% rename from homes/softwares/vim/LanguageClient.vim rename to homes/programs/vim/LanguageClient.vim diff --git a/homes/softwares/vim/ale.vim b/homes/programs/vim/ale.vim similarity index 100% rename from homes/softwares/vim/ale.vim rename to homes/programs/vim/ale.vim diff --git a/homes/softwares/vim/coc-settings.json b/homes/programs/vim/coc-settings.json similarity index 100% rename from homes/softwares/vim/coc-settings.json rename to homes/programs/vim/coc-settings.json diff --git a/homes/softwares/vim/coc.vim b/homes/programs/vim/coc.vim similarity index 100% rename from homes/softwares/vim/coc.vim rename to homes/programs/vim/coc.vim diff --git a/homes/softwares/vim/init.vim b/homes/programs/vim/init.vim similarity index 100% rename from homes/softwares/vim/init.vim rename to homes/programs/vim/init.vim diff --git a/homes/softwares/vim/syntastic.vim b/homes/programs/vim/syntastic.vim similarity index 100% rename from homes/softwares/vim/syntastic.vim rename to homes/programs/vim/syntastic.vim diff --git a/homes/softwares/xmonad.nix b/homes/programs/xmonad.nix similarity index 100% rename from homes/softwares/xmonad.nix rename to homes/programs/xmonad.nix diff --git a/homes/softwares/xmonad/xmobar.hs b/homes/programs/xmonad/xmobar.hs similarity index 100% rename from homes/softwares/xmonad/xmobar.hs rename to homes/programs/xmonad/xmobar.hs diff --git a/homes/softwares/xmonad/xmonad.hs b/homes/programs/xmonad/xmonad.hs similarity index 100% rename from homes/softwares/xmonad/xmonad.hs rename to homes/programs/xmonad/xmonad.hs diff --git a/homes/softwares/zsh.nix b/homes/programs/zsh.nix similarity index 100% rename from homes/softwares/zsh.nix rename to homes/programs/zsh.nix diff --git a/homes/sevy.nix b/homes/sevy.nix index 111404f..5c89f30 100644 --- a/homes/sevy.nix +++ b/homes/sevy.nix @@ -1,7 +1,7 @@ { pkgs, lib, config, hostName, ... }: { imports = [ - ./softwares.nix + ./programs.nix ./options.nix ]; host.desktop = diff --git a/homes/softwares.nix b/homes/softwares.nix deleted file mode 100644 index be38af8..0000000 --- a/homes/softwares.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ -imports = [ - softwares/aria2c.nix - softwares/bash.nix - softwares/direnv.nix - softwares/emacs.nix - softwares/firefox.nix - softwares/ghc.nix - softwares/git.nix - softwares/gnupg.nix - softwares/htop.nix - softwares/irssi.nix - softwares/mpv.nix - softwares/redshift.nix - softwares/ssh.nix - softwares/tmux.nix - softwares/urxvt.nix - softwares/vim.nix - softwares/xmonad.nix - softwares/zsh.nix -]; -} -- 2.44.1 From 4945d2d005f87051b59e0fd1895745a01975679b Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Mon, 8 Nov 2021 07:15:23 +0100 Subject: [PATCH 02/16] Add xmobar tip --- homes/programs/xmonad/xmobar.hs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/homes/programs/xmonad/xmobar.hs b/homes/programs/xmonad/xmobar.hs index a509423..3e0432a 100644 --- a/homes/programs/xmonad/xmobar.hs +++ b/homes/programs/xmonad/xmobar.hs @@ -43,6 +43,9 @@ Config { , "--normal", "orange" , "--high", "red" ] 10 + -- Note that reloading xmonad is needed (Win+End) + -- to detect network interfaces brought + -- after xmonad has started (eg. over USB). , Run DynNetwork [ "--template", ":Tx:|Rx:kB/s" , "--Low", "20000" -- units: B/s -- 2.44.1 From b96d754694e9487cfbdb08b756b1a99cb0622bd7 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Mon, 8 Nov 2021 09:03:25 +0100 Subject: [PATCH 03/16] vim: use the new hls instead of hie --- homes/programs/vim/ale.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/homes/programs/vim/ale.vim b/homes/programs/vim/ale.vim index 4e06efc..708eecc 100644 --- a/homes/programs/vim/ale.vim +++ b/homes/programs/vim/ale.vim @@ -1,12 +1,11 @@ let g:ale_linters = { -\ 'haskell': ['hie'], +\ 'haskell': ['hls'], \} let b:ale_fixers = { -\ 'haskell': ['hie', 'hlint'] +\ 'haskell': ['hls', 'hlint'] \} -"let g:ale_command_wrapper = 'nice -n5 %*' -"let g:ale_haskell_hie_executable = 'hie-wrapper' -let g:ale_haskell_hie_executable = 'haskell-language-server-wrapper' +let g:ale_command_wrapper = 'nice -n5 %*' +let g:ale_haskell_hls_executable = 'haskell-language-server-wrapper' let g:ale_close_preview_on_insert = 1 let g:ale_cursor_detail = 0 -- 2.44.1 From 4736edb99003ea734c0e56639a963d339a8080f6 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 11 Nov 2021 02:54:46 +0100 Subject: [PATCH 04/16] font: improve on emacs --- homes/programs/emacs.nix | 14 +++++++++++++- homes/programs/urxvt.nix | 2 +- homes/programs/xmonad.nix | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/homes/programs/emacs.nix b/homes/programs/emacs.nix index ad5e022..16b6db1 100644 --- a/homes/programs/emacs.nix +++ b/homes/programs/emacs.nix @@ -40,9 +40,10 @@ home.sessionVariables = { DOOMLOCALDIR = "${config.xdg.configHome}/doom-local"; }; xdg.configFile = { + #"doom-config/cli.el".text = ""; #"doom-config/config.el".source = emacs/config.el; #"doom-config/init.el".source = emacs/init.el; - "doom-config/packages.el".text = ""; + #"doom-config/packages.el".text = ""; "emacs" = { source = inputs.doom-emacs; onChange = "${pkgs.writeShellScript "doom-change" '' @@ -56,5 +57,16 @@ xdg.configFile = { ''}"; }; }; +xresources.properties = { + # Enable subpixel rendering + # https://bbs.archlinux.org/viewtopic.php?pid=1080864#p1080864 + # https://www.emacswiki.org/emacs/XftGnuEmacs#h5o-17 + "Xft.antialias" = "rgba"; + "Xft.hinting" = true; + "Xft.hintstyle" = "hintfull"; + "Xft.rgba" = "rgb"; + "Emacs.FontBackend" = "xft"; + "Xft.embolden" = true; +}; }; } diff --git a/homes/programs/urxvt.nix b/homes/programs/urxvt.nix index f57a403..fff32f8 100644 --- a/homes/programs/urxvt.nix +++ b/homes/programs/urxvt.nix @@ -8,7 +8,7 @@ xresources.properties = { "URxvt*cutchars" = ''"()*,;<>[]{}|│`\"'#::、。"''; "URxvt*depth" = "32"; "URxvt*fading" = "0"; - "URxvt*font" = "xft:DejaVu Sans Mono:size=7.38"; + "URxvt*font" = "xft:DejaVu Sans Mono:size=6"; "URxvt*font-size.step" = "1"; "URxvt*foreground" = "white"; "URxvt*geometry" = "61x20"; diff --git a/homes/programs/xmonad.nix b/homes/programs/xmonad.nix index 6b77f29..608cb38 100644 --- a/homes/programs/xmonad.nix +++ b/homes/programs/xmonad.nix @@ -45,15 +45,16 @@ services.screen-locker = { }; home.packages = [ pkgs.acpilight + pkgs.copyq pkgs.gmrun pkgs.light pkgs.mate.caja - pkgs.copyq pkgs.rxvt-unicode pkgs.scrot pkgs.stalonetray pkgs.wmname pkgs.xmobar + pkgs.xorg.appres pkgs.xorg.xev pkgs.xorg.xhost pkgs.xorg.xmodmap -- 2.44.1 From 07c6822851a7a6a88adb4bbb5a62081370135738 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 11 Nov 2021 16:17:51 +0100 Subject: [PATCH 05/16] wireguard: enable peer filtering --- hosts/oignon/wireguard.nix | 2 ++ nixos/profiles/wireguard/wg-intra.nix | 35 ++++++++++++------- .../wg-intra/{hosts.nix => peers.nix} | 0 3 files changed, 25 insertions(+), 12 deletions(-) rename nixos/profiles/wireguard/wg-intra/{hosts.nix => peers.nix} (100%) diff --git a/hosts/oignon/wireguard.nix b/hosts/oignon/wireguard.nix index 9d724c0..97bdb5c 100644 --- a/hosts/oignon/wireguard.nix +++ b/hosts/oignon/wireguard.nix @@ -1,5 +1,7 @@ { pkgs, lib, config, hostName, private, ... }: { +networking.wireguard.wg-intra.peers.mermet.enable = true; +networking.wireguard.wg-intra.peers.losurdo.enable = true; networking.hosts."192.168.42.2" = [ "sourcephile.wg" "builds.sourcephile.wg" diff --git a/nixos/profiles/wireguard/wg-intra.nix b/nixos/profiles/wireguard/wg-intra.nix index add589a..297bc28 100644 --- a/nixos/profiles/wireguard/wg-intra.nix +++ b/nixos/profiles/wireguard/wg-intra.nix @@ -1,21 +1,31 @@ { pkgs, lib, config, hostName, private, ... }: let iface = "wg-intra"; - hosts = import wg-intra/hosts.nix; + peers = import wg-intra/peers.nix; wg = config.networking.wireguard.interfaces.${iface}; in { +options.networking.wireguard.${iface}.peers = + lib.genAttrs (lib.attrNames peers) (peerName: { + enable = lib.mkEnableOption "this peer"; + }); +config = { networking.wireguard.interfaces.${iface} = lib.recursiveUpdate - (removeAttrs hosts.${hostName} ["ipv4" "persistentKeepalive" "peer"]) + (removeAttrs peers.${hostName} ["ipv4" "persistentKeepalive" "peer"]) { peers = - lib.mapAttrsToList (peerName: peer: lib.recursiveUpdate - { persistentKeepalive = - peer.persistentKeepalive # Useful if this peer is behind a NAT - or hosts.${hostName}.persistentKeepalive # Useful if this host is behind a NAT - or null; } - peer.peer - ) (removeAttrs hosts [hostName]); + lib.mapAttrsToList (peerName: peer: + lib.recursiveUpdate + { + persistentKeepalive = + peer.persistentKeepalive # Useful if this peer is behind a NAT + or peers.${hostName}.persistentKeepalive # Useful if this host is behind a NAT + or null; + } + peer.peer) + (removeAttrs + (lib.filterAttrs (peerName: _: config.networking.wireguard.${iface}.peers.${peerName}.enable) peers) + [hostName]); privateKeyFile = lib.mkDefault "${private}/${hostName}/wireguard/${iface}/privateKey"; # Set the MTU to a minimum @@ -28,8 +38,8 @@ networking.wireguard.interfaces.${iface} = lib.recursiveUpdate }; networking.hosts = lib.mkMerge [ (lib.mapAttrs' (hostName: host: - lib.nameValuePair host.ipv4 [ "${hostName}.wg" ]) hosts) - { "${hosts.losurdo.ipv4}" = [ + lib.nameValuePair host.ipv4 [ "${hostName}.wg" ]) peers) + { "${peers.losurdo.ipv4}" = [ "nix-extracache.losurdo.wg" "nix-localcache.losurdo.wg" ]; } @@ -41,5 +51,6 @@ networking.firewall.extraCommands = '' ''; services.fail2ban.ignoreIP = lib.concatMap (host: host.peer.allowedIPs) - (lib.attrValues hosts); + (lib.attrValues peers); +}; } diff --git a/nixos/profiles/wireguard/wg-intra/hosts.nix b/nixos/profiles/wireguard/wg-intra/peers.nix similarity index 100% rename from nixos/profiles/wireguard/wg-intra/hosts.nix rename to nixos/profiles/wireguard/wg-intra/peers.nix -- 2.44.1 From 403b088c3770b79443ad1fdb730621c92d8f6182 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Fri, 12 Nov 2021 10:38:32 +0100 Subject: [PATCH 06/16] fonts: add font Hack --- homes/programs/emacs.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homes/programs/emacs.nix b/homes/programs/emacs.nix index 16b6db1..e5ff567 100644 --- a/homes/programs/emacs.nix +++ b/homes/programs/emacs.nix @@ -20,12 +20,14 @@ services.emacs = { package = config.programs.emacs.package; }; */ +fonts.fontconfig.enable = true; home.packages = with pkgs; [ # DOOM Emacs dependencies binutils (ripgrep.override { withPCRE2 = true; }) - gnutls fd + gnutls + hack-font imagemagick zstd #nodePackages.javascript-typescript-langserver -- 2.44.1 From 5bbf1ff302d3221162ff2ba57ef05d49a8cf8ef2 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Fri, 12 Nov 2021 10:38:53 +0100 Subject: [PATCH 07/16] bash: fix alias vim-git --- homes/programs/bash.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homes/programs/bash.nix b/homes/programs/bash.nix index c36f6a4..f105e4f 100644 --- a/homes/programs/bash.nix +++ b/homes/programs/bash.nix @@ -80,7 +80,7 @@ programs.bash = { done | sort -nk1,1 } - vim-git () { $EDITOR $(git diff-tree --no-commit-id --name-only --recursive "$@"); } + vim-git () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); } vim-git-grep () { $EDITOR $(git grep --name-only --recursive "$@"); } zfs-mount () { for d in $(zfs list -rH -o name "$@"); do sudo zfs mount -l "$d"; done; } zfs-unmount () { sudo zfs unmount -u "$@"; } -- 2.44.1 From 5fc9e1def56bb76608fa3a8a6daf4e3d5a373964 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Fri, 12 Nov 2021 11:30:19 +0100 Subject: [PATCH 08/16] bash: rename aliases --- homes/programs/bash.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/homes/programs/bash.nix b/homes/programs/bash.nix index f105e4f..7d670e5 100644 --- a/homes/programs/bash.nix +++ b/homes/programs/bash.nix @@ -3,6 +3,8 @@ programs.bash = { shellAliases = { cl = "clear"; + eic = "edit-in-commit"; + eigg = "edit-in-git-grep"; g = "git"; grep = "grep --color"; j="sudo journalctl -u"; @@ -23,6 +25,7 @@ programs.bash = { u="systemctl --user"; ut="systemctl --user status"; watch = "watch --color"; + zfs-umount = "zfs-unmount"; }; initExtra = '' shopt -s globstar @@ -80,8 +83,8 @@ programs.bash = { done | sort -nk1,1 } - vim-git () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); } - vim-git-grep () { $EDITOR $(git grep --name-only --recursive "$@"); } + edit-in-commit () { $EDITOR $(git diff-tree --no-commit-id --name-only -r "$@"); } + edit-in-git-grep () { $EDITOR $(git grep --name-only --recursive "$@"); } zfs-mount () { for d in $(zfs list -rH -o name "$@"); do sudo zfs mount -l "$d"; done; } zfs-unmount () { sudo zfs unmount -u "$@"; } ''; -- 2.44.1 From 01e0c621fb814780c4a10b2ddfe0b4a305ac6ccd Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sat, 13 Nov 2021 10:34:51 +0100 Subject: [PATCH 09/16] xft: move config --- homes/programs/emacs.nix | 10 +--------- homes/programs/xmonad.nix | 7 +++++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/homes/programs/emacs.nix b/homes/programs/emacs.nix index e5ff567..33ddb5e 100644 --- a/homes/programs/emacs.nix +++ b/homes/programs/emacs.nix @@ -60,15 +60,7 @@ xdg.configFile = { }; }; xresources.properties = { - # Enable subpixel rendering - # https://bbs.archlinux.org/viewtopic.php?pid=1080864#p1080864 - # https://www.emacswiki.org/emacs/XftGnuEmacs#h5o-17 - "Xft.antialias" = "rgba"; - "Xft.hinting" = true; - "Xft.hintstyle" = "hintfull"; - "Xft.rgba" = "rgb"; - "Emacs.FontBackend" = "xft"; - "Xft.embolden" = true; + #"Emacs.FontBackend" = "xft"; }; }; } diff --git a/homes/programs/xmonad.nix b/homes/programs/xmonad.nix index 608cb38..afd6a94 100644 --- a/homes/programs/xmonad.nix +++ b/homes/programs/xmonad.nix @@ -62,5 +62,12 @@ home.packages = [ pkgs.xsecurelock pkgs.xss-lock ]; +xresources.properties = { + "Xft.antialias" = true; + "Xft.hinting" = true; + "Xft.hintstyle" = "hintfull"; + "Xft.rgba" = "rgb"; + #"Xft.embolden" = true; +}; }; } -- 2.44.1 From 72bbc62b295d937f20550088dd03b1d035d637ec Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sun, 14 Nov 2021 00:27:06 +0100 Subject: [PATCH 10/16] emacs: configure --- homes/programs/bash.nix | 1 + homes/programs/emacs.nix | 20 +- homes/programs/emacs/cli.el | 0 homes/programs/emacs/config.el | 626 +++++++++++++++++++++++++++++++ homes/programs/emacs/custom.el | 0 homes/programs/emacs/init.el | 211 +++++++++++ homes/programs/emacs/packages.el | 14 + 7 files changed, 862 insertions(+), 10 deletions(-) create mode 100644 homes/programs/emacs/cli.el create mode 100644 homes/programs/emacs/config.el create mode 100644 homes/programs/emacs/custom.el create mode 100644 homes/programs/emacs/init.el create mode 100644 homes/programs/emacs/packages.el diff --git a/homes/programs/bash.nix b/homes/programs/bash.nix index 7d670e5..bc0e6bc 100644 --- a/homes/programs/bash.nix +++ b/homes/programs/bash.nix @@ -5,6 +5,7 @@ programs.bash = { cl = "clear"; eic = "edit-in-commit"; eigg = "edit-in-git-grep"; + emacs = "emacs --create-frame"; g = "git"; grep = "grep --color"; j="sudo journalctl -u"; diff --git a/homes/programs/emacs.nix b/homes/programs/emacs.nix index 33ddb5e..8ddb9ea 100644 --- a/homes/programs/emacs.nix +++ b/homes/programs/emacs.nix @@ -1,9 +1,7 @@ { inputs, pkgs, lib, config, ... }: { -options = { - programs.doom-emacs = { - enable = lib.mkEnableOption "doom-emacs"; - }; +options.programs.doom-emacs = { + enable = lib.mkEnableOption "doom-emacs"; }; config = lib.mkIf config.programs.doom-emacs.enable { /* @@ -15,11 +13,13 @@ programs.doom-emacs = { doomPrivateDir = "${config.home.homeDirectory}/.doom.d"; }; +*/ services.emacs = { - #enable = true; # Use with emacsclient -c + enable = true; # Use with emacsclient -c package = config.programs.emacs.package; + client.enable = true; + socketActivation.enable = true; }; -*/ fonts.fontconfig.enable = true; home.packages = with pkgs; [ # DOOM Emacs dependencies @@ -42,10 +42,10 @@ home.sessionVariables = { DOOMLOCALDIR = "${config.xdg.configHome}/doom-local"; }; xdg.configFile = { - #"doom-config/cli.el".text = ""; - #"doom-config/config.el".source = emacs/config.el; - #"doom-config/init.el".source = emacs/init.el; - #"doom-config/packages.el".text = ""; + "doom-config/cli.el".source = emacs/cli.el; + "doom-config/config.el".source = emacs/config.el; + "doom-config/init.el".source = emacs/init.el; + "doom-config/packages.el".source = emacs/packages.el; "emacs" = { source = inputs.doom-emacs; onChange = "${pkgs.writeShellScript "doom-change" '' diff --git a/homes/programs/emacs/cli.el b/homes/programs/emacs/cli.el new file mode 100644 index 0000000..e69de29 diff --git a/homes/programs/emacs/config.el b/homes/programs/emacs/config.el new file mode 100644 index 0000000..cad0dd1 --- /dev/null +++ b/homes/programs/emacs/config.el @@ -0,0 +1,626 @@ +;;; config.el -*- lexical-binding: t; -*- + +;; DOC: https://git.v0.io/hlissner/doom-emacs/src/commit/a680a4c96d2b57fcb75635bd1a918e1235e72890/docs/api.org +;; DOC: https://github.com/daviwil/emacs-from-scratch + +(setq user-full-name "Julien Moutinho" + user-mail-address "julm@sourcephile.fr" + ) + +;; Line numbers are pretty slow all around. The performance boost of +;; disabling them outweighs the utility of always keeping them on. +(setq display-line-numbers-type nil) + +;; Focus new window after splitting +(setq evil-split-window-below t + evil-vsplit-window-right t + ) + +;; Undo +(setq undo-tree-auto-save-history t + undo-tree-history-directory-alist '(("." . "~/.cache/emacs/undo")) + ) + +;; Fonts +(setq doom-font-increment 1 + doom-font-size 9 + ;doom-font-name "DejaVu Sans Mono" + doom-font-name "Hack" + ;doom-font-name "Unifont" + doom-font (font-spec :family doom-font-name :size doom-font-size :antialias t) + doom-unicode-font (font-spec :family "Symbola" :antialias t) + doom-variable-pitch-font (font-spec :family doom-font-name :antialias t) + ivy-posframe-font (font-spec :family doom-font-name :antialias t) + ) +(setq x-underline-at-descent-line t) + +;; Dashboard +;;(setq +doom-dashboard-banner-file (expand-file-name "banner.png" doom-private-dir)) +(defun bury-messages-and-scratch () + (mapcar #'bury-buffer '("*Messages*" "*scratch*"))) +(add-hook 'emacs-startup-hook #'bury-messages-and-scratch) + +;; Formatting +(setq haskell-stylish-on-save nil) +(setq lsp-haskell-formatting-provider "fourmolu") +(setq +format-on-save-enabled-modes + '(not emacs-lisp-mode ; works well enough without it + sql-mode ; sqlformat is broken + tex-mode ; latexindent is broken + latex-mode ; latexindent is broken + bibtex-mode ; is broken + ess-r-mode ; styler takes forever + ) + ) + +;; Theming +(setq doom-theme 'doom-vibrant) +(custom-theme-set-faces! '(doom-vibrant) + '(default :background "black" :foreground "white") + '(hl-line :background "black") + '(cursor :background "DarkOrange" :foreground "black") + ;; Haskell colors + '(font-lock-string-face :foreground "magenta") + '(highlight-numbers-number :foreground "DeepSkyBlue" :bold t) + '(font-lock-comment-face :foreground "cyan3") + '(font-lock-doc-face :foreground "cyan1") + ;'(haskell-constructor-face :foreground "#c4451d") + ;'(haskell-keyword-face :foreground "#af005f") + ;'(haskell-keyword-face :foreground "RoyalBlue") + ;'(haskell-keyword-face :foreground "#44385f") + ;'(haskell-keyword-face :foreground "#906238" :bold t) + ;'(haskell-keyword-face :foreground "green4" :bold t) + '(haskell-keyword-face :foreground "LightGreen" :bold nil) + ;'(haskell-pragma-face :foreground "#2aa198") + '(haskell-pragma-face :foreground "#8f4e8b") + ;'(haskell-type-face :foreground "#9e358f") + '(haskell-operator-face :foreground "yellow" :bold nil) + ;'(haskell-type-face :foreground "SaddleBrown") + ;'(haskell-constructor-face :foreground "darkgoldenrod4") + '(haskell-definition-face :foreground "white" :bold nil) + '(swiper-line-face :background "grey15") + '(swiper-match-face-1 :foreground "grey50" :background "black") ; what is between matches + '(swiper-match-face-2 :foreground "black" :background "yellow2") + '(swiper-match-face-3 :foreground "black" :background "yellow3") + '(swiper-match-face-4 :foreground "black" :background "yellow4") + '(swiper-background-match-face-2 :foreground "black" :background "yellow2") + '(swiper-background-match-face-3 :foreground "black" :background "yellow3") + '(swiper-background-match-face-4 :foreground "black" :background "yellow4") + '(evil-ex-lazy-highlight :foreground "black" :background "yellow2") + '(region :foreground "black" :background "yellow") ; selected area + '(doom-modeline-buffer-modified :foreground "orange") + '(git-gutter-fr:added :foreground "green4" :background "black") + '(git-gutter-fr:deleted :foreground "red4" :background "black") + '(git-gutter-fr:modified :foreground "orange4" :background "black") + '(flycheck-fringe-error :foreground "red") + '(flycheck-fringe-warning :foreground "orange") + '(flycheck-fringe-info :foreground "purple") + '(flycheck-info :underline '(:color "SkyBlue4" :style wave)) + '(flycheck-warning :underline '(:color "orange" :style wave)) + '(flycheck-error :underline '(:color "red" :style wave)) + '(warning :foreground "orange") + '(error :foreground "red") + '(ivy-minibuffer-match-face-1 :foreground "grey50" :background "black") ; what is between matches + '(ivy-minibuffer-match-face-2 :foreground "black" :background "yellow2") + '(ivy-minibuffer-match-face-3 :foreground "black" :background "yellow3") + '(ivy-minibuffer-match-face-4 :foreground "black" :background "yellow4") + ; Violet + ;'(haskell-operator-face :foreground "yellow3") + ;'(haskell-type-face :foreground "#5a4e82") + ;'(haskell-constructor-face :foreground "#8a4f88") + ;'(haskell-constructor-face :foreground "#8a4c87") + '(haskell-constructor-face :foreground "white" :bold t) + ; Almost the same as haskell-constructor-face + ; because that pattern does not match on type-contexts correctly + '(haskell-type-face :foreground "white" :bold t) + '(lsp-face-highlight-read :background "green10") + '(lsp-face-highlight-write :background "green10") + '(mode-line :background "gray20") + '(mode-line-inactive :background "gray5") + '(solaire-default-face :background "gray10") + '(solaire-mode-line-face :background "gray20") + '(solaire-mode-line-inactive-face :background "gray5") + '(doom-modeline-project-dir :foreground "DeepSkyBlue" :bold t) + ;'(magit-diff-context-highlight :foreground "white" :background "black") + '(magit-diff-added-highlight :foreground "green") + '(magit-diff-removed-highlight :foreground "red") + ;;'(font-lock-comment-face ((t (:foreground "cyan" :italic t :slant oblique)))) + ;;'(font-lock-comment-delimiter-face ((t (:foreground "cyan")))) + ;;'(fringe ((t (:foreground "red" :background "black")))) + ;;'(whitespace-indentation ((t (:foreground "gray50" :bold t)))) + ;;'(whitespace-space ((t (:foreground "black" :bold t)))) + ;;'(whitespace-tab ((t (:foreground "gray50" :bold t)))) + ;;'(whitespace-trailing ((t (:foreground "red" :bold t)))) + ;;'(font-lock-builtin-face ((t (:foreground "yellow" :weight bold)))) + ;;'(font-lock-keyword-face ((t (:foreground "yellow" :weight bold)))) + ;;'(font-lock-string-face ((t (:foreground "magenta")))) + ;;'(font-lock-variable-name-face ((t (:foreground "SpringGreen3" :weight bold)))) + ;;'(nix-antiquote-face ((t (:foreground "blue")))) + ;;'(mode-line ((t (:background "midnight blue" :box (:line-width 1 :color "blue") :height 1.0)))) + ;;'(mode-line-inactive ((t (:background "grey30" :foreground "white" :box (:line-width 1 :color "grey30") :weight light :height 1.0)))) + ;;'(mode-line ((t (:family "Noto Sans" :height 0.9)))) + ;;'(mode-line-inactive ((t (:family "Noto Sans" :height 0.9)))) + ;;'(solaire-mode-line-inactive-face ((t (:background "gray10")))) + ) + +;; polymode +(use-package! polymode) +(define-hostmode poly-haskell-hostmode + :mode 'haskell-mode) +;; Support org tables in Haskell files +(defun pm--org-table-tail-matcher (ahead) + (when (re-search-forward "^[^|]" nil t ahead) + (cons (match-beginning 0) (match-end 0)))) +(define-innermode poly-haskell-org-table-innermode + :mode 'org-mode + :head-matcher "^|.*" + :tail-matcher #'pm--org-table-tail-matcher + :head-mode 'body + :tail-mode 'host) +(define-polymode poly-haskell-mode + :hostmode 'poly-haskell-hostmode + :innermodes '(poly-haskell-org-table-innermode)) + +;; Language Server Protocol +(setq ;+lsp-prompt-to-install-server 'quiet + ;lsp-enable-file-watchers nil + ;lsp-enable-indentation nil + ;lsp-enable-on-type-formatting nil + ;lsp-enable-symbol-highlighting nil + lsp-ui-doc-enable nil ; slow + ;lsp-ui-sideline-enable nil ; not anymore useful than flycheck + ;lsp-ui-peek-enable t + ;lsp-ui-peek-always-show nil + ;lsp-ui-flycheck-enable t + ;lsp-ui-flycheck-live-reporting t + ;; Disable help mouse-overs for mode-line segments (i.e. :help-echo text). + ;; They're generally unhelpful and only add confusing visual clutter. + mode-line-default-help-echo nil + show-help-function nil + global-prettify-symbols-mode nil + prettify-symbols-mode -1 + lsp-treemacs-errors-position-params `((side . right)) + lsp-log-io nil ; Only for debugging + ) + +;; The modeline is not useful to me in the popup window. +;; It looks much nicer to hide it. +(remove-hook 'emacs-everywhere-init-hooks #'hide-mode-line-mode) + +;;(remove-hook 'window-setup-hook #'doom-init-theme-h) +;;(add-hook 'after-init-hook #'doom-init-theme-h 'append) +;;(delq! t custom-theme-load-path) + +(setq auto-save-default t ; Nobody likes to loose work, I certainly don't + confirm-kill-emacs nil + make-backup-files nil + password-cache-expiry nil ; I can trust my computers ... can't I? + scroll-margin 10 + ;; scroll-preserve-screen-position 'always ; Don't have `point' jump around + truncate-string-ellipsis "…" ; Unicode ellispis are nicer than "...", and also save /precious/ space + kill-whole-line t ; Make Ctrl-K remove the whole line, instead of just emptying it + undo-limit 80000000 ; Raise undo-limit to 80Mb + x-stretch-cursor nil ; Disorienting + ) + +;; Debugging +;(setq debug-on-quit t) + +;; Haskell +(setq haskell-process-log nil + haskell-interactive-popup-errors nil + ) +(add-hook 'haskell-mode-hook + (lambda () + (set (make-local-variable 'company-backends) + (append '((company-capf company-dabbrev-code)) + company-backends)))) +(define-hostmode poly-haskell-hostmode + :mode 'haskell-mode) + +;; Layout +(setq split-height-threshold nil + split-width-threshold 160 + ) + +(after! flycheck + ; flycheck-error-list-buffer + (set-popup-rule! (rx bos "*Flycheck errors*" eos) :side 'right :size 0.45) + (add-hook 'flycheck-error-list-mode-hook + (lambda () (setq tabulated-list-sort-key (list "Level")))) + ) +;(add-hook 'flycheck-error-list-after-refresh-hook +; (lambda () +; (with-selected-window (flycheck-get-error-list-window t) +; (fit-window-to-buffer (flycheck-get-error-list-window t) 30)))) + +;; Completing +(add-hook 'after-init-hook 'global-company-mode) +;(setq company-idle-delay nil) + +;(use-package! ivy +; :defer t +; :bind +; (:map ivy-minibuffer-map +; ("RET" . 'ivy-alt-done) +; ("TAB" . 'ivy-alt-done)) +; :init +; (setq ivy-extra-directories nil +; ) +; ) + +;(add-hook! 'org-mode-hook #'mixed-pitch-mode) +;(add-hook! 'org-mode-hook #'solaire-mode) +;(setq mixed-pitch-variable-pitch-cursor nil) + +;(add-hook! org-mode :append +; #'visual-line-mode +; #'variable-pitch-mode) + +(setq doom-modeline-enable-word-count nil) + +(map! "C-x b" #'counsel-buffer-or-recentf + "C-x C-b" #'counsel-switch-buffer) +(defun recentf-track-visited-file (_prev _curr) + (and buffer-file-name + (recentf-add-file buffer-file-name))) +(after! recentf + (add-hook 'switch-buffer-functions #'recentf-track-visited-file)) + +;; Org +; DOC: https://rgoswami.me/posts/org-note-workflow/ +; ToStudy: https://github.com/abo-abo/orca +; ToStudy: https://github.com/weirdNox/org-noter +; ToStudy: https://github.com/bastibe/org-journal +; ToStudy: https://orgmode.org/manual/Org-Crypt.html +; DOC: http://www.wouterspekkink.org/academia/writing/tool/doom-emacs/2021/02/27/writing-academic-papers-with-org-mode.html +; DOC: https://jonathanabennett.github.io/blog/2019/05/29/writing-academic-papers-with-org-mode/ +; ToStudy: https://github.com/org-roam/org-roam-ui +; ToStudy: https://blog.tecosaur.com/tmio/2021-07-31-citations.html +; ToStudy: https://github.com/jkitchin/org-ref-cite +(setq org-directory "~/documents/notes") +(setq org-noter-notes-search-path '("~/notes/path/")) + +(after! org + (setq org-log-done t + org-log-into-drawer t + org-special-ctrl-a/e t + org-special-ctrl-k t + ;org-hide-emphasis-markers t + ) + (add-to-list 'org-capture-templates + '("e" "English" table-line ; key, name, type + (file "english/vocabulary.org") ; target + "|%^{English}|%^{Français}|%^{Registre|Courant|Soutenu|Familier}|" + :kill-buffer t)) + (add-to-list 'org-capture-templates + '("x" "Expense" plain + (file "compta.org") + "\n%(org-read-date) * send %^{Send to} %^{For why}\nExpense:Gifts %^{Amount}\n %^{Currency|EUR|USD|JPY}\n Assets:%^{Account||Personal|Home}")) + ;; Firefox and Chrome + ;(add-to-list 'org-capture-templates + ; `("P" "Protocol" entry ; key, name, type + ; (file+headline +org-capture-notes-file "Inbox") ; target + ; "* %^{Title}\nSource: %u, %c\n #+BEGIN_QUOTE\n%i\n#+END_QUOTE\n\n\n%?" + ; :prepend t ; properties + ; :kill-buffer t)) + ;(add-to-list 'org-capture-templates + ; `("L" "Protocol Link" entry + ; (file+headline +org-capture-notes-file "Inbox") + ; "* %? [[%:link][%(transform-square-brackets-to-round-ones \"%:description\")]]\n" + ; :prepend t + ; :kill-buffer t)) + ; ) + ) + +(map! :after counsel :map org-mode-map + "C-c l l h" #'counsel-org-link) +(after! counsel + (setq counsel-outline-display-style 'title)) + +;(after! org-id +; ;; Do not create ID if a CUSTOM_ID exists +; (setq org-id-link-to-org-use-id 'create-if-interactive-and-no-custom-id) +; ) +; +;(after! org-agenda +; ;; (setq org-agenda-prefix-format +; ;; '((agenda . " %i %-12:c%?-12t% s") +; ;; ;; Indent todo items by level to show nesting +; ;; (todo . " %i %-12:c%l") +; ;; (tags . " %i %-12:c") +; ;; (search . " %i %-12:c"))) +; (setq org-agenda-include-diary t) +; ) +; +;(use-package! org-roam +; :defer t +; :hook ((after-init . org-roam-mode)) +; :custom +; (setq org-roam-directory "~/documents/notes/org-roam") +; +; ;; Let's set up some org-roam capture templates +; (setq org-roam-capture-templates +; '(("d" "default" plain (function org-roam--capture-get-point) +; "%?" +; :file-name "%<%Y-%m-%d-%H%M%S>-${slug}" +; :head "#+title: ${title}\n" +; :unnarrowed t))) +; +; ;; And now we set necessary variables for org-roam-dailies +; (setq org-roam-dailies-capture-templates +; '(("d" "default" entry +; #'org-roam-capture--get-point +; "* %?" +; :file-name "daily/%<%Y-%m-%d>" +; :head "#+title: %<%Y-%m-%d>\n\n"))) +; ) +; +;(use-package! org-ref +; :after org-roam +; :config +; (setq reftex-default-bibliography bibliography-files +; org-ref-default-bibliography bibliography-files +; org-ref-bibliography-notes "~/documents/notes/org-roam/bibnotes.org" ;; Is this even needed? +; org-ref-notes-directory "~/documents/notes/org-roam" +; org-ref-notes-function 'orb-edit-notes +; ;org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex) +; ) +; +;(use-package! bibtex-completion +; :defer t +; :config +; (setq bibtex-completion-notes-path "~/documents/notes/org-roam/" +; bibtex-completion-pdf-field "file" +; bibtex-completion-bibliography bibliography-files +; ) +;) +; +;(defvar orb-title-format "${author-or-editor-abbrev} (${date}). ${title}." +; "Format of the title to use for `orb-templates'.") +; +;(use-package! org-roam-bibtex +; :after org-roam +; :hook (org-roam-mode . org-roam-bibtex-mode) +; :bind (:map org-mode-map +; (("C-c n a" . orb-note-actions))) +; :config +; (setq orb-preformat-keywords +; '(("citekey" . "=key=") "title" "date" "author-or-editor-abbrev") +; orb-templates +; `(("r" "ref" plain +; (function org-roam-capture--get-point) +; "" +; :file-name "${citekey}" +; :head ,(s-join "\n" +; (list +; (concat "#+TITLE: " orb-title-format) +; "#+ROAM_KEY: ${ref}" +; "" +; "- tags :: " +; "" +; "* Notes" +; "")) +; :unnarrowed t) +; ("n" "ref + noter" plain +; (function org-roam-capture--get-point) +; "" +; :file-name "${citekey}" +; :head ,(s-join "\n" +; (list +; (concat "#+TITLE: " orb-title-format) +; "#+ROAM_KEY: ${ref}" +; "" +; "- tags :: " +; "" +; "* Annotations :noter:" +; ":PROPERTIES:" +; ":NOTER_DOCUMENT: %(orb-process-file-field \"${citekey}\")" +; ":NOTER_PAGE:" +; ":END:" +; "")))))) +; +;(map! :after pdf-tools +; :map pdf-view-mode-map +; :gn "q" (lambda () +; (interactive) +; (if (bound-and-true-p org-noter-doc-mode) +; (org-noter-kill-session) +; (kill-current-buffer))) +; ) +; +;(use-package! org-noter +; :after (:any org pdf-view) +; :config +; (setq org-noter-notes-search-path '("~/documents/notes/org-roam") +; org-noter-always-create-frame nil +; ) +; ) + +;(setq lsp-lens-mode t) +(setq doom-modeline-height 1) +(setq doom-modeline-lsp t) +;(setq doom-modeline-minor-modes t) +;(setq lsp-modeline-diagnostics-enable t) + +;; Indenting +(setq-default tab-width 2) +(setq indent-tabs-mode nil) + +;; Searching +(global-superword-mode t) +; https://emacs.stackexchange.com/questions/9583/how-to-treat-underscore-as-part-of-the-word +(modify-syntax-entry ?_ "w") +(defun swiper-all/search-word-at-point () + (interactive) + (swiper-all (format "%s" (thing-at-point 'word)))) +; Highlight without jumping to the next match +; See: https://emacs.stackexchange.com/questions/52411/evil-star-visualstar-without-moving-the-cursor +(defun search-word-at-point () + (interactive) + (evil-search (progn (evil-ex-search-word-forward) + (evil-ex-search-previous) + ))) +(defun search-unbounded-word-at-point () + (interactive) + (evil-search (progn (evil-ex-search-unbounded-word-forward) + (evil-ex-search-unbounded-word-previous) + ))) +(setq ivy-case-fold-search-default nil ; case-sensitive search by default + ) +(after! evil + ;(general-define-key "C-s" '(counsel-grep-or-swiper :which-key "search")) + ;(general-define-key :keymaps '(swiper-map) "C-u" '(lambda () (interactive) (kill-line 0))) + ;(general-nvmap "/" '(counsel-grep-or-swiper :which-key "search in buffer")) + (evil-define-key 'normal global-map + (kbd "/") 'swiper + (kbd "C-f") 'swiper-all + (kbd "C-/") 'swiper-all/search-word-at-point + (kbd "*") 'search-word-at-point + (kbd "g*") 'search-unbounded-word-at-point + ) + ) + +;; Edition +(after! evil + (setq evil-want-fine-undo t + ) + (customize-set-variable 'evil-want-Y-yank-to-eol nil) + (evil-define-key 'normal global-map (kbd "K") 'evil-join) + (evil-define-key 'insert global-map (kbd "C-u") '(lambda () (interactive) (kill-line 0))) + (evil-define-key 'normal global-map (kbd "SPC g d") 'git-gutter:popup-hunk) + ) +(setq +vc-gutter-default-style nil + ) +(customize-set-variable 'git-gutter:update-interval 2) +;(customize-set-variable 'git-gutter:window-width 2) +(after! git-gutter-fringe + (require 'fringe-helper) + ; Narrower vertical bar, matching the one in the "+" of git-gutter-fr:added + (fringe-helper-define 'git-gutter-fr:modified nil + "...XX..." + "...XX..." + ".XXXXXX." + ".XXXXXX." + "...XX..." + "...XX..." + ".XXXXXX." + ".XXXXXX.") + ; Narrower horizontql bar, matching the one in the "+" of git-gutter-fr:added + (fringe-helper-define 'git-gutter-fr:deleted nil + "........" + "........" + "........" + ".XXXXXX." + ".XXXXXX." + "........" + "........" + "........") + ) + + +;; Folding +(defun set-selective-display/at-point (&optional level) + "Fold text indented same of more than the cursor. + If level is set, set the indent level to LEVEL. + If 'selective-display' is already set to LEVEL, + calling it again will unset 'selective-display' by setting it to 0." + (interactive "P") + (if (eq selective-display (1+ (current-column))) + (set-selective-display 0) + (set-selective-display (or level (1+ (current-column)))))) +(after! evil + (evil-define-key 'normal global-map + (kbd "C-d") 'set-selective-display/at-point) + ) +;; Navigation +;; DOC: https://github.com/noctuid/evil-guide +(after! evil + (setq evil-cross-lines t + evil-move-cursor-back nil + evil-search-wrap nil + evil-want-C-i-jump nil + ) + + ;; Switching buffers + (evil-define-key 'motion 'global + (kbd "") 'evil-prev-buffer ; Does not work without the angles ('<' and '>') + (kbd "C-k") 'evil-next-buffer + ) + ;(define-key evil-normal-state-map [tab] 'evil-prev-buffer) + + ;; Jumping + (evil-define-key 'motion 'global + (kbd "C-u") 'better-jumper-jump-backward + (kbd "C-o") 'better-jumper-jump-forward + ) + + ;; Moving with ijkl (instead of hjkl) + (evil-define-key '(motion normal visual) 'global + (kbd "i") 'evil-previous-visual-line + (kbd "j") 'evil-backward-char + (kbd "k") 'evil-next-visual-line + (kbd "h") 'evil-insert + ) + + ;; Switching windows with SPC-w + ijkl (instead of hjkl) + (define-key evil-window-map "i" 'evil-window-up) + (define-key evil-window-map "I" 'evil-window-move-very-top) + (define-key evil-window-map "j" 'evil-window-left) + (define-key evil-window-map "J" 'evil-window-move-far-left) + (define-key evil-window-map "k" 'evil-window-down) + (define-key evil-window-map "K" 'evil-window-move-very-bottom) + ;(define-key evil-emacs-state-map "\C-w" 'evil-window-map) + ;;(evil-define-key 'window global-map "l" 'evil-window-right) + ;;(evil-define-key 'window global-map "L" 'evil-window-move-far-right) + + ;; ijkl in Dired + ;;(evil-define-key 'normal dired-mode-map "i" 'evil-previous-line) + + ;; Errors + (evil-define-key 'motion 'global + (kbd "C-j") 'previous-error + (kbd "C-l") 'next-error + ) + ;(bind-key "C-j" #'previous-error) + ;(bind-key "C-l" #'next-error) + ) +(after! auto-yasnippet + (evil-define-key '(motion normal) 'global + (kbd "C-") 'evil-switch-to-windows-last-buffer + ) + ) +(after! (evil magit evil-collection-magit) + (evil-define-key '(motion normal) magit-mode-map + (kbd "C-i") 'evil-prev-buffer + (kbd "i") 'evil-previous-visual-line + (kbd "k") 'evil-next-visual-line + (kbd "C-k") 'evil-next-buffer + (kbd "j") 'magit-section-backward + (kbd "l") 'magit-section-forward + ) + ) +(after! (evil magit git-rebase) + (evil-define-key '(motion normal) git-rebase-mode-map + (kbd "C-i") 'evil-prev-buffer + (kbd "i") 'evil-previous-visual-line + (kbd "k") 'evil-next-visual-line + (kbd "C-k") 'evil-next-buffer + (kbd "j") 'evil-backward-char + ) + ) +;;(eval-after-load 'evil ; to run after evil-integration.el +;; '(progn +;; (define-key Buffer-menu-mode-map "\C-i" 'evil-prev-buffer) +;; (define-key Buffer-menu-mode-map "\C-k" 'evil-next-buffer) +;; (define-key messages-buffer-mode-map "\C-i" 'evil-prev-buffer) +;; (define-key messages-buffer-mode-map "\C-k" 'evil-next-buffer) +;; (define-key completion-list-mode-map "\C-i" 'evil-prev-buffer) +;; (define-key completion-list-mode-map "\C-k" 'evil-next-buffer) +;; ;(define-key custom-theme-mode-map "\C-i" 'evil-prev-buffer) +;; ;(define-key custom-theme-mode-map "\C-k" 'evil-next-buffer) +;; ) +;; ) + +;;(with-eval-after-load 'evil-maps +;; (define-key evil-motion-state-map (kbd "TAB") nil)) diff --git a/homes/programs/emacs/custom.el b/homes/programs/emacs/custom.el new file mode 100644 index 0000000..e69de29 diff --git a/homes/programs/emacs/init.el b/homes/programs/emacs/init.el new file mode 100644 index 0000000..dd6f4fb --- /dev/null +++ b/homes/programs/emacs/init.el @@ -0,0 +1,211 @@ +;;; init.el -*- lexical-binding: t; -*- + +;; This file controls what Doom modules are enabled and what order they load +;; in. Remember to run 'doom sync' after modifying it! + +;; NOTE Press 'SPC h d h' (or 'C-h d h' for non-vim users) to access Doom's +;; documentation. There you'll find a "Module Index" link where you'll find +;; a comprehensive list of Doom's modules and what flags they support. + +;; NOTE Move your cursor over a module's name (or its flags) and press 'K' (or +;; 'C-c c k' for non-vim users) to view its documentation. This works on +;; flags as well (those symbols that start with a plus). +;; +;; Alternatively, press 'gd' (or 'C-c c d') on a module to browse its +;; directory (for easy access to its source code). + +(doom! :input + ;;chinese + ;;japanese + ;;layout ; auie,ctsrnm is the superior home row + + :completion + company ; the ultimate code completion backend + ;;helm ; the *other* search engine for love and life + ;;ido ; the other *other* search engine... + (ivy ; a search engine for love and life + +fuzzy + +icons + ) + + :ui + ;;deft ; notational velocity for Emacs + doom ; what makes DOOM look the way it does + doom-dashboard ; a nifty splash screen for Emacs + doom-quit ; DOOM quit-message prompts when you quit Emacs + ;;fill-column ; a `fill-column' indicator + hl-todo ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW + ;;hydra + ;;indent-guides ; highlighted indent columns + ;;(ligatures +extra) ; ligatures and symbols to make your code pretty again + ;;minimap ; show a map of the code on the side + modeline ; snazzy, Atom-inspired modeline, plus API + ;;nav-flash ; blink cursor line after big motions + ;;neotree ; a project drawer, like NERDTree for vim + ophints ; highlight the region an operation acts on + (popup +defaults) ; tame sudden yet inevitable temporary windows + ;;tabs ; a tab bar for Emacs + (treemacs +lsp) ; a project drawer, like neotree but cooler + unicode ; extended unicode support for various languages + (emoji +unicode) ; 🙂 + vc-gutter ; vcs diff in the fringe + vi-tilde-fringe ; fringe tildes to mark beyond EOB + window-select ; visually switch windows + workspaces ; tab emulation, persistence & separate workspaces + zen ; distraction-free coding or writing + + :editor + (evil +everywhere); come to the dark side, we have cookies + file-templates ; auto-snippets for empty files + fold ; (nigh) universal code folding + (format +onsave) ; automated prettiness + ;;god ; run Emacs commands without modifier keys + ;;lispy ; vim for lisp, for people who don't like vim + ;;multiple-cursors ; editing in many places at once + ;;objed ; text object editing for the innocent + ;;parinfer ; turn lisp into python, sort of + ;;rotate-text ; cycle region at point between text candidates + snippets ; my elves. They type so I don't have to + word-wrap ; soft wrapping with language-aware indent + + :emacs + dired ; making dired pretty [functional] + electric ; smarter, keyword-based electric-indent + ;;ibuffer ; interactive buffer management + (undo + ;+tree ; not sure it's maintained, and breaks with lsp formating + ) ; persistent, smarter undo for your inevitable mistakes + vc ; version-control and Emacs, sitting in a tree + + :term + ;;eshell ; the elisp shell that works everywhere + ;;shell ; simple shell REPL for Emacs + ;;term ; basic terminal emulator for Emacs + vterm ; the best terminal emulation in Emacs + + :checkers + syntax ; tasing you for every semicolon you forget + ;;(spell +flyspell) ; tasing you for misspelling mispelling + ;;grammar ; tasing grammar mistake every you make + + :tools + ;;ansible + ;;debugger ; FIXME stepping through code, to help you add bugs + direnv + ;;docker + ;;editorconfig ; let someone else argue about tabs vs spaces + ;;ein ; tame Jupyter notebooks with emacs + (eval +overlay) ; run code, run (also, repls) + ;;gist ; interacting with github gists + lookup ; navigate your code and its documentation + (lsp + ;+eglot + ) + magit ; a git porcelain for Emacs + ;(magit +forge) + ;;make ; run make tasks from Emacs + pass ; password manager for nerds + pdf ; pdf enhancements + ;;prodigy ; FIXME managing external services & code builders + ;;rgb ; creating color strings + ;;taskrunner ; taskrunner for all your projects + ;;terraform ; infrastructure as code + tmux ; an API for interacting with tmux + ;;upload ; map local to remote projects via ssh/ftp + + :os + (:if IS-MAC macos) ; improve compatibility with macOS + tty ; improve the terminal Emacs experience + + :lang + ;;agda ; types of types of types of types... + ;;beancount ; mind the GAAP + ;;cc ; C > C++ == 1 + ;;clojure ; java with a lisp + ;;common-lisp ; if you've seen one lisp, you've seen them all + ;;coq ; proofs-as-programs + ;;crystal ; ruby at the speed of c + ;;csharp ; unity, .NET, and mono shenanigans + data ; config/data formats + ;;(dart +flutter) ; paint ui and not much else + ;;elixir ; erlang done right + ;;elm ; care for a cup of TEA? + emacs-lisp ; drown in parentheses + ;;erlang ; an elegant language for a more civilized age + ;;ess ; emacs speaks statistics + ;;factor + ;;faust ; dsp, but you get to keep your soul + ;;fsharp ; ML stands for Microsoft's Language + ;;fstar ; (dependent) types and (monadic) effects and Z3 + ;;gdscript ; the language you waited for + ;;(go +lsp) ; the hipster dialect + (haskell +lsp) ; a language that's lazier than I am + ;;hy ; readability of scheme w/ speed of python + ;;idris ; a language you can depend on + ;;json ; At least it ain't XML + ;;(java +meghanada) ; the poster child for carpal tunnel syndrome + ;;javascript ; all(hope(abandon(ye(who(enter(here)))))) + ;;julia ; a better, faster MATLAB + ;;kotlin ; a better, slicker Java(Script) + ;;latex ; writing papers in Emacs has never been so fun + ;;lean ; for folks with too much to prove + ;;ledger ; be audit you can be + ;;lua ; one-based indices? one-based indices + markdown ; writing docs for people to ignore + ;;nim ; python + lisp at the speed of c + nix ; I hereby declare "nix geht mehr!" + ;;ocaml ; an objective camel + ; DOC: https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/README.org + (org ; organize your plain life in plain text + +roam2 + +noter + ;+pretty + ;+dragndrop ; drag & drop files/images into org buffers + ;+hugo ; use Emacs for hugo blogging + ;+pandoc ; export-with-pandoc support + ;+present ; using org-mode for presentations + ) + ;;php ; perl's insecure younger brother + ;;plantuml ; diagrams for confusing people more + ;;purescript ; javascript, but functional + ;;python ; beautiful is better than ugly + ;;qt ; the 'cutest' gui framework ever + ;;racket ; a DSL for DSLs + ;;raku ; the artist formerly known as perl6 + ;;rest ; Emacs as a REST client + ;;rst ; ReST in peace + ;;(ruby +rails) ; 1.step {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"} + ;;rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap() + ;;scala ; java, but good + ;;(scheme +guile) ; a fully conniving family of lisps + (sh +lsp) ; she sells {ba,z,fi}sh shells on the C xor + ;;sml + ;;solidity ; do you need a blockchain? No. + ;;swift ; who asked for emoji variables? + ;;terra ; Earth and Moon in alignment for performance. + ;;web ; the tubes + ;;yaml ; JSON, but readable + ;;zig ; C, but simpler + + :email + ;;(mu4e +gmail) + ;;notmuch + ;;(wanderlust +gmail) + + :app + ;;calendar + ;;emms + ;;everywhere ; *leave* Emacs!? You must be joking + ;;irc ; how neckbeards socialize + ;;(rss +org) ; emacs as an RSS reader + ;;twitter ; twitter client https://twitter.com/vnought + + :config + ;;literate + (default +bindings +smartparens) + + ;;(setq doom-theme 'doom-one-light) + ;;(setq doom-theme 'doom-city-lights) +) + +;(setq +literate-config-file "~/.config/doom-config/ReadMe.org") diff --git a/homes/programs/emacs/packages.el b/homes/programs/emacs/packages.el new file mode 100644 index 0000000..7ba62b7 --- /dev/null +++ b/homes/programs/emacs/packages.el @@ -0,0 +1,14 @@ +;;(package! poporg) +;;(package! bufler +;; :general +;; (:keymaps 'doom-leader-map +;; "b b" 'bufler-workspace-switch-buffer +;; "b B" 'bufler-switch-buffer +;; ) +;; :config +;; (setq bufler-workspace-switch-buffer-sets-workspace t) +;;) +;;(unpin! polymode) +(package! polymode) +(package! switch-buffer-functions) +;(package! mediawiki) -- 2.44.1 From 657084ebe893b44dbaf55ba0d432d2843d25943e Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 01:19:05 +0100 Subject: [PATCH 11/16] oignon: sshfs: automount losurdo --- hosts/oignon.nix | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hosts/oignon.nix b/hosts/oignon.nix index 395c794..3f475d4 100644 --- a/hosts/oignon.nix +++ b/hosts/oignon.nix @@ -145,6 +145,30 @@ fileSystems."/home/julm/mnt/ilico/severine" = { ''; in [ "conf=${conf}" "user" "noexec" "nosuid" "noauto" ]; # "x-systemd.automount" }; +programs.fuse.userAllowOther = true; +fileSystems."/mnt/losurdo" = { + device = "${pkgs.sshfsFuse}/bin/sshfs#julm@losurdo.wg:/"; + fsType = "fuse"; + options = + # Use the user's gpg-agent session to query + # for the password of the SSH key when auto-mounting. + let sshAsUser = user: + pkgs.writeScript "sshAsUser-${user}" '' + exec ${pkgs.sudo}/bin/sudo -i -u ${user} \ + ${pkgs.openssh}/bin/ssh "$@" + ''; + in [ + "noatime" "noexec" "nosuid" + "user" "uid=julm" "gid=users" "allow_other" + "_netdev" "reconnect" "ssh_command=${sshAsUser "julm"}" + "noauto" "x-gvfs-hide" "x-systemd.automount" + "Cipher=arcfour" # No need for encryption over Wireguard + #"Compression=yes" # YMMV + # Disconnect approximately 2*15=30 seconds after a network failure + "ServerAliveCountMax=2" + "ServerAliveInterval=15" + ]; +}; services.dbus = { packages = [ pkgs.gnome3.dconf ]; }; -- 2.44.1 From 05541f72c270be96afe49be0532dfdebf76d74df Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 01:20:20 +0100 Subject: [PATCH 12/16] davfs2: cleanup --- hosts/oignon.nix | 6 +----- hosts/patate.nix | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/hosts/oignon.nix b/hosts/oignon.nix index 3f475d4..b385fc0 100644 --- a/hosts/oignon.nix +++ b/hosts/oignon.nix @@ -130,11 +130,7 @@ services.avahi = { enable = false; }; }; -services.davfs2 = { - enable = true; - extraConfig = '' - ''; -}; +services.davfs2.enable = true; fileSystems."/home/julm/mnt/ilico/severine" = { device = "https://nuage.ilico.org/remote.php/dav/files/severine/"; fsType = "davfs"; diff --git a/hosts/patate.nix b/hosts/patate.nix index 0a8689e..ec3b0c1 100644 --- a/hosts/patate.nix +++ b/hosts/patate.nix @@ -159,11 +159,7 @@ services.avahi = { enable = false; }; }; -services.davfs2 = { - enable = true; - extraConfig = '' - ''; -}; +services.davfs2.enable = true; fileSystems."/home/sevy/mnt/ilico/severine" = { device = "https://nuage.ilico.org/remote.php/dav/files/severine/"; fsType = "davfs"; -- 2.44.1 From 9c628863ecbd372cc2199877e94af3c55a0f65c8 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 01:46:27 +0100 Subject: [PATCH 13/16] bash: fix emacs alias --- homes/programs/bash.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homes/programs/bash.nix b/homes/programs/bash.nix index bc0e6bc..fed0d59 100644 --- a/homes/programs/bash.nix +++ b/homes/programs/bash.nix @@ -5,7 +5,7 @@ programs.bash = { cl = "clear"; eic = "edit-in-commit"; eigg = "edit-in-git-grep"; - emacs = "emacs --create-frame"; + emacs = "emacsclient --create-frame"; g = "git"; grep = "grep --color"; j="sudo journalctl -u"; -- 2.44.1 From de6ac0fb6e25bc9811d7e5a7850d5f63da62d46c Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 02:18:16 +0100 Subject: [PATCH 14/16] sshfs: fix encryption --- hosts/oignon.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/hosts/oignon.nix b/hosts/oignon.nix index b385fc0..2cf228f 100644 --- a/hosts/oignon.nix +++ b/hosts/oignon.nix @@ -158,7 +158,6 @@ fileSystems."/mnt/losurdo" = { "user" "uid=julm" "gid=users" "allow_other" "_netdev" "reconnect" "ssh_command=${sshAsUser "julm"}" "noauto" "x-gvfs-hide" "x-systemd.automount" - "Cipher=arcfour" # No need for encryption over Wireguard #"Compression=yes" # YMMV # Disconnect approximately 2*15=30 seconds after a network failure "ServerAliveCountMax=2" -- 2.44.1 From fe962f2ca0f241d49abb60ec64dc89558ec4289d Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 04:31:48 +0100 Subject: [PATCH 15/16] sanoid: add to profiles/sharing.nix --- profiles/sharing.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/profiles/sharing.nix b/profiles/sharing.nix index b692606..1a27a3c 100644 --- a/profiles/sharing.nix +++ b/profiles/sharing.nix @@ -2,6 +2,7 @@ { home.packages = [ pkgs.croc + pkgs.sanoid pkgs.sshfs pkgs.stig #pkgs.transmission-gtk -- 2.44.1 From 205e7709cdebba4c5527b40c0c1df934c59866e5 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Thu, 18 Nov 2021 06:29:08 +0100 Subject: [PATCH 16/16] htop: tweak settings --- homes/programs/htop.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/homes/programs/htop.nix b/homes/programs/htop.nix index 39d743d..5a68e46 100644 --- a/homes/programs/htop.nix +++ b/homes/programs/htop.nix @@ -10,7 +10,7 @@ programs.htop = { all_branches_collapsed = false; color_scheme = false; column_meter_modes_0 = "3 1 1 1"; - column_meter_modes_1 = "2 2 2 1 1 1 1 1"; + column_meter_modes_1 = "2 2 2 3 3 1 1 1"; column_meters_0 = "AllCPUs Memory Swap Zram"; column_meters_1 = "Systemd LoadAverage Uptime DiskIO NetworkIO ZFSARC ZFSCARC PressureStallIOFull"; cpu_count_from_one = false; @@ -37,10 +37,10 @@ programs.htop = { show_merged_command = false; show_program_path = false; show_thread_names = false; - sort_direction = 1; + sort_direction = 0; sort_key = 46; # PERCENT_CPU strip_exe_from_cmdline = true; - tree_sort_direction = 1; + tree_sort_direction = 0; tree_sort_key = 46; # PERCENT_CPU tree_view = true; tree_view_always_by_pid = false; -- 2.44.1