-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.nix
465 lines (430 loc) · 10.1 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
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
{ config
, pkgs
, system
, pkgs-olive
, pkgs-py36
, pkgs-py37
, pkgs-py39
, ...
}:
let
# prefer over using hardware.nvidia.prime.offload.enableOffloadCmd = true;
# because that is only true when offload mode is turned on (see
# pseries.nix where it's turned off for isolation from nixos-hardware
# upstream changes)
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';
start-virsh = pkgs.writeShellScriptBin "start-virsh" ''
sudo virsh net-list --all
sudo virsh net-autostart default
sudo virsh net-start default
'';
nixos-repl = pkgs.writeScriptBin "nixos-repl" ''
#!/usr/bin/env ${pkgs.expect}/bin/expect
set timeout 120
spawn -noecho nix --extra-experimental-features repl nixpkgs
expect "nix-repl> " {
send ":a builtins\n"
send "pkgs = legacyPackages.${system}\n"
interact
}
'';
findnixstorelinks = pkgs.substituteAll ({
name = "findnixstorelinks";
src = ./bin/findnixstorelinks.py;
dir = "/bin";
isExecutable = true;
py = "${pkgs.python311}/bin/python";
});
in
{
imports = [
./pkgs/cachix.nix
./pkgs/dvtranscode.nix
./pkgs/rdio-scanner
./pkgs/trunk-recorder
];
# see https://chattingdarkly.org/@[email protected]/110661879831891580
system.activationScripts.diff = {
supportsDryActivation = true;
text = ''
${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff \
/run/current-system "$systemConfig"
'';
};
nix = {
settings = {
tarball-ttl = 300;
auto-optimise-store = true;
experimental-features = "nix-command flakes";
trusted-users = [ "root" "@wheel" ];
#sandbox = "relaxed";
};
gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
};
# NVIDIA requires nonfree
nixpkgs.config.allowUnfree = true;
nixpkgs.config.permittedInsecurePackages = [
"electron-19.1.9"
"python-2.7.18.8"
]; # something unknown (maybe matrix or signal desktop) and unmaintained python
# obs
boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ];
# rtl8153 / tp-link ue330 quirk for USB ethernet, see
# https://askubuntu.com/questions/1081128/usb-3-0-ethernet-adapter-not-working-ubuntu-18-04
# disables link power management for this usb ethernet adapter; won't work
# otherwise
boot.kernelParams = [
"usbcore.quirks=2357:0601:k,0bda:5411:k" # ethernet, hub
];
# match "Jun 19 13:00:01 thinknix512 cupsd[2350]: Expiring subscriptions..."
systemd.services.cups = {
overrideStrategy = "asDropin";
serviceConfig.LogFilterPatterns = "~.*Expiring subscriptions.*";
};
# restart faster
systemd.extraConfig = ''
DefaultTimeoutStopSec=10s
'';
networking.networkmanager.enable = true;
networking.firewall.enable = false;
time.timeZone = "America/New_York";
hardware.bluetooth.enable = true;
hardware.enableAllFirmware = true;
hardware.flipperzero.enable = true;
# desktop stuff
services.xserver.enable = true;
services.displayManager.sddm.enable = true;
services.xserver.displayManager.sessionCommands = let
# disable middle click
modmap = pkgs.writeText "modmap" ''
pointer 1 0 3 4 5
'';
in
"${pkgs.xorg.xmodmap}/bin/xmodmap ${modmap}";
services.desktopManager.plasma6.enable = true;
services.xserver.xkb.layout = "us";
services.xserver.xkb.options = "ctrl:nocaps,terminate:ctrl_alt_bksp";
services.xserver.enableCtrlAltBackspace = true;
services.xserver.dpi = 96;
services.libinput.enable = true; # touchpad
fonts.packages = with pkgs; [ ubuntu_font_family nerdfonts ];
i18n.defaultLocale = "en_US.UTF-8";
sound.enable = false; # not needed for pipewire
hardware.pulseaudio.enable = false;
services.pipewire = {
enable = true;
alsa = {
enable = true;
support32Bit = true;
};
jack.enable = true;
pulse.enable = true;
};
# virtualization
virtualisation.libvirtd.enable = true;
# virtualisation.virtualbox.host = {
# enable = true;
# enableExtensionPack = true;
# };
# vmVariant configuration is added only when building VM with nixos-rebuild
# build-vm
virtualisation.vmVariant = {
virtualisation = {
memorySize = 8192; # Use 8GB memory (value is in MB)
cores = 4;
};
};
# enable docker
virtualisation.docker.enable = true;
programs.dconf.enable = true;
# printing
services.printing.enable = true;
services.avahi.enable = true;
services.avahi.nssmdns4 = true;
# https://discourse.nixos.org/t/newly-announced-vulnerabilities-in-cups/52771/9
systemd.services.cups-browsed.enable = false;
# all other services
services.fwupd.enable = true;
services.locate.enable = false;
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
PermitRootLogin = "no";
};
};
hardware.rtl-sdr.enable = true;
services.udev.packages = [pkgs.airspy];
# wireshark without sudo; note that still necessary to add
# wireshark to systemPackages to get gui I think
programs.wireshark.enable = true;
# default shell for all users
users.defaultUserShell = pkgs.zsh;
programs.zsh.enable = true;
programs.ssh = {
pubkeyAcceptedKeyTypes = [ "ssh-ed25519" "ssh-rsa" ];
hostKeyAlgorithms = [ "ssh-ed25519" "ssh-rsa" ];
startAgent = true; # starts a systemd user service
};
# enable nix-ld for pip and friends
#programs.nix-ld.enable = true;
users.groups.nixconfig = { };
# # this causes weirdness when vim is exited, printing mouse movements
# # as ANSI sequences on any terminal; use shift to select text as a
# # workaround
# environment.etc."vimrc".text = ''
# " get rid of maddening mouseclick-moves-cursor behavior
# set mouse=
# set ttymouse=
# '';
# run appimages directly (see https://nixos.wiki/wiki/Appimage)
boot.binfmt = {
registrations.appimage = {
wrapInterpreterInShell = false;
interpreter = "${pkgs.appimage-run}/bin/appimage-run";
recognitionType = "magic";
offset = 0;
mask = "\\xff\\xff\\xff\\xff\\x00\\x00\\x00\\x00\\xff\\xff\\xff";
magicOrExtension = "\\x7fELF....AI\\x02";
};
# run aarch64 binaries
emulatedSystems = [ "aarch64-linux" ];
};
environment.variables = {
EDITOR = "vi";
};
environment.systemPackages = with pkgs; [
cachix
nvidia-offload
vim-full
wget
(wrapOBS {
plugins = with pkgs.obs-studio-plugins; [ obs-backgroundremoval ];
})
thermald
powertop
kdePackages.kdeconnect-kde
kdePackages.krdc
kdePackages.breeze-gtk
kdePackages.konversation
kdePackages.kmag
kdePackages.kdenlive
gnome.gnome-disk-utility
openvpn
unzip
ripgrep
btop
killall
htop
handbrake
mpv
vlc
google-chrome
firefox
audacity
gimp
transmission-qt
remmina
baobab
signal-desktop
python27
pkgs.vscode-fhs
pkgs-py36.python36
pkgs-py37.python37
pkgs-py39.python38
pkgs-py39.python39
python310
(python311.withPackages (p:
with p; [
python311Packages.pyserial # for pico-w-go in vscode
python311Packages.pyflakes # for emacs
python311Packages.flake8 # for emacs/vscode
python311Packages.docutils # for vscode
python311Packages.pygments # for vscode
python311Packages.black # for cmdline and vscode
python311Packages.tox # for... tox
]))
pypy3
xz
libreoffice
ffmpeg-full
iperf
pciutils
neofetch
tmux
s-tui
stress-ng
usbutils
nmap
zoom-us
nixfmt-rfc-style
wakeonlan
#pkgs-olive.olive-editor # 0.1.2
olive-editor # 0.2
gptfdisk # "sgdisk"
ardour
qjackctl
odin2
freepats
helm
distrho
calf
x42-plugins
tap-plugins
zam-plugins
setbfree
x42-avldrums
zynaddsubfx
sfizz
#vcv-rack # (uncached)
hydrogen
surge-XT
#lsp-plugins # (too many plugins)
sanoid
hplip
geteltorito
argyllcms
xcalib
virt-manager
rpi-imager
dig
s3cmd
#kaffeine
thonny
cutecom
rshell
mplayer
gnome.cheese
sqlite
tldr
tree
lha
quickemu
quickgui
gnome.zenity # undeclared dep of quickgui
nix-du
graphviz
zgrviewer
bintools # "strings"
thinkfan
lm_sensors
cntr # for build debugging
gnupg
pinentry # dep of gpg
age # for flyingcircus
lsof
progress
mc
#etcher # 24.05 removed
pre-commit
html-tidy
dua
duf
ncdu
inetutils # for telnet
asciiquarium
rig
cowsay
banner
lolcat
fortune
file
ruby
nix-tree
fdupes
dupe-krill
dupeguru
pv
fio
mbuffer
qjournalctl
gnumake
bat
ethtool
wol
imagemagick
audiowaveform
element-desktop
speech-denoiser
rnnoise-plugin
rhythmbox
minicom
nvtopPackages.nvidia
#glaxnimate # for kdenlive
nix-index # for nix-locate
bitwarden
any-nix-shell
pico-sdk
sdcc
dstat
speedtest-cli
fast-cli
nmap
bottom
wireshark
openssl
geekbench
start-virsh
nixos-repl
lazygit
gittyup
github-desktop
gitkraken
meld
#kdiff3
envsubst
appimage-run
jq
gnome.gucharmap
loccount
screenkey
gsmartcontrol
smartmontools
dtc # milkv
zstd
protonvpn-gui
discord
agebox
findnixstorelinks
inotify-tools
beep
bastet # tetris
moon-buggy
pokete
blender
clinfo
yt-dlp
alsa-utils # aplay
guitarix
gxplugins-lv2
localsend
gparted
gqrx
nrsc5
hackrf
sdrangel
netcat
dsd # for gprx dmr decoding
dsdcc # for gprx dmr decoding
socat # for gprx dmr decoding
sox # for play
nickel
gnome.gnome-boxes
vdhcoapp # vdhcoapp install --user (see also https://github.com/NixOS/nixpkgs/issues/112046)
airspy
soapyairspy
gnome-multi-writer
util-linux # wipefs
ipmitool
];
}