-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
95 lines (84 loc) · 3.21 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{
description = "heywoodlh wezterm flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.fish-flake.url = "github:heywoodlh/flakes?dir=fish";
inputs.nixgl.url = "github:nix-community/nixGL";
outputs = { self, nixpkgs, fish-flake, flake-utils, nixgl, }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ nixgl.overlay ];
};
myZellij = fish-flake.packages.${system}.zellij;
jetbrains_nerdfont = (pkgs.nerdfonts.override { fonts = [ "JetBrainsMono" ]; });
settings = ''
-- Add config folder to watchlist for config reloads.
local wezterm = require 'wezterm';
wezterm.add_to_config_reload_watch_list(wezterm.config_dir)
-- Pull in the wezterm API
local wezterm = require 'wezterm'
-- This table will hold the configuration.
local config = {}
-- In newer versions of wezterm, use the config_builder which will
-- help provide clearer error messages
if wezterm.config_builder then
config = wezterm.config_builder()
end
-- Nord color scheme:
config.color_scheme = 'nord'
config.font_size = 14.0
-- Appearance tweaks
config.window_decorations = "RESIZE"
config.hide_tab_bar_if_only_one_tab = true
config.audible_bell = "Disabled"
config.window_background_opacity = 0.9
-- Set Zellij to default shell
config.default_prog = { "${myZellij}/bin/zellij" }
-- Use Jetbrains font directory
config.font_dirs = { "${jetbrains_nerdfont}/share/fonts" }
'';
berkeleymono-settings = pkgs.writeText "wezterm.lua" ''
${settings}
config.font = wezterm.font_with_fallback {
'Berkeley Mono',
'JetBrainsMono Nerd Font Mono',
'Iosevka Nerd Font Mono',
'SF Mono Regular',
'DejaVu Sans Mono',
}
return config
'';
non-berkeleymono-settings = pkgs.writeText "wezterm.lua" ''
${settings}
config.font = wezterm.font_with_fallback {
'JetBrainsMono Nerd Font Mono',
'Iosevka Nerd Font Mono',
'SF Mono Regular',
'DejaVu Sans Mono',
}
return config
'';
in {
packages = rec {
wezterm = pkgs.writeShellScriptBin "wezterm" ''
if ${pkgs.wezterm}/bin/wezterm ls-fonts --list-system | grep -iq 'Berkeley Mono'
then
${pkgs.wezterm}/bin/wezterm --config-file ${berkeleymono-settings} $@
else
${pkgs.wezterm}/bin/wezterm --config-file ${non-berkeleymono-settings} $@
fi
'';
wezterm-gl = pkgs.writeShellScriptBin "wezterm" ''
if ${pkgs.wezterm}/bin/wezterm ls-fonts --list-system | grep -iq 'Berkeley Mono'
then
${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL ${pkgs.wezterm}/bin/wezterm --config-file ${berkeleymono-settings} $@
else
${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL ${pkgs.wezterm}/bin/wezterm --config-file ${non-berkeleymono-settings} $@
fi
'';
default = wezterm;
};
}
);
}