-
Notifications
You must be signed in to change notification settings - Fork 0
/
configuration.nix
1565 lines (1425 loc) · 30.8 KB
/
configuration.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
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# By Abdullah As-Sadeed
{ config
, pkgs
, ...
}:
let
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/refs/heads/master.tar.gz";
secrets = import ./secrets.nix;
existingLibraryPaths = builtins.getEnv "LD_LIBRARY_PATH";
in
{
imports = [
(import "${home-manager}/nixos")
./hardware-configuration.nix
];
boot = {
loader = {
efi.canTouchEfiVariables = true;
timeout = 2;
systemd-boot = {
enable = true;
consoleMode = "max";
configurationLimit = null;
memtest86.enable = true;
};
};
initrd = {
enable = true;
luks.devices."luks-023f8417-62dd-4e65-b327-6c33b065486b".device = "/dev/disk/by-uuid/023f8417-62dd-4e65-b327-6c33b065486b";
network.ssh.enable = true;
verbose = true;
};
kernelPackages = pkgs.linuxPackages_zen;
extraModprobeConfig = "options kvm_intel nested=1";
kernelParams = [
"intel_iommu=on"
"iommu=pt"
"boot.shell_on_fail"
"rd.systemd.show_status=true"
# "rd.udev.log_level=3"
# "udev.log_priority=3"
];
consoleLogLevel = 5; # KERN_NOTICE
tmp.cleanOnBoot = true;
plymouth = {
enable = true;
theme = "bgrt";
};
};
time = {
timeZone = "Asia/Dhaka";
hardwareClockInLocalTime = true;
};
system = {
autoUpgrade = {
enable = false;
channel = "https://nixos.org/channels/nixos-unstable";
operation = "boot";
allowReboot = false;
};
activationScripts = { };
userActivationScripts = {
stdio = {
text = '' '';
deps = [
];
};
};
};
nix = {
enable = true;
settings = {
experimental-features = [
"nix-command"
];
# max-jobs = 1;
};
};
nixpkgs.config = {
allowUnfree = true;
android_sdk.accept_license = true;
};
i18n = {
defaultLocale = "en_US.UTF-8";
extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
supportedLocales = [
"all"
];
inputMethod = {
enable = true;
type = "fcitx5";
fcitx5 = {
waylandFrontend = true;
plasma6Support = true;
addons = with pkgs; [
fcitx5-openbangla-keyboard
];
};
};
};
networking = {
hostName = "Bitscoper-WorkStation";
networkmanager.enable = true;
firewall = {
enable = false;
allowPing = true;
allowedTCPPorts = [
];
allowedUDPPorts = [
];
};
};
hardware = {
enableAllFirmware = true;
enableRedistributableFirmware = true;
bluetooth = {
enable = true;
powerOnBoot = true;
};
pulseaudio.enable = false;
graphics = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver
intel-compute-runtime
];
};
sensor.hddtemp = {
enable = true;
unit = "C";
drives = [
"/dev/disk/by-path/*"
];
};
rtl-sdr.enable = true;
sane = {
enable = true;
openFirewall = true;
};
};
virtualisation = {
libvirtd = {
enable = true;
qemu = {
package = pkgs.qemu_kvm;
runAsRoot = true;
swtpm.enable = true;
ovmf = {
enable = true;
packages = [
(pkgs.OVMF.override {
secureBoot = true;
tpmSupport = true;
}).fd
];
};
};
};
spiceUSBRedirection.enable = true;
containers.enable = true;
podman = {
enable = true;
dockerCompat = true;
defaultNetwork.settings.dns_enabled = true;
};
waydroid.enable = true;
};
systemd = {
packages = with pkgs; [
cloudflare-warp
];
targets.multi-user.wants = [
"warp-svc.service"
];
tmpfiles.rules = [
"d /var/spool/samba 1777 root root -"
];
};
services = {
fwupd.enable = true;
power-profiles-daemon.enable = true;
logind = {
killUserProcesses = true;
lidSwitch = "ignore";
lidSwitchDocked = "ignore";
lidSwitchExternalPower = "ignore";
powerKey = "poweroff";
powerKeyLongPress = "poweroff";
rebootKey = "reboot";
rebootKeyLongPress = "reboot";
suspendKey = "ignore";
suspendKeyLongPress = "ignore";
hibernateKey = "ignore";
hibernateKeyLongPress = "ignore";
};
dbus.enable = true;
displayManager = {
sddm = {
enable = true;
wayland.enable = true;
};
defaultSession = "plasma";
};
desktopManager.plasma6.enable = true;
libinput.enable = true;
pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
wireplumber.extraConfig.bluetoothEnhancements = {
"monitor.bluez.properties" = {
"bluez5.enable-sbc-xq" = true;
"bluez5.enable-msbc" = true;
"bluez5.enable-hw-volume" = true;
"bluez5.roles" = [
"a2dp_sink"
"a2dp_source"
"bap_sink"
"bap_source"
"hfp_ag"
"hfp_hf"
"hsp_ag"
"hsp_hs"
];
"bluez5.codecs" = [
"aac"
"aptx"
"aptx_hd"
"aptx_ll"
"aptx_ll_duplex"
"faststream"
"faststream_duplex"
"lc3"
"lc3plus_h3"
"ldac"
"opus_05"
"opus_05_51"
"opus_05_71"
"opus_05_duplex"
"opus_05_pro"
"sbc"
"sbc_xq"
];
};
};
};
udev.packages = with pkgs; [
android-udev-rules
game-devices-udev-rules
rtl-sdr
usb-blaster-udev-rules
];
avahi = {
enable = true;
nssmdns4 = true;
publish = {
enable = true;
userServices = true;
};
openFirewall = true;
};
openssh = {
enable = true;
listenAddresses = [
{
addr = "0.0.0.0";
}
];
ports = [
22
];
allowSFTP = true;
banner = "Bitscoper-WorkStation";
settings = {
PermitRootLogin = "yes";
PasswordAuthentication = true;
X11Forwarding = false;
StrictModes = true;
UseDns = true;
LogLevel = "ERROR";
};
openFirewall = true;
};
sshd.enable = true;
system-config-printer.enable = true;
printing = {
enable = true;
listenAddresses = [
"*:631"
];
browsing = true;
webInterface = true;
allowFrom = [
"all"
];
defaultShared = true;
cups-pdf.enable = true;
drivers = with pkgs; [
gutenprint
];
startWhenNeeded = true;
extraConf = ''
DefaultLanguage en
ServerName Bitscoper-WorkStation
ServerAlias *
ServerTokens Full
ServerAdmin bitscoper@Bitscoper-WorkStation
BrowseLocalProtocols all
BrowseWebIF On
HostNameLookups On
AccessLogLevel config
AutoPurgeJobs Yes
PreserveJobHistory Off
PreserveJobFiles Off
DirtyCleanInterval 30
LogTimeFormat standard
'';
logLevel = "warn";
openFirewall = true;
};
ipp-usb.enable = true;
samba = {
enable = true;
package = pkgs.sambaFull;
smbd.enable = true;
nmbd.enable = true;
winbindd.enable = true;
nsswins = true;
usershares.enable = true;
settings = {
global = {
"server string" = "Bitscoper-WorkStation";
"netbios name" = "Bitscoper-WorkStation";
"hosts allow" = "0.0.0.0/0 ::/0";
"hosts deny" = "";
"load printers" = "yes";
"printing" = "cups";
"printcap name" = "cups";
security = "user";
workgroup = "BITSCOPER";
};
printers = {
comment = "All Printers";
path = "/var/spool/samba";
public = "yes";
browseable = "yes";
"guest ok" = "yes";
writable = "no";
printable = "yes";
"create mode" = 0700;
};
public = { };
private = { };
};
openFirewall = true;
};
samba-wsdd = {
enable = true;
openFirewall = true;
};
cockpit = {
enable = true;
port = 9090;
openFirewall = true;
};
phpfpm = {
phpOptions = ''
default_charset = "UTF-8"
error_reporting = E_ALL
display_errors = Off
log_errors = On
cgi.force_redirect = 1
expose_php = On
file_uploads = On
session.cookie_lifetime = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.use_strict_mode = 1
session.cookie_httponly = 1
session.cookie_secure = 1
session.cookie_samesite = "Strict"
session.gc_maxlifetime = 43200
session.use_trans_sid = O
session.cache_limiter = nocache
session.sid_length = 248
'';
};
postgresql = {
package = pkgs.postgresql;
enable = true;
enableTCPIP = true;
settings = pkgs.lib.mkForce {
listen_addresses = "*";
port = 5432;
jit = true;
};
authentication = pkgs.lib.mkOverride 10 ''
local all all trust
host all all 0.0.0.0/0 md5
host all all ::/0 md5
local replication all trust
host replication all 0.0.0.0/0 md5
host replication all ::/0 md5
'';
initialScript = pkgs.writeText "initScript" ''
ALTER USER postgres WITH PASSWORD '${secrets.password_1_of_bitscoper}';
'';
checkConfig = true;
};
mysql = {
package = pkgs.mariadb;
enable = true;
settings = {
mysqld = {
bind-address = "0.0.0.0";
port = 3306;
sql_mode = "";
};
};
initialScript = pkgs.writeText "initScript" ''
grant all privileges on *.* to 'root'@'%' identified by password '${secrets.hashed_password_1_of_bitscoper}' with grant option;
DELETE FROM mysql.user WHERE `Host`='localhost' AND `User`='root';
flush privileges;
'';
};
memcached = {
enable = true;
listen = "0.0.0.0";
port = 11211;
enableUnixSocket = false;
maxMemory = 64; # Megabytes
maxConnections = 256;
};
bind = {
enable = false;
listenOn = [
"any"
];
ipv4Only = false;
listenOnIpv6 = [
"any"
];
cacheNetworks = [
"127.0.0.0/24"
"::1/128"
];
extraOptions = ''
recursion no;
'';
};
tor = {
enable = false;
enableGeoIP = true;
settings = {
ContactInfo = "bitscoper@Bitscoper-WorkStation";
};
openFirewall = true;
};
nfs.server.enable = true;
icecast = {
enable = true;
hostname = "Bitscoper-WorkStation";
listen = {
address = "0.0.0.0";
port = 17101;
};
admin = {
user = "bitscoper";
password = secrets.password_1_of_bitscoper;
};
extraConf = ''
<location>Bitscoper-WorkStation</location>
<admin>bitscoper@Bitscoper-WorkStation</admin>
<authentication>
<source-password>${secrets.password_2_of_bitscoper}</source-password>
<relay-password>${secrets.password_2_of_bitscoper}</relay-password>
</authentication>
<directory>
<yp-url-timeout>15</yp-url-timeout>
<yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
</directory>
<logging>
<loglevel>2</loglevel>
</logging>
<server-id>Bitscoper-WorkStation</server-id>
'';
};
jellyfin = {
enable = true;
openFirewall = true;
};
ollama = {
enable = true;
host = "0.0.0.0";
port = 11434;
openFirewall = true;
};
static-web-server = {
enable = true;
listen = "[::]:80";
root = "/home/bitscoper/Public/";
configuration = {
general = {
health = false;
maintenance-mode = false;
grace-period = 0;
cache-control-headers = true;
redirect-trailing-slash = true;
directory-listing = true;
directory-listing-format = "html";
compression = true;
compression-level = "default";
compression-static = true;
log-level = "warn";
};
};
};
};
xdg.portal = {
enable = true;
extraPortals = with pkgs; [
kdePackages.xdg-desktop-portal-kde
];
};
security = {
rtkit.enable = true;
wrappers.spice-client-glib-usb-acl-helper.source = "${pkgs.spice-gtk}/bin/spice-client-glib-usb-acl-helper";
};
users.users.bitscoper = {
isNormalUser = true;
description = "Abdullah As-Sadeed";
extraGroups = [
"adbusers"
"audio"
"dialout"
"input"
"jellyfin"
"kvm"
"libvirtd"
"lp"
"networkmanager"
"plugdev"
"podman"
"qemu-libvirtd"
"scanner"
"tty"
"uucp"
"video"
"wheel"
"wireshark"
];
};
programs = {
nix-ld = {
enable = true;
libraries = with pkgs; [
];
};
appimage.enable = true;
nix-index.enableBashIntegration = true;
ssh = {
startAgent = true;
agentTimeout = null;
};
bash = {
completion.enable = true;
enableLsColors = true;
shellAliases = {
clean_build = "sudo nix-channel --update && sudo nix-env -u --always && sudo rm -rf /nix/var/nix/gcroots/auto/* && sudo nix-collect-garbage -d && nix-collect-garbage -d && sudo nix-store --gc && sudo nixos-rebuild switch --upgrade-all";
};
loginShellInit = ''
setfacl --modify user:jellyfin:--x ~
'';
shellInit = '' '';
interactiveShellInit = ''
PROMPT_COMMAND="history -a"
'';
};
gnupg = {
agent = {
enable = true;
enableBrowserSocket = true;
enableExtraSocket = true;
enableSSHSupport = false;
pinentryPackage = pkgs.pinentry-qt;
};
dirmngr.enable = true;
};
adb.enable = true;
system-config-printer.enable = true;
virt-manager.enable = true;
partition-manager.enable = true;
kde-pim.enable = true;
kdeconnect.enable = true;
firefox = {
enable = true;
languagePacks = [
"en-US"
];
};
dconf = {
enable = true;
profiles.user.databases = [
{
lockAll = true;
settings = {
"system/locale" = {
region = "en_US.UTF-8";
};
"org/virt-manager/virt-manager/connections" = {
autoconnect = [
"qemu:///system"
];
uris = [
"qemu:///system"
];
};
"org/virt-manager/virt-manager" = {
xmleditor-enabled = true;
};
"org/virt-manager/virt-manager/stats" = {
enable-cpu-poll = true;
enable-disk-poll = true;
enable-memory-poll = true;
enable-net-poll = true;
};
"org/virt-manager/virt-manager/confirm" = {
delete-storage = true;
forcepoweroff = true;
pause = true;
poweroff = true;
removedev = true;
unapplied-dev = true;
};
"org/virt-manager/virt-manager/console" = {
auto-redirect = false;
autoconnect = true;
};
"org/virt-manager/virt-manager/vmlist-fields" = {
cpu-usage = true;
disk-usage = true;
host-cpu-usage = true;
memory-usage = true;
network-traffic = true;
};
"org/virt-manager/virt-manager/new-vm" = {
cpu-default = "host-passthrough";
};
"com/github/huluti/Curtail" = {
file-attributes = true;
metadata = false;
new-file = true;
recursive = true;
};
};
}
];
};
};
environment = {
variables = pkgs.lib.mkForce {
LD_LIBRARY_PATH = "${pkgs.glib.out}/lib/:${pkgs.libGL}/lib/:${pkgs.stdenv.cc.cc.lib}/lib:${existingLibraryPaths}";
};
sessionVariables = {
NIXOS_OZONE_WL = "1";
CHROME_EXECUTABLE = "chromium";
};
systemPackages = with pkgs; [
acl
agi
android-backup-extractor
android-tools
arduino-cli
arduino-core
arduino-ide
arduino-language-server
aribb24
aribb25
audacity
avahi
avrdude
bat
bind
bleachbit
bluez
bluez-tools
bridge-utils
btop
btrfs-progs
butt
clinfo
cloudflare-warp
cmake
cockpit
cryptsetup
cups
cups-filters
cups-pdf-to-pdf
cups-printers
curl
curtail
d-spy
dart
dbeaver-bin
dbus
dconf-editor
dive
dmg2img
dovecot
esptool
exfatprogs
faac
faad2
fd
fdk_aac
ffmpeg-full
fh
file
flutter
fritzing
fwupd
fwupd-efi
gcc
gdb
ghfetch
gimp-with-plugins
git
git-doc
glib
glibc
gnumake
gource
gpredict
gpsd
gradle
gradle-completion
guestfs-tools
gzip
icecast
iconv
iftop
inotify-tools
jdk
jellyfin
jellyfin-ffmpeg
jellyfin-media-player
jellyfin-web
keepassxc
kicad
kompose
kubectl
kubernetes
kubernetes-helm
libGL
libaom
libappimage
libde265
libdvdcss
libdvdnav
libdvdread
libgcc
libgpg-error
libguestfs
libheif
libiconvReal
libnotify
libopus
libosinfo
libreoffice-fresh
libtinfo
libusb1
libuuid
libva-utils
libvirt
libvpx
libwebp
logrotate
lsof
luksmeta
lynis
mattermost-desktop
memcached
mixxx
nano
neofetch
networkmanager
ninja
nix-diff
nix-index
nixos-bgrt-plymouth
nixos-icons
nix-bash-completions
nixpkgs-fmt
nmap
obs-studio
ollama
onedrive
onionshare-gui
opendkim
openssh
openssl
patchelf
pcre
pgadmin4-desktopmode
php84
pipewire
pkg-config
platformio
platformio-core
podman
podman-compose
podman-tui
postfix
power-profiles-daemon
python312Full # python313Full
qpwgraph
rar
readline
ripgrep
rpPPPoE
rtl-sdr-librtlsdr
sane-backends
schroedinger
screen
sdrangel
sdrpp
smartmontools
spice-gtk
spice-protocol
swtpm
telegram-desktop
texliveFull
thermald
tk
tor
tor-browser
torsocks
tree
tree-sitter
undollar
ungoogled-chromium
unicode-emoji
universal-android-debloater
unrar
unzip
usbtop
usbutils
virtio-win
virtiofsd
vlc
vlc-bittorrent
vscode-js-debug
waydroid
wayland
wayland-protocols
wayland-utils
wget