From cdb768a506f1e7ecad2f04eb8066eb1514ed7491 Mon Sep 17 00:00:00 2001 From: Nathan McCarty Date: Sat, 15 Oct 2022 04:37:14 -0400 Subject: [PATCH] Factor out alacritty config Also use a different font size on mac --- home-manager/common/programs/emacs.nix | 2 +- home-manager/common/programs/terminal.nix | 57 +++++++++++++++++++++++ home-manager/darwin/default.nix | 10 +++- home-manager/linux/default.nix | 8 +++- home-manager/linux/programs/sway.nix | 45 ------------------ modules/darwin/default.nix | 5 -- 6 files changed, 73 insertions(+), 54 deletions(-) create mode 100644 home-manager/common/programs/terminal.nix diff --git a/home-manager/common/programs/emacs.nix b/home-manager/common/programs/emacs.nix index 192b524..13268be 100644 --- a/home-manager/common/programs/emacs.nix +++ b/home-manager/common/programs/emacs.nix @@ -38,7 +38,7 @@ programs.emacs = { enable = true; package = config.nathan.programs.emacs.package; - extraPackages = epkgs: [ pkgs.mu pkgs.vterm ]; + extraPackages = epkgs: [ pkgs.mu epkgs.vterm ]; }; })) (lib.mkIf (config.nathan.programs.emacs.enable && pkgs.stdenv.isLinux) { diff --git a/home-manager/common/programs/terminal.nix b/home-manager/common/programs/terminal.nix new file mode 100644 index 0000000..7f88f0e --- /dev/null +++ b/home-manager/common/programs/terminal.nix @@ -0,0 +1,57 @@ +{ config, lib, pkgs, inputs, ... }: +let nathan = config.nathan; +in with lib; { + config = mkIf nathan.programs.alacritty { + home.packages = with pkgs; + [ + # Terminal + alacritty + ]; + ######################### + ## Alacritty + ######################### + programs.alacritty = { + enable = true; + settings = { + env = { + TERM = "xterm-256color"; + ALACRITTY = "1"; + }; + font = { + normal.family = "FiraCode Nerd Font"; + bold.family = "FiraCode Nerd Font"; + italic.family = "FiraCode Nerd Font"; + bold_italic.family = "FiraCode Nerd Font"; + # Bigger on darwin + size = if pkgs.stdenv.isLinux then 9.0 else 11.0; + }; + colors = { + primary = { + background = "0x103c48"; + foreground = "0xadbcbc"; + }; + normal = { + black = "0x184956"; + red = "0xfa5750"; + green = "0x75b938"; + yellow = "0xdbb32d"; + blue = "0x4695f7"; + magenta = "0xf275be"; + cyan = "0x41c7b9"; + white = "0x72898f"; + }; + bright = { + black = "0x2d5b69"; + red = "0xff665c"; + green = "0x84c747"; + yellow = "0xebc13d"; + blue = "0x58a3ff"; + magenta = "0xff84cd"; + cyan = "0x53d6c7"; + white = "0xcad8d9"; + }; + }; + }; + }; + }; +} diff --git a/home-manager/darwin/default.nix b/home-manager/darwin/default.nix index d0b83fa..b6bd37b 100644 --- a/home-manager/darwin/default.nix +++ b/home-manager/darwin/default.nix @@ -12,10 +12,18 @@ with nLib; { ../common/programs/core.nix ../common/programs/devel.nix ../common/programs/emacs.nix + ../common/programs/terminal.nix ./programs/core.nix ]; - options = { }; + options = { + nathan = { + programs = { + # Alacrity, on by default on mac + alacritty = mkDefaultOption "alacritty" config.nathan.config.isDesktop; + }; + }; + }; config = { # Link applications in spotlight/launchpad diff --git a/home-manager/linux/default.nix b/home-manager/linux/default.nix index ef768dc..16dc172 100644 --- a/home-manager/linux/default.nix +++ b/home-manager/linux/default.nix @@ -9,10 +9,11 @@ in with lib; with nLib; { imports = [ ../options.nix - ./programs/sway.nix ../common/programs/core.nix - ./programs/communications.nix ../common/programs/devel.nix + ../common/programs/terminal.nix + ./programs/sway.nix + ./programs/communications.nix ./programs/devel.nix ./programs/emacs.nix ./programs/image-editing.nix @@ -54,6 +55,9 @@ with nLib; { swaywm = { enable = mkDefaultOption "swaywm" config.nathan.config.isDesktop; }; + # Alacritty, follows sway + alacritty = + mkDefaultOption "alacritty" config.nathan.config.programs.swaywm; # Communications applications communications = { # Enable by default if we are on a linux desktop diff --git a/home-manager/linux/programs/sway.nix b/home-manager/linux/programs/sway.nix index d598cf1..a3bd90d 100644 --- a/home-manager/linux/programs/sway.nix +++ b/home-manager/linux/programs/sway.nix @@ -530,51 +530,6 @@ in with lib; { Install = { WantedBy = [ "graphical-session-pre.target" ]; }; }; ######################### - ## Alacritty - ######################### - programs.alacritty = { - enable = true; - settings = { - env = { - TERM = "xterm-256color"; - ALACRITTY = "1"; - }; - font = { - normal.family = "FiraCode Nerd Font"; - bold.family = "FiraCode Nerd Font"; - italic.family = "FiraCode Nerd Font"; - bold_italic.family = "FiraCode Nerd Font"; - size = 9.0; - }; - colors = { - primary = { - background = "0x103c48"; - foreground = "0xadbcbc"; - }; - normal = { - black = "0x184956"; - red = "0xfa5750"; - green = "0x75b938"; - yellow = "0xdbb32d"; - blue = "0x4695f7"; - magenta = "0xf275be"; - cyan = "0x41c7b9"; - white = "0x72898f"; - }; - bright = { - black = "0x2d5b69"; - red = "0xff665c"; - green = "0x84c747"; - yellow = "0xebc13d"; - blue = "0x58a3ff"; - magenta = "0xff84cd"; - cyan = "0x53d6c7"; - white = "0xcad8d9"; - }; - }; - }; - }; - ######################### ## EasyEffects ######################### services.easyeffects.enable = true; diff --git a/modules/darwin/default.nix b/modules/darwin/default.nix index d1f4815..d253ba9 100644 --- a/modules/darwin/default.nix +++ b/modules/darwin/default.nix @@ -18,10 +18,6 @@ in { fonts = mkDefaultOption "fonts" config.nathan.config.isDesktop; }; programs = { - util = { - # Core macos utilities like iterm2 and what not - core = mkDefaultOption "core" true; - }; # Firefox, enabled by default on linux desktop firefox = mkDefaultOption "Firefox" config.nathan.config.isDesktop; syncthing = @@ -71,7 +67,6 @@ in { cleanup = "zap"; }; casks = lib.mkMerge [ - (lib.mkIf config.nathan.programs.util.core [{ name = "iterm2"; }]) (lib.mkIf config.nathan.programs.firefox [{ name = "firefox"; }]) (lib.mkIf config.nathan.programs.communications.enable [ { name = "discord"; }