-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
303 lines (263 loc) Β· 9.08 KB
/
default.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
{
config,
inputs,
outputs,
pkgs,
edge-pkgs,
homemade-pkgs,
lib,
...
}:
let
# https://github.com/NixOS/nixpkgs/issues/309662#issuecomment-2155122284
zed-fhs = pkgs.buildFHSUserEnv {
name = "zed";
targetPkgs = pkgs: [
# version in nixos-24.05 does not enable IME
edge-pkgs.zed-editor
];
runScript = "zed";
meta.mainProgram = "zed";
};
in
{
imports = [
(import ./font.nix { inherit pkgs homemade-pkgs; })
inputs.xremap-flake.nixosModules.default
./xremap.nix
inputs.home-manager.nixosModules.home-manager
];
# Define a user account. Don't forget to set a password with βpasswdβ.
users.users = {
kachick = {
isNormalUser = true;
description = "An admin";
extraGroups = [
"networkmanager"
"wheel"
"input" # For finger print in GDM
];
packages = [
# Don't install spotify, it does not activate IME and no binary cache with the unfree license.
# Use Web Player or PWA
];
};
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
users.kachick = {
imports = [
../../home-manager/kachick.nix
../../home-manager/systemd.nix
../../home-manager/gnome.nix
];
};
extraSpecialArgs = {
inherit
inputs
outputs
edge-pkgs
homemade-pkgs
;
};
};
services.xserver = {
enable = true;
# Don't use other DM like SDDM, LightDM, lemurs for now. They don't start GNOME for now... (AFAIK)
# And when I was using KDE, GDM only worked, SDDM didn't work
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/gdm.nix
displayManager.gdm.enable = true;
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/services/x11/display-managers/lightdm.nix
# displayManager.lightdm.enable = false;
desktopManager.gnome = {
enable = true;
# https://github.com/NixOS/nixpkgs/issues/114514
extraGSettingsOverridePackages = [ pkgs.gnome.mutter ];
};
# Configure keymap in X11
xkb = {
layout = "us";
variant = "";
};
};
services.udev.packages = with pkgs; [ gnome.gnome-settings-daemon ];
programs = {
# https://github.com/nix-community/home-manager/blob/release-24.05/modules/misc/dconf.nix#L39-L42
dconf.enable = true;
# For lanching with command looks like better than alacritty
gnome-terminal.enable = true;
};
environment.gnome.excludePackages =
(with pkgs; [
gnome-tour
gnome-connections
])
++ (with pkgs.gnome; [
epiphany # web browser
geary # email reader
evince # document viewer
gnome-calendar
gnome-music # does not support flac by defaults
]);
# Enable touchpad support (enabled default in most desktopManager).
services.libinput = {
enable = true;
mouse.naturalScrolling = true;
touchpad.naturalScrolling = true;
};
services.dbus.packages = [ config.i18n.inputMethod.package ];
services.blueman.enable = true;
environment.systemPackages =
[ zed-fhs ]
++ (with pkgs; [
firefox
# https://github.com/NixOS/nixpkgs/issues/33282
xdg-user-dirs
alacritty
# TODO: Reconsider to drop this
skk-dicts
skktools
lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode
# gnome-music does not support flac.
# tramhao/termusic and tsirysndr/music-player does not figure how to use.
rhythmbox
evtest # To debug keyremapper as GH-786
newsflash # RSS reader # TODO: Manage config (sqlite?) or Backup the exported OPML
# Don't use unstable channel. It frequently backported to stable channel
# - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/networking/instant-messengers/signal-desktop/signal-desktop.nix
(signal-desktop.overrideAttrs (prev: {
preFixup =
prev.preFixup
+ ''
gappsWrapperArgs+=(
--add-flags "--enable-features=UseOzonePlatform"
--add-flags "--ozone-platform=wayland"
--add-flags "--enable-wayland-ime"
--add-flags "--disable-features=WaylandFractionalScaleV1"
)
'';
}))
gnome.dconf-editor
# https://github.com/NixOS/nixpkgs/issues/174353 - Super + / runs launcher by default
pop-launcher
nordic
## Unfree packages
# TODO: Consider using vscodium again
# TODO: Consider to drop the unuseful vscode until fixed the Wayland problems
# Don't use unstable channel. It frequently backported to stable channel
# - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/applications/editors/vscode/vscode.nix
(vscode.override (prev: {
# https://wiki.archlinux.org/title/Wayland#Electron
# https://github.com/NixOS/nixpkgs/blob/3f8b7310913d9e4805b7e20b2beabb27e333b31f/pkgs/applications/editors/vscode/generic.nix#L207-L214
commandLineArgs = (prev.commandLineArgs or [ ]) ++ [
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
"--enable-wayland-ime"
# https://github.com/microsoft/vscode/issues/192590#issuecomment-1731312805
# This bug appeared only when using GNOME, not in KDE
"--disable-features=WaylandFractionalScaleV1"
];
}))
# Don't use unstable channel. It frequently backported to stable channel
# - https://github.com/NixOS/nixpkgs/commits/nixos-24.05/pkgs/by-name/go/google-chrome/package.nix
# - Actually unstable is/was broken. See GH-776
#
# if you changed hostname and chrome doesn't run, see https://askubuntu.com/questions/476918/google-chrome-wont-start-after-changing-hostname
# `rm -rf ~/.config/google-chrome/Singleton*`
(google-chrome.override (prev: {
# https://wiki.archlinux.org/title/Chromium#Native_Wayland_support
# Similar as https://github.com/nix-community/home-manager/blob/release-24.05/modules/programs/chromium.nix
commandLineArgs = (prev.commandLineArgs or [ ]) ++ [
"--ozone-platform=wayland"
"--ozone-platform-hint=auto"
"--enable-wayland-ime"
];
}))
])
++ (with pkgs.gnomeExtensions; [
appindicator
# Should be changed from default CSS to another to avoid https://github.com/pop-os/shell/issues/132
# https://github.com/pop-os/shell/blob/cfa0c55e84b7ce339e5ce83832f76fee17e99d51/light.css#L20-L24
# Apple same color as nord(Nordic) https://github.com/EliverLara/Nordic/blob/5c53654fb6f3e0266ad8c481a099091e92f28274/gnome-shell/_colors.scss#L14-L15
(pop-shell.overrideAttrs (prev: {
preFixup =
prev.preFixup
+ ''
echo '.pop-shell-search-element:select{ background: #8fbcbb !important; color: #fefefe !important; }' >> $out/share/gnome-shell/extensions/[email protected]/light.css
'';
}))
clipboard-history
kimpanel
just-perfection
dash-to-dock
color-picker
xremap
]);
# Make it natural scroll on KDE, not enough only in libinput
# https://github.com/NixOS/nixpkgs/issues/51875#issuecomment-846251880
# environment.etc."X11/xorg.conf.d/30-touchpad.conf".text = ''
# Section "InputClass"
# Identifier "libinput touchpad catchall"
# MatchIsTouchpad "on"
# MatchDevicePath "/dev/input/event*"
# Driver "libinput"
# Option "NaturalScrolling" "on"
# EndSection
# '';
# https://askubuntu.com/a/88947
environment.etc."gdm/PostLogin/Default".source = lib.getExe (
pkgs.writeShellApplication {
name = "connect_cloudflare-warp";
runtimeInputs = with edge-pkgs; [ cloudflare-warp ];
text = ''
warp-cli connect
'';
}
);
environment.variables = {
VISUAL = "${lib.getExe zed-fhs} --wait";
# Don't set *IM_MODULE in KDE: https://discuss.kde.org/t/kde-plasma-wayland/9014
# QT_IM_MODULE = "fcitx";
XMODIFIERS = "@im=fcitx";
};
environment.sessionVariables = {
MOZ_ENABLE_WAYLAND = "1";
NIXOS_OZONE_WL = "1";
# Avoiding hidden or unstable mouse cursors when using Alacritty/Wezterm on Wayland
#
# https://github.com/NixOS/nixpkgs/issues/22652
# https://github.com/alacritty/alacritty/issues/6703#issuecomment-2222503206
XCURSOR_THEME = "Adwaita";
};
# https://github.com/NixOS/nixpkgs/issues/33282#issuecomment-523572259
environment.etc."xdg/user-dirs.defaults".text = ''
DESKTOP=Desktop
DOCUMENTS=Documents
DOWNLOAD=Downloads
MUSIC=Music
PICTURES=Pictures
PUBLICSHARE=Public
TEMPLATES=Templates
VIDEOS=Videos
'';
# https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/firefox.nix
programs.firefox = {
enable = true;
languagePacks = [
"en-US"
"ja"
];
};
i18n = {
inputMethod = {
enabled = "fcitx5";
fcitx5.addons = [
pkgs.fcitx5-mozc
pkgs.fcitx5-gtk
];
fcitx5.waylandFrontend = true;
};
};
}