-
Notifications
You must be signed in to change notification settings - Fork 1
/
common.nix
230 lines (201 loc) · 4.79 KB
/
common.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
{
config,
pkgs,
lib,
inputs,
...
}:
with lib; {
options = {
machine = mkOption {
type = types.enum [
"laptop"
"framework"
"desktop"
"rpi"
];
};
};
config = {
nix = {
settings = {
trusted-users = ["root" "alex"];
auto-optimise-store = true;
};
registry.nixpkgs.flake = inputs.nixpkgs;
extraOptions = ''
keep-outputs = true
keep-derivations = true
experimental-features = nix-command flakes
'';
};
nixpkgs.config = {
allowUnfree = true;
};
services.printing = {
enable = true;
cups-pdf.enable = true;
};
security.sudo.enable = true;
security.sudo.extraConfig = "Defaults pwfeedback";
programs.sway = {
enable = true;
extraSessionCommands = ''
export _JAVA_AWT_WM_NONREPARENTING=1
export XDG_CURRENT_DESKTOP=sway
export XDG_SESSION_TYPE=wayland
export MOZ_ENABLE_WAYLAND=1
systemctl --user import-environment
'';
extraPackages = [];
wrapperFeatures.gtk = true;
};
programs.nm-applet = {
enable = true;
indicator = true;
};
boot.tmp.useTmpfs = true;
boot.supportedFilesystems = ["ntfs"];
boot.loader =
if config.machine == "rpi"
then {
grub.enable = false;
generic-extlinux-compatible.enable = true;
}
else {
# Use the systemd-boot EFI boot loader.
systemd-boot = {
enable = true;
consoleMode = "auto";
extraEntries = mkIf (config.machine == "desktop") {
"windows.conf" = ''
title Windows
efi /EFI/Microsoft/Boot/bootmgfw.efi
sort-key b_windows
'';
};
extraInstallCommands = ''
echo "auto-entries no" >> /boot/loader/loader.conf
'';
};
efi.canTouchEfiVariables = true;
};
networking.firewall = {
enable = true;
allowedTCPPortRanges = [
{
from = 1714;
to = 1764;
} # KDE Connect
];
allowedUDPPortRanges = [
{
from = 1714;
to = 1764;
} # KDE Connect
];
};
networking.networkmanager = {
enable = true;
};
i18n = {
defaultLocale = "en_GB.UTF-8";
};
hardware = {
bluetooth = {
enable = true;
};
graphics = {
enable = true;
};
brillo.enable = true;
};
# Set your time zone.
time.timeZone = "Europe/London";
# System packages
environment = {
systemPackages = with pkgs; [
git
bup
adwaita-icon-theme
];
};
# Load fonts
fonts = {
packages = with pkgs;
[
nerd-fonts.hack
symbola
dejavu_fonts
fira
source-code-pro
source-sans
]
++ optional (config.machine != "rpi") noto-fonts;
enableDefaultPackages = false;
fontconfig = {
enable = true;
antialias = true;
cache32Bit = true;
defaultFonts = {
monospace = ["Hack Nerd Font"];
sansSerif = ["DejaVu Sans"];
serif = ["DejaVu Serif"];
};
};
};
services = {
getty.autologinUser = "alex";
geoclue2 = {
enable = true;
appConfig.gammastep = {
isSystem = false;
isAllowed = true;
};
};
pipewire = {
enable = true;
alsa.enable = true;
pulse.enable = true;
wireplumber.extraConfig."11-bluetooth-policy" = {
"wireplumber.settings" = {
"bluetooth.autoswitch-to-headset-profile" = false;
};
};
};
dbus.enable = true;
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
];
wlr.enable = true;
};
# services.gvfs.enable = mkIf (config.machine != "rpi") true;
# programs.dconf.enable = mkIf (config.machine != "rpi") true;
programs.adb.enable = mkIf (config.machine != "rpi") true;
programs.steam = {
enable = true;
};
programs.fish = {
enable = true;
loginShellInit = ''
if not set -q SWAYSTARTED
if not set -q DISPLAY && test (tty) = /dev/tty1
set -g SWAYSTARTED 1
exec sway
end
end
'';
};
programs.nix-ld = {
enable = true;
};
# This value determines the NixOS release with which your system is to be
# compatible, in order to avoid breaking some software such as database
# servers. You should change this only after NixOS release notes say you
# should.
system.stateVersion = "18.09"; # Did you read the comment?
};
}