-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.nix
316 lines (266 loc) Β· 9.98 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
304
305
306
307
308
309
310
311
312
313
314
315
316
{
config,
inputs,
pkgs,
edge-pkgs,
homemade-pkgs,
lib,
...
}:
{
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
"libvirtd" # For virt-manager
];
packages = [
# Don't install spotify, it does not activate IME and no binary cache with the unfree license.
# Use Web Player or PWA
];
};
};
i18n = {
# GNOME respects this, I don't know how to realize it only via home-manager
defaultLocale = "ja_JP.UTF-8";
};
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 ];
# To avoid unexpected overriding with the NixOS module. I prefer gpg-agent or another way for that.
programs.ssh.enableAskPassword = false;
# https://nixos.wiki/wiki/Virt-manager
#
# distrobox is a container based solution, not vm. And see https://github.com/89luca89/distrobox/issues/958
virtualisation.libvirtd.enable = true;
programs.virt-manager.enable = true;
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
]);
# Recommended to be uninstalled by gnupg. I prefer this way, even though disabling gpg-agent ssh integrations.
# https://wiki.gnupg.org/GnomeKeyring
#
# And enabling this makes $SSH_AUTH_SOCK overriding even through enabled gpg-agent in home-manager
# https://github.com/NixOS/nixpkgs/issues/101616
#
# Using mkforce for https://discourse.nixos.org/t/gpg-smartcard-for-ssh/33689/3
services.gnome.gnome-keyring.enable = lib.mkForce false;
# 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 =
[
# version in nixos-24.05 does not enable IME
# Don't use `buildFHSEnv` even through want to apply LSP smart. See GH-809
edge-pkgs.zed-editor
# Adding for zed instead of zeditor since https://github.com/NixOS/nixpkgs/pull/344193. Also keep original zed-editor package here to add icons for GUI
homemade-pkgs.zed
edge-pkgs.podman-desktop
edge-pkgs.cyme # Frequently updated
edge-pkgs.gdm-settings # Useable since https://github.com/NixOS/nixpkgs/pull/335233
]
++ (with pkgs; [
firefox
# https://github.com/NixOS/nixpkgs/issues/33282
xdg-user-dirs
alacritty
foot
kitty
# TODO: Reconsider to drop this
skk-dicts
skktools
lshw
lapce # IME is not working on Windows, but stable even around IME on Wayland than vscode
# Add LSP global for zed-editor. Prefer external package for helix
typos-lsp
vscode-langservers-extracted
nodePackages.bash-language-server
# 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
# TODO: Add `"--wayland-text-input-version=3"` after signal-desktop updates the Electron to 33.0.0 or higher. See GH-689 for detail.
# 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
gnome.gnome-boxes
# https://github.com/NixOS/nixpkgs/issues/174353 - Super + / runs launcher by default
pop-launcher
nordic
## Unfree packages
# TODO: Add `"--wayland-text-input-version=3"` after vscode updates the Electron to 33.0.0 or higher. See GH-689 for detail.
# TODO: Consider using vscodium again
# 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 [ ]) ++ [
"--enable-features=UseOzonePlatform"
"--ozone-platform=wayland"
"--ozone-platform-hint=auto"
"--wayland-text-input-version=3"
"--enable-wayland-ime"
];
}))
])
++ (with pkgs.gnomeExtensions; [
appindicator
paperwm
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 edge-pkgs.zed-editor} --wait";
XMODIFIERS = "@im=fcitx"; # Required in both GNOME and KDE
# https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland
# Don't set these in KDE, but should set in GNOME https://discuss.kde.org/t/kde-plasma-wayland/9014
QT_IM_MODULE = "fcitx";
GTK_IM_MODULE = "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";
__HM_SESS_VARS_SOURCED = ""; # Workaround for GH-755 and GH-890
};
# 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;
};
};
# TODO: Consider to use headscale
services.tailscale.enable = true;
}