From bb817e9dec1973bcff10c1c3239bb461c2195cc1 Mon Sep 17 00:00:00 2001 From: bad Date: Mon, 19 Sep 2022 15:41:22 +0200 Subject: [PATCH] Move alacritty into a separate module --- users/maekasza/default.nix | 17 ++---- users/modules/alacritty/default.nix | 79 ++++++++++++++++++++++++++++ users/profiles/alacritty/default.nix | 58 -------------------- 3 files changed, 84 insertions(+), 70 deletions(-) create mode 100644 users/modules/alacritty/default.nix delete mode 100644 users/profiles/alacritty/default.nix diff --git a/users/maekasza/default.nix b/users/maekasza/default.nix index 6f6a706..dce94e2 100644 --- a/users/maekasza/default.nix +++ b/users/maekasza/default.nix @@ -1,21 +1,14 @@ { pkgs, ... }: { - imports = [ ../profiles/direnv ../profiles/git ../profiles/zsh ../profiles/neovim ../profiles/syncthing ../profiles/kdeconnect ../profiles/podman ../profiles/alacritty ../profiles/tmux ../profiles/mpv ../profiles/sway ]; + imports = [ ../profiles/direnv ../profiles/git ../profiles/zsh ../profiles/neovim ../profiles/syncthing ../profiles/kdeconnect ../profiles/podman ../profiles/tmux ../profiles/mpv ../profiles/sway ]; targets.genericLinux.enable = true; - programs.alacritty.package = pkgs.symlinkJoin { - name = "alacritty-nixgl"; - paths = [ - (pkgs.writeShellScriptBin - "alacritty" - '' - ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ${pkgs.alacritty}/bin/alacritty "$@" - '') - pkgs.alacritty - ]; - }; home.packages = [ pkgs.home-manager ]; wayland.windowManager.sway.extraSessionCommands = '' export WLR_NO_HARDWARE_CURSORS=1 ''; + mae.alacritty = { + enable = true; + libglWrapper = true; + }; home.sessionVariables = { XDG_DATA_DIRS = "$XDG_DATA_DIRS:/var/lib/flatpak/exports/share:$HOME/.local/share/flatpak/exports/share"; diff --git a/users/modules/alacritty/default.nix b/users/modules/alacritty/default.nix new file mode 100644 index 0000000..79dfb03 --- /dev/null +++ b/users/modules/alacritty/default.nix @@ -0,0 +1,79 @@ +{ pkgs, lib, config, ... }: +let + cfg = config.mae.alacritty; + alacrittyLibGL = pkgs.symlinkJoin { + name = "alacritty-nixgl"; + paths = [ + (pkgs.writeShellScriptBin + "alacritty" + '' + ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ${pkgs.alacritty}/bin/alacritty "$@" + '') + pkgs.alacritty + ]; + }; +in +{ + options.mae.alacritty = { + enable = lib.mkEnableOption "Enable the alacritty terminal"; + libglWrapper = lib.mkEnableOption "Wrap alacritty in libgl to make it work on non nixos systems"; + }; + config = lib.mkIf cfg.enable { + fonts.fontconfig.enable = true; + home.packages = [ + (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) + ]; + programs.alacritty = { + package = lib.mkIf cfg.libglWrapper alacrittyLibGL; + enable = true; + settings = { + window = { + padding = { + x = 6; + y = 6; + }; + }; + font = { + normal = { + family = "JetBrainsMono Nerd Font"; + }; + size = 12; + }; + colors = { + primary = { + background = "#161821"; + foreground = "#d2d4de"; + }; + normal = { + black = "#161821"; + red = "#e27878"; + green = "#b4be82"; + yellow = "#e2a478"; + blue = "#84a0c6"; + magenta = "#a093c7"; + cyan = "#89b8c2"; + white = "#c6c8d1"; + }; + bright = { + black = "#6b7089"; + red = "#e98989"; + green = "#c0ca8e"; + yellow = "#e9b189"; + blue = "#91acd1"; + magenta = "#ada0d3"; + cyan = "#95c4ce"; + white = "#d2d4de"; + }; + }; + cursor = { + style = "Block"; + blinking = "On"; + }; + live_config_reload = false; + mouse = { + hide_when_typing = false; + }; + }; + }; + }; +} diff --git a/users/profiles/alacritty/default.nix b/users/profiles/alacritty/default.nix deleted file mode 100644 index c15ae93..0000000 --- a/users/profiles/alacritty/default.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ pkgs, ... }: -{ - fonts.fontconfig.enable = true; - home.packages = [ - (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; }) - ]; - programs.alacritty = { - enable = true; - settings = { - window = { - padding = { - x = 6; - y = 6; - }; - }; - font = { - normal = { - family = "JetBrainsMono Nerd Font"; - }; - size = 12; - }; - colors = { - primary = { - background = "#161821"; - foreground = "#d2d4de"; - }; - normal = { - black = "#161821"; - red = "#e27878"; - green = "#b4be82"; - yellow = "#e2a478"; - blue = "#84a0c6"; - magenta = "#a093c7"; - cyan = "#89b8c2"; - white = "#c6c8d1"; - }; - bright = { - black = "#6b7089"; - red = "#e98989"; - green = "#c0ca8e"; - yellow = "#e9b189"; - blue = "#91acd1"; - magenta = "#ada0d3"; - cyan = "#95c4ce"; - white = "#d2d4de"; - }; - }; - cursor = { - style = "Block"; - blinking = "On"; - }; - live_config_reload = false; - mouse = { - hide_when_typing = false; - }; - }; - }; -}