From 7d02c943665ef9d9b626ddd5a4a2102cd50cbe55 Mon Sep 17 00:00:00 2001 From: aciceri Date: Thu, 28 Oct 2021 12:53:35 +0200 Subject: [PATCH] Things --- flake.nix | 1 + overlays/overrides.nix | 2 +- pkgs/emacs/default.nix | 3 ++ profiles/cachix/haskell.nix | 10 +++++ users/ccr/default.nix | 4 +- users/profiles/emacs/default.nix | 2 + .../emacs/emacs.d/config/aesthetics.el | 5 ++- .../emacs/emacs.d/config/config-emails.el | 23 ++++++++++ .../emacs/emacs.d/config/config-lsp.el | 3 ++ users/profiles/emacs/emacs.d/init.el | 1 + users/profiles/mails/default.nix | 45 +++++++++++++++++++ users/profiles/sway/default.nix | 20 ++++++--- users/profiles/vscode/default.nix | 8 ++++ 13 files changed, 117 insertions(+), 10 deletions(-) create mode 100644 profiles/cachix/haskell.nix create mode 100644 users/profiles/emacs/emacs.d/config/config-emails.el create mode 100644 users/profiles/mails/default.nix diff --git a/flake.nix b/flake.nix index 372b10b..b00f86b 100644 --- a/flake.nix +++ b/flake.nix @@ -160,6 +160,7 @@ profiles = digga.lib.rakeLeaves ./users/profiles; suites = with profiles; rec { base = [ direnv git zsh gpg password-store ]; + emails = [ mails ]; shell = [ zsh exa fzf ]; gui = [ sway xdg gtk foot bat ]; browser = [ firefox chromium qutebrowser ]; diff --git a/overlays/overrides.nix b/overlays/overrides.nix index de1c90c..b9abf3c 100644 --- a/overlays/overrides.nix +++ b/overlays/overrides.nix @@ -21,7 +21,7 @@ channels: final: prev: { in { # same for haskell packages, matching ghc versions - inherit (channels.latest.haskell.packages."ghc${version}") + inherit (channels.unstable.haskell.packages."ghc${version}") haskell-language-server; }); }); diff --git a/pkgs/emacs/default.nix b/pkgs/emacs/default.nix index 45dcf5c..64fa007 100644 --- a/pkgs/emacs/default.nix +++ b/pkgs/emacs/default.nix @@ -16,11 +16,13 @@ emacsWithPackages ( evil-collection fira-code-mode haskell-mode + notmuch helm helm-ag helm-company helm-projectile lispy + lsp-haskell lsp-mode lsp-python-ms magit @@ -31,6 +33,7 @@ emacsWithPackages ( org-superstar projectile rainbow-delimiters + rainbow-identifiers sudo-utils treemacs treemacs-evil diff --git a/profiles/cachix/haskell.nix b/profiles/cachix/haskell.nix new file mode 100644 index 0000000..99b570a --- /dev/null +++ b/profiles/cachix/haskell.nix @@ -0,0 +1,10 @@ +{ + nix = { + binaryCaches = [ + "https://hydra.iohk.io" + ]; + binaryCachePublicKeys = [ + "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" + ]; + }; +} diff --git a/users/ccr/default.nix b/users/ccr/default.nix index 1004edc..8b871d7 100644 --- a/users/ccr/default.nix +++ b/users/ccr/default.nix @@ -1,7 +1,7 @@ { pkgs, suites, lib, ... }: { home-manager.users.ccr = { suites, ... }: { - imports = with suites; shell ++ gui ++ browser ++ multimedia ++ dev ++ base; + imports = with suites; shell ++ gui ++ browser ++ multimedia ++ emails ++ dev ++ base; home.packages = with pkgs; [ ack ranger @@ -20,7 +20,7 @@ users.users.ccr = { uid = 1000; - hashedPassword = "$6$JGOefuRk7kL$fK9.5DFnLLoW08GL4eKRyf958jyZdw//hLMaz4pp28jJuSFb24H6R3dgt1.sMs0huPY85rludSw4dnQJG5xSw1"; #mkpasswd -m sha-512 + hashedPassword = "$6$JGOefuRk7kL$fK9.5DFnLLoW08GL4eKRyf958jyZdw//hLMaz4pp28jJuSFb24H6R3dgt1.sMs0huPY85rludSw4dnQJG5xSw1"; # mkpasswd -m sha-512 description = "Andrea Ciceri"; isNormalUser = true; extraGroups = [ diff --git a/users/profiles/emacs/default.nix b/users/profiles/emacs/default.nix index e0bf69c..0a6b3b5 100644 --- a/users/profiles/emacs/default.nix +++ b/users/profiles/emacs/default.nix @@ -23,6 +23,8 @@ ag nixpkgs-fmt rnix-lsp + haskell-language-server + stylish-haskell graphviz-nox hunspell hunspellDicts.en_US diff --git a/users/profiles/emacs/emacs.d/config/aesthetics.el b/users/profiles/emacs/emacs.d/config/aesthetics.el index 505460a..ee6c982 100644 --- a/users/profiles/emacs/emacs.d/config/aesthetics.el +++ b/users/profiles/emacs/emacs.d/config/aesthetics.el @@ -9,7 +9,7 @@ ) (use-package fira-code-mode - :custom (fira-code-mode-disabled-ligatures '()) ;; List of ligatures to turn off + :custom (fira-code-mode-disabled-ligatures '("x")) ;; List of ligatures to turn off :config (fira-code-mode-set-font) (global-fira-code-mode)) @@ -31,6 +31,9 @@ (use-package minimap) +(use-package rainbow-identifiers + :hook ((prog-mode . rainbow-identifiers-mode))) + ;; To move in a different config file (when (string-equal system-type "darwin") (setq mac-command-modifier 'ctrl)) diff --git a/users/profiles/emacs/emacs.d/config/config-emails.el b/users/profiles/emacs/emacs.d/config/config-emails.el new file mode 100644 index 0000000..bf37daa --- /dev/null +++ b/users/profiles/emacs/emacs.d/config/config-emails.el @@ -0,0 +1,23 @@ +(use-package notmuch + :custom + (notmuch-archive-tags '("-unread")) + (notmuch-show-indent-content nil) + (notmuch-hello-sections + '(notmuch-hello-insert-header + notmuch-hello-insert-saved-searches + notmuch-hello-insert-search + notmuch-hello-insert-alltags + notmuch-hello-insert-recent-searches + notmuch-hello-insert-footer + )) + (notmuch-tagging-keys + '(("a" notmuch-archive-tags "Archive") + ("u" notmuch-show- + mark-read-tags "Mark read") + ("m" ("+muted") "Mute") + ("f" ("+flagged") "Flag") + ("s" ("+spam" "-inbox") "Mark as spam") + ("d" ("+deleted" "-inbox") "Delete"))) + ) + +(provide 'config-emails) diff --git a/users/profiles/emacs/emacs.d/config/config-lsp.el b/users/profiles/emacs/emacs.d/config/config-lsp.el index 5889ecf..f2dc252 100644 --- a/users/profiles/emacs/emacs.d/config/config-lsp.el +++ b/users/profiles/emacs/emacs.d/config/config-lsp.el @@ -2,9 +2,12 @@ :init ;; set prefix for lsp-command-keymap (few alternatives - "C-l", "C-c l") (setq lsp-keymap-prefix "C-c l") + :custom + (lsp-haskell-server-path "haskell-language-server-wrapper") :hook (;; replace XXX-mode with concrete major-mode(e. g. python-mode) (nix-mode . lsp) (python-mode . lsp) + (haskell-mode . lsp) ;; if you want which-key integration (lsp-mode . lsp-enable-which-key-integration)) :commands lsp) diff --git a/users/profiles/emacs/emacs.d/init.el b/users/profiles/emacs/emacs.d/init.el index fc7a3b5..0d36d65 100644 --- a/users/profiles/emacs/emacs.d/init.el +++ b/users/profiles/emacs/emacs.d/init.el @@ -16,6 +16,7 @@ Return nil if COMMAND is not found anywhere in `exec-path'." (require 'config-evil) (require 'config-helm) (require 'config-org) +(require 'config-emails) (require 'config-projectile) (require 'config-company) (require 'config-magit) diff --git a/users/profiles/mails/default.nix b/users/profiles/mails/default.nix new file mode 100644 index 0000000..9236f5d --- /dev/null +++ b/users/profiles/mails/default.nix @@ -0,0 +1,45 @@ +{ pkgs, lib, ... }: +let + maildir = "mail"; +in +{ + programs.msmtp.enable = true; # For sending emails + + # For fetching emails + accounts.email.maildirBasePath = maildir; + programs.mbsync = { + enable = true; + }; + + # For email browsing, tagging, and searching + programs.notmuch.enable = true; + + accounts.email.accounts = { + personal = { + address = "andrea.ciceri@autistici.org"; + #gpg = { + # key = ""; + # signByDefault = true; + #}; + imap.host = "mail.autistici.org"; + mbsync = { + enable = true; + create = "maildir"; + }; + msmtp.enable = true; + notmuch.enable = true; + primary = true; + realName = "Andrea Ciceri"; + #signature = { + # text = '' + # ''; + # showSignature = "append"; + #}; + passwordCommand = "pass show autistici/password"; + smtp = { + host = "smtp.autistici.org"; + }; + userName = "andrea.ciceri@autistici.org"; + }; + }; +} diff --git a/users/profiles/sway/default.nix b/users/profiles/sway/default.nix index b68372d..7701911 100644 --- a/users/profiles/sway/default.nix +++ b/users/profiles/sway/default.nix @@ -47,11 +47,20 @@ xkb_variant = "intl"; }; }; - keybindings = lib.mkOptionDefault { - "${modifier}+x" = "exec ${pkgs.customEmacs}/bin/emacs"; - "${modifier}+b" = "exec ${pkgs.firefox}/bin/firefox"; - "${modifier}+s" = "exec \'file=\"~/shots/\$(date --iso-8601=seconds).png\"; ${pkgs.grim}/bin/grim -t png -g \"\$(${pkgs.slurp}/bin/slurp)\" \$file; wl-copy -t image/png < \$file\'"; - }; + keybindings = + let + screenshotScript = pkgs.writeShellScript "screenshot.sh" '' + filename="~/shots/$(date --iso-8601=seconds).png" + coords="$(${pkgs.slurp}/bin/slurp)" + ${pkgs.grim}/bin/grim -t png -g "$coords" $filename + wl-copy -t image/png < $filename + ''; + in + lib.mkOptionDefault { + "${modifier}+x" = "exec ${pkgs.customEmacs}/bin/emacs"; + "${modifier}+b" = "exec ${pkgs.firefox}/bin/firefox"; + "${modifier}+s" = "exec ${screenshotScript}"; + }; }; extraConfig = '' bindsym ${modifier}+p move workspace to output right @@ -77,7 +86,6 @@ ]; modules-center = [ "sway/window" ]; modules-right = [ - "idle_inhibitor" "tray" "network" "cpu" diff --git a/users/profiles/vscode/default.nix b/users/profiles/vscode/default.nix index 9f1aaf8..be69e1a 100644 --- a/users/profiles/vscode/default.nix +++ b/users/profiles/vscode/default.nix @@ -18,6 +18,14 @@ extensions = with pkgs.vscode-extensions; [ eamodio.gitlens jnoortheen.nix-ide + haskell.haskell + justusadam.language-haskell ]; }; + + home.packages = with pkgs; [ + haskell-language-server + stylish-haskell + ghc + ]; }