From 912d84d889dd4b60b45c79f6e63db90b86894735 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Tue, 9 Mar 2021 00:47:31 +0100 Subject: [PATCH] First emacs configuration Also includes colorscheme changes --- configurations/kitty.nix | 50 ++++---- configurations/mail.nix | 16 +-- configurations/sway.nix | 12 +- configurations/sway/status-configuration.nix | 20 ++-- flake.lock | 36 ++++-- flake.nix | 7 +- modules/default.nix | 33 +++--- modules/emacs.nix | 116 +++++++++++++++++++ modules/zsh.nix | 2 +- 9 files changed, 218 insertions(+), 74 deletions(-) create mode 100644 modules/emacs.nix diff --git a/configurations/kitty.nix b/configurations/kitty.nix index b2ce59e7..1059e6d0 100644 --- a/configurations/kitty.nix +++ b/configurations/kitty.nix @@ -8,28 +8,34 @@ font_family = "Fira Code"; font_size = 9; disable_ligatures = "cursor"; - background = "#fbffff"; - foreground = "#535c65"; - selection_background = "#6d7782"; - selection_foreground = "#fbffff"; - url_color = "#906c33"; - cursor = "#434951"; - color0 = "#fbffff"; - color1 = "#ae5865"; - color2 = "#4d7f43"; - color3 = "#906c33"; - color4 = "#2b7ab2"; - color5 = "#8f63a2"; - color6 = "#008483"; - color7 = "#535c65"; - color8 = "#6d7782"; - color9 = "#ae5865"; - color10 = "#4d7f43"; - color11 = "#906c33"; - color12 = "#2b7ab2"; - color13 = "#8f63a2"; - color14 = "#008483"; - color15 = "#434951"; + background = "#ffffff"; + foreground = "#000000"; + cursor = "#777777"; + url_color = "#0031a9"; + # black + color0 = "#282828"; + color8 = "#000000"; + # red + color1 = "#a60000"; + color9 = "#972500"; + # green + color2 = "#005e00"; + color10 = "#315b00"; + # yellow + color3 = "#813e00"; + color11 = "#70480f"; + # blue + color4 = "#0031a9"; + color12 = "#2544bb"; + # magenta + color5 = "#721045"; + color13 = "#8f0075"; + # cyan + color6 = "#00538b"; + color14 = "#30517f"; + # white + color7 = "#f8f8f8"; + color15 = "#ffffff"; enable_audio_bell = false; visual_bell_duration = "0.25"; remember_window_size = false; diff --git a/configurations/mail.nix b/configurations/mail.nix index f16b42ca..a031ddea 100644 --- a/configurations/mail.nix +++ b/configurations/mail.nix @@ -295,15 +295,15 @@ in set send_charset="utf-8" set print_command = "${pkgs.wl-clipboard}/bin/wl-copy" - color normal white default - color error red default - color status black blue - color indicator black blue + color normal black white + color error red white + color status white blue + color indicator white blue color quoted yellow default - color header blue default "^(Subject)" - color header brightblue default "^(From)" - color index black red "~D" # deleted messages - color attachment green default + color header blue white "^(Subject)" + color header brightblue white "^(From)" + color index white red "~D" # deleted messages + color attachment green white ''; macros = [ { diff --git a/configurations/sway.nix b/configurations/sway.nix index cd7ff01d..32a9bb37 100644 --- a/configurations/sway.nix +++ b/configurations/sway.nix @@ -60,12 +60,12 @@ in bars = [ { colors = { - background = "#fbffff"; - statusline = "#535c65"; - activeWorkspace = { border = "#6d7782"; background = "#6d7782"; text = "#fbffff"; }; - focusedWorkspace = { border = "#2b7ab2"; background = "#2b7ab2"; text = "#fbffff"; }; - inactiveWorkspace = { border = "#fbffff"; background = "#fbffff"; text = "#535c65"; }; - urgentWorkspace = { border = "#ae5865"; background = "#ae5865"; text = "#fbffff"; }; + background = "#ffffff"; + statusline = "#000000"; + activeWorkspace = { border = "#f2eff3"; background = "#f2eff3"; text = "#000000"; }; + focusedWorkspace = { border = "#6aaeff"; background = "#6aaeff"; text = "#000000"; }; + inactiveWorkspace = { border = "#ffffff"; background = "#ffffff"; text = "#000000"; }; + urgentWorkspace = { border = "#ff8892"; background = "#ff8892"; text = "#000000"; }; }; fonts = [ "Fira Code Normal 9" ]; position = "top"; diff --git a/configurations/sway/status-configuration.nix b/configurations/sway/status-configuration.nix index 2f9e7b15..d8a93d06 100644 --- a/configurations/sway/status-configuration.nix +++ b/configurations/sway/status-configuration.nix @@ -22,16 +22,16 @@ pkgs.writeText "configuration.toml" '' [theme] name = "gruvbox-light" [theme.overrides] - idle_bg="#fbffff" - idle_fg="#535c65" - info_bg="#2b7ab2" - info_fg="#fbffff" - good_bg="#4d7f43" - good_fg="#fbffff" - warning_bg="#906c33" - warning_fg="#fbffff" - critical_bg="#ae5865" - critical_fg="#fbffff" + idle_bg="#ffffff" + idle_fg="#000000" + info_bg="#6aaeff" + info_fg="#000000" + good_bg="#5ada88" + good_fg="#000000" + warning_bg="#f5df23" + warning_fg="#000000" + critical_bg="#ff8892" + critical_fg="#000000" separator="" [icons] diff --git a/flake.lock b/flake.lock index 52c5a62d..d8aca947 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ ] }, "locked": { - "lastModified": 1615014591, - "narHash": "sha256-zKLLOn6gFbI1gmlqMdIPkMJBiOmkVPIwprtvzZa1mhw=", + "lastModified": 1615236417, + "narHash": "sha256-ialggc4ff+coOaKIxreoynh+FPSs2cergePIQE1U8jE=", "owner": "nix-community", "repo": "home-manager", - "rev": "abc9d96d19e2c8a7f3a32b74894dc16ba4c25df0", + "rev": "57a7e5e2c53de58215fdac1910470bef36dd30cd", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1615003268, - "narHash": "sha256-7rTzyFQMnfPTOVU3lghtfjjMtf7Oo+RyShJt8jiRQnk=", + "lastModified": 1615190638, + "narHash": "sha256-tMxEgkf1boXafAqXx4W/KBzRybwwPBNImaNVA7F+JaA=", "owner": "chvp", "repo": "nixpkgs", - "rev": "8edfe0a2e8bfc750f7ac2818b2a4f364124806b6", + "rev": "1005b14672de04c6f46ca8a9a9c423fa358b7142", "type": "github" }, "original": { @@ -54,11 +54,11 @@ }, "nixpkgsFor0AD": { "locked": { - "lastModified": 1615016446, - "narHash": "sha256-glmmrBClnqmEy4lFkCby3Q8+JoMfhbaJi2+8AU1ojUc=", + "lastModified": 1615236825, + "narHash": "sha256-q8kL5pr3LsyYMWpMC+mPPap//BksKUmtc2+pvwpsWTo=", "owner": "chvp", "repo": "nixpkgs", - "rev": "bc5f1cf0b91390a0422d7fb8745fe2116d29884e", + "rev": "88f10fd1dc868506e6ad079d3adb3eec772da247", "type": "github" }, "original": { @@ -68,12 +68,28 @@ "type": "github" } }, + "nur": { + "locked": { + "lastModified": 1615242934, + "narHash": "sha256-OiMls+BNmilZb821QaYrXCtJC5rfdBEnzttTBLbpdso=", + "owner": "nix-community", + "repo": "NUR", + "rev": "3b4dc6d384d5dbadea4db00c2c3cbe967a7aa64e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "NUR", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", "home-manager": "home-manager", "nixpkgs": "nixpkgs", - "nixpkgsFor0AD": "nixpkgsFor0AD" + "nixpkgsFor0AD": "nixpkgsFor0AD", + "nur": "nur" } } }, diff --git a/flake.nix b/flake.nix index 509294eb..7347c3ff 100644 --- a/flake.nix +++ b/flake.nix @@ -7,11 +7,12 @@ url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; + nur.url = "github:nix-community/NUR"; nixpkgs.url = "github:chvp/nixpkgs/master"; nixpkgsFor0AD.url = "github:chvp/nixpkgs/0ad0.24"; }; - outputs = { self, nixpkgs, nixpkgsFor0AD, home-manager, flake-utils }: + outputs = { self, nixpkgs, nixpkgsFor0AD, nur, home-manager, flake-utils }: let version-suffix = nixpkgs.rev or (builtins.toString nixpkgs.lastModified); pkgsFor = system: import nixpkgs { @@ -31,6 +32,10 @@ ''); nix.nixPath = [ "nixpkgs=/etc/nixpkgs" ]; }) + ({ pkgs, ... }: { + nixpkgs.overlays = [ nur.overlay ]; + home-manager.sharedModules = [ pkgs.nur.repos.rycee.hmModules.emacs-init ]; + }) (./. + "/machines/${hostname}") ]; }; diff --git a/modules/default.nix b/modules/default.nix index 6dea3ca6..9c6360a3 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -7,6 +7,7 @@ ./bluetooth.nix ./docker.nix ./eid.nix + ./emacs.nix ./git.nix ./global-mailer.nix ./gomuks.nix @@ -74,22 +75,22 @@ console = { colors = [ - "fbffff" - "ae5865" - "4d7f43" - "906c33" - "2b7ab2" - "8f63a2" - "008483" - "535c65" - "6d7782" - "ae5865" - "4d7f43" - "906c33" - "2b7ab2" - "8f63a2" - "008483" - "434951" + "f8f8f8" + "a60000" + "005e00" + "813e00" + "0031a9" + "721045" + "00538b" + "282828" + "ffffff" + "972500" + "315b00" + "70480f" + "2544bb" + "8f0075" + "30517f" + "000000" ]; font = "Lat2-Terminus16"; keyMap = "us"; diff --git a/modules/emacs.nix b/modules/emacs.nix new file mode 100644 index 00000000..7578d4c2 --- /dev/null +++ b/modules/emacs.nix @@ -0,0 +1,116 @@ +{ config, lib, pkgs, ... }: + +{ + options.chvp.emacs = { + enable = lib.mkOption { + default = true; + example = false; + }; + }; + + config = lib.mkIf config.chvp.emacs.enable { + home-manager.users.charlotte = { ... }: { + programs.emacs = { + enable = true; + init = { + enable = true; + prelude = '' + (when window-system + (set-frame-font "Fira Code 9")) + (electric-pair-mode) + (global-display-line-numbers-mode) + + (defun emoji-fonts () + (set-fontset-font t 'symbol "Noto Color Emoji") + (set-fontset-font t 'symbol "Symbola" nil 'append)) + (if (daemonp) + (add-hook 'server-after-make-frame-hook #'emoji-fonts) + (emoji-fonts)) + ''; + recommendedGcSettings = true; + usePackageVerbose = true; + usePackage = { + better-defaults.enable = true; + company = { + enable = true; + diminish = [ "company-mode" ]; + config = "(global-company-mode)"; + }; + evil = { + enable = true; + config = "(evil-mode 1)"; + }; + fira-code-mode = { + enable = true; + config = "(global-fira-code-mode)"; + }; + flycheck = { + enable = true; + diminish = [ "flycheck-mode" ]; + config = "(global-flycheck-mode)"; + }; + ledger-mode = { + enable = true; + mode = [ ''"\\.journal\\'"'' ]; + config = '' + (setq ledger-binary-path "hledger") + (setq ledger-highlight-xact-under-point nil) + (setq ledger-post-account-alignment-column 4) + (setq ledger-post-amount-alignment-at :decimal) + (setq ledger-post-amount-alignment-column 59) + (setq ledger-post-auto-align t) + ''; + }; + lsp-mode = { + enable = true; + command = [ "lsp" ]; + config = '' + ''; + }; + markdown-mode = { + enable = true; + command = [ "markdown-mode" "gfm-mode" ]; + mode = [ + ''("README\\.md\\'" . gfm-mode)'' + ''("\\.md\\'" . markdown-mode)'' + ''("\\.markdown\\'" . markdown-mode)'' + ]; + }; + modus-themes = { + enable = true; + config = '' + (setq modus-themes-bold-constructs t + modus-themes-syntax 'alt-syntax-yellow-comments + modus-themes-promts 'intense-accented + modus-themes-mode-line 'borderless + modus-themes-region 'bg-only) + (modus-themes-load-themes) + (modus-themes-load-operandi) + ''; + }; + nix.enable = true; + nix-mode = { + enable = true; + mode = [ ''"\\.nix\\'"'' ]; + }; + python-mode = { + enable = true; + mode = [ ''"\\.py\\'"'' ]; + }; + ruby-mode = { + enable = true; + mode = [ + ''("\\.\\(?:cap\\|gemspec\\|irbrc\\|gemrc\\|rake\\|rb\\|ru\\|thor\\)\\'" . ruby-mode)'' + ''("\\(?:Brewfile\\|Capfile\\|Gemfile\\(?:\\.[a-zA-Z0-9._-]+\\)?\\|[rR]akefile\\)\\'" . ruby-mode)'' + ]; + }; + web-mode = { + enable = true; + mode = [ ''"\\.html\\.erb\\'"'' ]; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/zsh.nix b/modules/zsh.nix index 9df25560..1d301a23 100644 --- a/modules/zsh.nix +++ b/modules/zsh.nix @@ -33,7 +33,7 @@ "systemd" "tmux" ]; - theme = "agnoster"; + theme = "robbyrussell"; }; plugins = [{ name = "zsh-syntax-highlighting";